-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathGeneralMacros.sty
More file actions
87 lines (76 loc) · 2.1 KB
/
GeneralMacros.sty
File metadata and controls
87 lines (76 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
\ProvidesPackage{GeneralMacros}[general style definitions]
\RequirePackage{graphicx}
\RequirePackage{xparse}
\RequirePackage{svg}
% Image with caption
\NewDocumentCommand\imageWithCaption{mmmo}{
\begin{figure}[h]
\centering
\adjustbox{center}{\adjustbox{cfbox=white!90!black 2pt 0pt}{\includegraphics[#3]{#1}}}
\caption{#2}
\IfValueT{#4}{\label{#4}}
\end{figure}
}
% SVG with caption
\NewDocumentCommand\svgWithCaption{mmmo}{
\begin{figure}[h]
\centering
\adjustbox{center}{\adjustbox{cfbox=white!90!black 2pt 0pt}{\includesvg[inkscapearea=page,#3]{#1}}}
\caption{#2}
\IfValueT{#4}{\label{#4}}
\end{figure}
}
\newfontfamily\DejaSans{DejaVu Sans}
\NewDocumentCommand\emojiFont{m}{
{\DejaSans #1}%
}
\NewDocumentCommand{\includePDF}{m O{1} m O{}}
{%
\foreach \x in {#2,...,#3} {%
\begin{center}%
\makebox[\textwidth]{\includegraphics[page=\x, #4]{#1}}%
\end{center}%
\clearpage%
}
}
% Ruler commands
% https://tex.stackexchange.com/a/309705/7083
% \xhrulefill[height=-2pt,thickness=1pt,fill=3cm]
\ExplSyntaxOn
\NewDocumentCommand{\xhrulefill}{O{}}
{
\group_begin:
\severin_xhrulefill:n { #1 }
\group_end:
}
\NewDocumentCommand{\xhrule}{O{}}
{
\group_begin:
\severin_xhrule:n { #1 }
\group_end:
}
\keys_define:nn { severin/xhrulefill }
{
height .dim_set:N = \l_severin_xhrule_height_dim,
thickness .dim_set:N = \l_severin_xhrule_thickness_dim,
fill .skip_set:N = \l_severin_xhrule_fill_skip,
height .initial:n = 0pt,
thickness .initial:n = 0.4pt,
fill .initial:n = 0pt plus 1fill,
}
\cs_new_protected:Nn \severin_xhrule:n
{
\keys_set:nn { severin/xhrulefill } { #1 }
\rule[\l_severin_xhrule_height_dim]{\l_severin_xhrule_fill_skip}{\l_severin_xhrule_thickness_dim}
}
\cs_new_protected:Nn \severin_xhrulefill:n
{
\keys_set:nn { severin/xhrulefill } { #1 }
\leavevmode
\leaders\hrule
height \dim_eval:n { \l_severin_xhrule_thickness_dim + \l_severin_xhrule_height_dim }
depth \dim_eval:n { -\l_severin_xhrule_height_dim }
\skip_horizontal:N \l_severin_xhrule_fill_skip
\kern 0pt
}
\ExplSyntaxOff