-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgravy.sty
133 lines (109 loc) · 2.41 KB
/
gravy.sty
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{gravy}
\newif\if@gravy@nodate\@gravy@nodatefalse
\DeclareOption{nodate}{
\@gravy@nodatetrue
}
\newif\if@gravy@minted\@gravy@mintedfalse
\DeclareOption{minted}{
\@gravy@mintedtrue
}
\ProcessOptions*
% koma-script inserts the date using {\usekomafont{date}{\@date \par}} followed by a 1em \vskip
% subtract:
% - 1em for the height of the date itself
% - 1em for the space added afterwards
% - one \parskip for the space added by \par
\if@gravy@nodate
\date{~\vspace{-2em \@minus \parskip}}
\fi
% theorems
% loads amsthm, so it needs to be loaded before newtxmath math fonts (https://tex.stackexchange.com/a/520114)
\RequirePackage{gravytheorems}
% font setup
\RequirePackage[T1]{fontenc}
\RequirePackage{libertine}
\RequirePackage[libertine]{newtxmath}
\RequirePackage[scaled=0.83]{FiraMono}
% page setup
\KOMAoptions{
paper=letter,
usegeometry,
}
\RequirePackage{geometry}
\if@twoside
\geometry{
inner=99pt,outer=165pt,
top=84pt,
bottom=156pt
}
\else
\geometry{
paper=letterpaper,
hmargin=132pt,
top=84pt,
bottom=156pt
}
\fi
% improve ligature copy-pasting
% see: https://tex.stackexchange.com/a/64191
\pdfgentounicode=1
\input{glyphtounicode}
% hanging heading numbers
\renewcommand\sectionlinesformat[4]{%
\makebox[0pt][r]{#3}{#4}%
}
\ifdefined\chapterlinesformat
\renewcommand\chapterlinesformat[3]{%
\makebox[0pt][r]{#2}#3%
}
\fi
% list formatting
\RequirePackage{enumitem}
\setlist[itemize,enumerate,1]{leftmargin=0pt}
\setlist[itemize,3]{label=\textopenbullet}
\setlist{listparindent=\parindent,noitemsep}
\AtBeginDocument{
\ifdim\parskip=0pt
\setlist*{topsep=0.5em}
\fi
}
% typography
\RequirePackage{microtype}
% footer
\RequirePackage{scrlayer-scrpage}
\pagestyle{scrheadings}
\setkomafont{pagefoot}{\normalfont\sffamily}
\ihead[]{}
\chead[]{}
\ohead[]{}
\if@chapter
\automark[section]{chapter}
\ifoot[]{\headmark}
\else
\ifoot[]{\@title}
\fi
\cfoot[]{}
\ofoot[\pagemark]{\pagemark}
% math
\RequirePackage{mathtools}
\RequirePackage{esint}
% vocab
\RequirePackage{gravycolors}
\newcommand{\vocab}[1]{%
\textbf{\color{gravy@vocab}#1}%
}
% hyperlinks
\RequirePackage[pdfusetitle]{hyperref}
\hypersetup{
linktoc=all,
colorlinks=true,
urlcolor=gravy@blue,
linkcolor=gravy@blue,
citecolor=gravy@green,
addtopdfcreator=gravy,
}
\RequirePackage{gravycommands}
\if@gravy@minted
\RequirePackage{gravyminted}
\fi