-
Notifications
You must be signed in to change notification settings - Fork 85
/
main.tex
96 lines (77 loc) · 2.46 KB
/
main.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
\documentclass[hidelinks,10pt]{book}
%% Differentiate out the prelude to use in standalone markdown builds
\input{prelude.tex}
% Set up glossaries here so they aren't generated in each
\usepackage[toc,section=chapter]{glossaries}
\input{glossary.tex}
\makeglossaries
% Define and set styles so not injected into the markdown
% Pandoc chokes while processing the following, so put them here
\lstdefinestyle{cstyle}
{
language=C,
showspaces=false,
showtabs=false,
breaklines=true,
showstringspaces=false,
breakatwhitespace=true,
tabsize=4,
commentstyle=\color{comment}\itshape,
stringstyle=\color{red}\bfseries,
basicstyle=\ttfamily,
keywordstyle=\color{purple}\bfseries,
otherkeywords = {;,<<,>>,++,<,>,\#include,\#define},
morekeywords = [2]{;,\#include,\#define},
keywordstyle = [2]{\color{blue}\bfseries},
morekeywords = [3]{<<, >>},
keywordstyle = [3]{\color{yellow}},
morekeywords = [4]{++},
keywordstyle = [4]{\color{teal}},
morekeywords = [5]{<,>},
keywordstyle = [5]{\color{yellow}},
literate={\{}{{\CodeSymbol{ \{}}}1
{\}}{{\CodeSymbol{\}}}}1
}
\lstset{language=C,style=cstyle}
%% Spacing
\titlespacing*{\section}
{0pt}{5.5ex plus 1ex minus .2ex}{4.3ex plus .2ex}
\titlespacing*{\subsection}
{0pt}{5.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
\titlespacing*{\subsubsection}
{0pt}{5.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
%% PDF Sizes
\titleformat*{\section}{\LARGE\bfseries}
\titleformat*{\subsection}{\Large\bfseries}
\titleformat*{\subsubsection}{\large\bfseries}
\titleformat*{\paragraph}{\large\bfseries}
\titleformat*{\subparagraph}{\large\bfseries}
%% Go to the next page if a section only has 3 lines
\widowpenalties 3 10000 10000 0
% this is a terrible hack, but pandoc sucks
% we have to call any
\lstnewenvironment{minted}{m}
{\noindent\minipage{\linewidth}\medskip
\lstset{basicstyle=\ttfamily\footnotesize,frame=single,language=#1}}
{\endminipage}
\usepackage{tocloft}
%% Add some space to the table of contents justification
\addtolength{\cftsecnumwidth}{10pt}
%% Epub command
\ifcsname ifepub\endcsname\else
\expandafter\let\csname ifepub\expandafter\endcsname
\csname iffalse\endcsname
\fi
\begin{document}
\raggedbottom
%% The title so that it isn't included in the chapters
%% Introduction, background, then the book starts
\setcounter{chapter}{0}
\frontmatter
\include{title}
\fancyhf{}
\mainmatter
\input{order.tex}
%% Add glossaries back in when a number of terms have been defined
%% \printglossaries
\end{document}