-
Notifications
You must be signed in to change notification settings - Fork 7
/
drake.tex
328 lines (328 loc) · 11.8 KB
/
drake.tex
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
%Typora theme : https://github.com/liangjingkanji/DrakeTyporaTheme
\documentclass{article}
% Use upquote if available, for straight quotes in verbatim environments
\usepackage{upquote}
\usepackage[]{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
\KOMAoptions{parskip=half}}
\makeatother
\usepackage{color}
\usepackage{fancyvrb}
\newcommand{\VerbBar}{|}
\usepackage{fvextra}
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{numbers=left,breaklines,breakanywhere,commandchars=\\\{\}}
\renewcommand{\theFancyVerbLine}{\textcolor[HTML]{585B5D}{\small\arabic{FancyVerbLine}}}
% Add ',fontsize=\small' for more characters per line
\usepackage{calc} % for calculating minipage widths
% Correct order of tables after \paragraph or \subparagraph
\usepackage{etoolbox}
\makeatletter
\makeatother
\usepackage{footnotehyper}
\usepackage{graphicx}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
% Set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother
\usepackage{soul}
\setul{0.175em}{0.06em}
% Avoid problems with \sout in headers with hyperref
%\pdfstringdefDisableCommands{\renewcommand{\sout}{}}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
%---
\newlength{\px}
\setlength{\px}{0.0104166667in}
%colors
\usepackage[table]{xcolor}
\definecolor{BackgroundColor}{HTML}{FFFFFF}
\definecolor{TextColor}{HTML}{333333}
\definecolor{TitleColor}{HTML}{273849}
\definecolor{DrakeAccentColor}{HTML}{E95F59}
\definecolor{DrakeHighlightColor}{HTML}{D63200}
\definecolor{BlockquoteBgColor}{HTML}{FDEFEE}
\definecolor{CodeBlockBgColor}{HTML}{2B2B2B}
\definecolor{CodeBlockColor}{HTML}{A9B7C6}
\definecolor{TableBorderColor}{HTML}{DFE2E5}
\definecolor{TableEvenColor}{HTML}{F8F8F8}
\definecolor{BoxColor}{HTML}{A8A8A8}
\definecolor{CheckedColor}{HTML}{65B73B}
\definecolor{UncheckedColor}{HTML}{333333}
\pagecolor{BackgroundColor}
\usepackage[colorlinks=true,allcolors=DrakeHighlightColor,hidelinks]{hyperref}
%metadata
\hypersetup{
$if(subject)$
$if(title-meta)$
pdftitle={$title-meta$},
$endif$
$if(author-meta)$
pdfauthor={$author-meta$},
$endif$
$if(subject)$
pdfsubject={$subject$},
$endif$
$if(keywords)$
pdfkeywords={$for(keywords)$$keywords$$sep$, $endfor$},
$endif$
$if(subject)$
pdfsubject={$subject$},
$endif$
pdfsubject={$subject$},
$endif$
pdfcreator={XeLaTeX via Pandoc drake theme},
}
%--------underline links
\makeatletter
\begingroup%copied and modified from href-ul.sty
%$$ used as escape sequence
\catcode`\$$=6 %
\catcode`\#=12 %
\gdef\href@split$$1#$$2#$$3\\$$4{%
\hyper@@link{$$1}{$$2}{\ul{$$4}}%
\endgroup%
}
\endgroup
\makeatother
%--------
\author{}
\date{}
\usepackage[a4paper,textwidth=1200\px,top=20\px,left=30\px,right=30\px,bottom=100\px]{geometry}
%fonts
\usepackage{fontspec}
%-------set global color
\makeatletter
\color{TextColor}\global\let\default@color\current@color
\makeatother
%-------https://tex.stackexchange.com/a/29409
\setmainfont[Extension=.ttf,Path=/usr/share/fonts/pandoc-fonts/drake-fonts/jetbrainsmono-,UprightFont=regular,ItalicFont=italic,BoldFont=bold,BoldItalicFont=bolditalic]{}
\usepackage[fontsize=0.1250000004in]{fontsize}%12px
\linespread{1.333}%1.6/1.2
%headings
\usepackage{titlesec}
\usepackage{soul}
\titleformat*{\section}{\filcenter\fontsize{2em}{1.4\baselineskip}\bfseries\color{TitleColor}}
\titlespacing{\section}{0pt}{2em}{1em}
\titleformat{\subsection}{\fontsize{1.8em}{3em}\bfseries\color{TitleColor}}{}{}{\setul{0.3em}{0.2em}\setulcolor{TitleColor}\ul}[\resetul]
\titlespacing{\subsection}{0pt}{2em}{1em}
\titleformat*{\subsubsection}{\fontsize{1.4em}{1.4\baselineskip}\bfseries\color{TitleColor}}
\titlespacing{\subsubsection}{0pt}{2em}{1em}
\titleformat*{\paragraph}{\fontsize{1.2em}{1.4\baselineskip}\bfseries\color{TitleColor}}
\titlespacing{\paragraph}{0pt}{2em}{1em}
\titleformat{\subparagraph}{\fontsize{1em}{1.4\baselineskip}\bfseries\color{TitleColor}}{}{}{}%\titleformat* prevents newline
\titlespacing{\subparagraph}{0pt}{2em}{1em}
\raggedright
%bold
\let\Textbf\textbf
\renewcommand{\textbf}[1]{\textcolor{TitleColor}{\Textbf{#1}}}
%quotes
\usepackage[most]{tcolorbox}
\renewenvironment{quote}{
\begin{tcolorbox}[
notitle,
frame hidden,
enhanced,
outer arc=2\px,
arc=2\px,
colback=BlockquoteBgColor,
coltext=TextColor,
boxsep=0em,
top=10\px,
bottom=10\px,
right=16\px,
left=16\px,
overlay={
\fill[DrakeAccentColor]
([xshift=2\px,yshift=-2\px]interior.north west)--
([xshift=2\px,yshift=2\px]interior.south west)
arc(0:-180:2\px)--
([xshift=-2\px,yshift=2\px]interior.south west)--
([xshift=-2\px,yshift=-2\px]interior.north west)
arc(180:0:2\px)--
cycle;
}
]
}{
\end{tcolorbox}
}
\AtBeginEnvironment{quote}{
\renewcommand{\textbf}[1]{\textcolor{TextColor}{\Textbf{#1}}}
}
%code background
\newenvironment{Shaded}{
\begin{tcolorbox}[
notitle,
breakable,
frame hidden,
sharp corners,
enhanced,
boxrule=0pt,
colback=CodeBlockBgColor,
coltext=CodeBlockColor,
boxsep=0em,
left=2\px,
right=2\px,
]
}{
\end{tcolorbox}
}
%syntax highlighting - taken from CodeMirror
\newcommand{\AlertTok}[1]{#1}
\newcommand{\AnnotationTok}[1]{#1}
\newcommand{\AttributeTok}[1]{\textcolor[HTML]{9876AA}{\FancyVerbBreakStart#1\FancyVerbBreakStop}}
\newcommand{\BaseNTok}[1]{#1}
\newcommand{\BuiltInTok}[1]{\textcolor[HTML]{FF9E59}{\FancyVerbBreakStart#1\FancyVerbBreakStop}}
\newcommand{\CharTok}[1]{#1}
\newcommand{\CommentTok}[1]{\textcolor[HTML]{787878}{\FancyVerbBreakStart#1\FancyVerbBreakStop}}
\newcommand{\CommentVarTok}[1]{#1}
\newcommand{\ConstantTok}[1]{#1}
\newcommand{\ControlFlowTok}[1]{#1}
\newcommand{\DataTypeTok}[1]{\textcolor[HTML]{9876AA}{\FancyVerbBreakStart#1\FancyVerbBreakStop}}
\newcommand{\DecValTok}[1]{\textcolor[HTML]{6897BB}{\FancyVerbBreakStart#1\FancyVerbBreakStop}}
\newcommand{\DocumentationTok}[1]{#1}
\newcommand{\ErrorTok}[1]{\textcolor[HTML]{BC3F3C}{\FancyVerbBreakStart#1\FancyVerbBreakStop}}
\newcommand{\ExtensionTok}[1]{#1}
\newcommand{\FloatTok}[1]{\textcolor[HTML]{6897BB}{\FancyVerbBreakStart#1\FancyVerbBreakStop}}
\newcommand{\FunctionTok}[1]{#1}
\newcommand{\ImportTok}[1]{#1}
\newcommand{\InformationTok}[1]{#1}
\newcommand{\KeywordTok}[1]{\textcolor[HTML]{CC7832}{\FancyVerbBreakStart#1\FancyVerbBreakStop}}
\newcommand{\NormalTok}[1]{#1}
\newcommand{\OperatorTok}[1]{#1}
\newcommand{\OtherTok}[1]{#1}
\newcommand{\PreprocessorTok}[1]{#1}
\newcommand{\RegionMarkerTok}[1]{#1}
\newcommand{\SpecialCharTok}[1]{#1}
\newcommand{\SpecialStringTok}[1]{\textcolor[HTML]{6A8759}{\FancyVerbBreakStart#1\FancyVerbBreakStop}}
\newcommand{\StringTok}[1]{\textcolor[HTML]{6A8759}{\FancyVerbBreakStart#1\FancyVerbBreakStop}}
\newcommand{\VariableTok}[1]{#1}
\newcommand{\VerbatimStringTok}[1]{#1}
\newcommand{\WarngingTok}[1]{#1}
%no highlighting code
\RecustomVerbatimEnvironment{verbatim}{Verbatim}{breaklines,breakanywhere}%https://tex.stackexchange.com/a/469504
\BeforeBeginEnvironment{verbatim}{\begin{Shaded}}
\AfterEndEnvironment{verbatim}{\end{Shaded}}
%inline code behaviour
\def\VERB|#1|{{\Verb[breaklines,breakanywhere,formatcom=\color{DrakeHighlightColor},commandchars=\\\{\}]|#1|}}
\renewcommand{\texttt}[1]{\VERB|#1|}
%tables
%underline on every row
\makeatletter
\let\Tabularcr\@arraycr
\def\@arraycr{\Tabularcr\hline}
\makeatother
%https://stackoverflow.com/a/3175486 second comment
\usepackage{xstring}
\usepackage{longtable}
\let\Longtable\longtable
\let\EndLongtable\endlongtable
\def\table#1{\Longtable{#1}}
%deviation: not stretching table across width for aesthetics
%deviation: not making table head bold to give user more freedom
\setlength{\tabcolsep}{13\px}
\renewcommand{\arraystretch}{1.3}%eyeballing
\arrayrulecolor{TableBorderColor}
\renewenvironment{longtable}[3]{
\gdef\embolden{\bfseries}
\newcolumntype{L}{|>{\embolden}l}
\newcolumntype{R}{|>{\embolden}r}
\newcolumntype{C}{|>{\embolden}c}
\StrGobbleLeft{#3}{2}[\pream]
\StrGobbleRight{\pream}{2}[\pream]
\StrSubstitute{\pream}{l}{L}[\pream]
\StrSubstitute{\pream}{r}{R}[\pream]
\StrSubstitute{\pream}{c}{C}[\pream]
\edef\pream{{\pream|}}
\newcommand{\toprule}[2]{}
\newcommand{\midrule}[2]{\color{TextColor}}
\def\endhead{\gdef\embolden{}}
\newcommand{\bottomrule}[2]{}
\renewcommand{\endlastfoot}{}
\begin{center}
\rowcolors{2}{TableEvenColor}{BackgroundColor}%https://tex.stackexchange.com/a/5365
\expandafter\table\pream
\noalign{\global\arrayrulewidth=0.1em}%https://tex.stackexchange.com/a/337790
\hline
}{
\EndLongtable
\end{center}
\vspace{1.5em}
}
%lists and tasklists
\usepackage{amssymb}
\usepackage{environ}
\renewcommand{\square}{
\resizebox{1.6em}{1.6em}{%https://tex.stackexchange.com/a/75450
\begin{tikzpicture}
\path[fill=UncheckedColor] (.8106670,.2133330) -- (.8106670,.8106670) --
(.2133330,.8106670) -- (.2133330,.2133330) --
(.8106670,.2133330)(.8106670,.1280000) -- (.2133330,.1280000) .. controls
(.1664000,.1280000) and (.1280000,.1664000) .. (.1280000,.2133330) --
(.1280000,.8106670) .. controls (.1280000,.8576000) and (.1664000,.8960000) ..
(.2133330,.8960000) -- (.8106670,.8960000) .. controls (.8576000,.8960000) and
(.8960000,.8576000) .. (.8960000,.8106670) -- (.8960000,.2133330) .. controls
(.8960000,.1664000) and (.8576000,.1280000) .. (.8106670,.1280000) -- cycle;
\end{tikzpicture}
}
}
\renewcommand{\boxtimes}{
\resizebox{1.6em}{1.6em}{%https://tex.stackexchange.com/a/75450
\begin{tikzpicture}
\path[fill=CheckedColor] (.4259840,.2979410) -- (.8099840,.6819410) --
(.7499940,.7439360) -- (.4259840,.4199250) -- (.2739630,.5719460) --
(.2139730,.5119570) -- cycle(.8099840,.8959570) .. controls
(.8339907,.8959570) and (.8543283,.8872957) .. (.8709970,.8699730) .. controls
(.8876657,.8526503) and (.8960000,.8326537) .. (.8960000,.8099830) --
(.8960000,.2139730) .. controls (.8960000,.1913030) and (.8876657,.1713063) ..
(.8709970,.1539830) .. controls (.8543283,.1366597) and (.8339907,.1279987) ..
(.8099840,.1280000) -- (.2139740,.1280000) .. controls (.1899667,.1280000) and
(.1696287,.1366613) .. (.1529600,.1539840) .. controls (.1362913,.1713067) and
(.1279570,.1913030) .. (.1279570,.2139730) -- (.1279570,.8099830) .. controls
(.1279570,.8326537) and (.1362913,.8526503) .. (.1529600,.8699730) .. controls
(.1696287,.8872957) and (.1899663,.8959570) .. (.2139730,.8959570) -- cycle;
\end{tikzpicture}
}
}
%deviation unordered list inside ordered list is not considered as nested
\renewcommand{\labelitemi}{\textbullet\hspace{1.8mm}}%1.8 from eyeballing
\renewcommand{\labelitemii}{\(\circ\)\hspace{1.8mm}}
\renewcommand{\labelitemiii}{\tiny{\(\blacksquare\)}\hspace{1.8mm}}
\renewcommand{\labelitemiv}{\tiny{\(\blacksquare\)}\hspace{1.8mm}}
%definition lists
\renewcommand{\descriptionlabel}[1]{#1}%remove bold
\usepackage{enumitem}
\setlist[description]{style=nextline,leftmargin=0pt}
\def\colon{: }
\AtBeginEnvironment{description}{
\AddToHook{para/begin}[colon]{\colon}
\let\Item\item
\renewcommand{\item}[1][\null]{\gdef\colon{}\Item[#1]:\gdef\colon{: }}
}
\AtEndEnvironment{description}{
\RemoveFromHook{para/begin}[colon]
}
%horizontal rules
\let\Rule\rule
\renewcommand{\rule}[2]{\vspace{16\px}\textcolor{TitleColor}{\Rule{\linewidth}{2\px}}\vspace{16\px}}
%document
\begin{document}
$body$
\end{document}