Tweak the default latex settings.
[ibg.git] / config / preamble.tex
1 %% LaTeX preamble.
2
3 \usepackage[left=2.5cm,right=2.5cm,top=3cm,bottom=3cm]{geometry}
4 \usepackage{setspace}
5
6 %% Set up page.
7 \pagestyle{fancy}
8 \pagenumbering{roman}
9 \thispagestyle{fancy}
10
11 \renewcommand\thepage{\roman{page}}
12 \newcommand\pagefoot{\thepage}
13
14 %% Set various lengths.
15 \setlength{\parskip}{\medskipamount}
16 \setlength{\parindent}{0pt}
17
18 %% Set section numbering depth.
19 \setcounter{secnumdepth}{0}
20
21 %% Set up headers and footers.
22 \fancyhead{}
23 \fancyfoot{}
24
25 \renewcommand{\headrulewidth}{0.0pt}
26 \renewcommand{\footrulewidth}{0.0pt}
27
28 %% Revert to original table of contents.
29 \makeatletter
30 \renewcommand{\tableofcontents}{\py@OldTableofcontents}
31 \makeatother
32
33 %% Covering page.
34 \def\coverpage{
35     \begin{titlepage}
36     \centering
37     \textbf{\Huge ${title}}\par
38     \vspace{0.5cm}
39     \textbf{\LARGE ${author}}\par
40     \vspace{2cm}
41     \includegraphics[width=\textwidth]{${image}}\par
42     \vspace{2cm}
43     \textit{\large ${edition}}\par
44     \vspace{0.5cm}
45     \textbf{\large ${extra}}\par
46     \vfill
47     \end{titlepage}
48     \newpage
49 }
50
51 %% License page
52 \def\licensepage{
53     \fancyfoot[C]{\pagefoot}
54     ${title}
55
56     Authors: ${author}\par
57     Editor: ${editor}\par
58
59     Cover: \textit{${imagetitle}} ${imageinfo}
60
61     ${licensetext}
62     \newpage
63 }
64
65 %% Contents page.
66 \def\contentspage{
67     \fancyfoot[C]{\pagefoot}
68     \tableofcontents
69 }
70
71 %% Main text.
72 \def\maintext{
73     \fancyfoot[C]{\pagefoot}
74     \pagenumbering{arabic}
75     \renewcommand\thepage{\arabic{page}}
76     \setcounter{page}{1}
77 }
78
79 %% Start the main chapter text.
80 \def\startchapters{
81     \setcounter{secnumdepth}{1}
82 }
83
84 %% Start the appendices
85 \def\startappendices{
86     \setcounter{secnumdepth}{0}
87 }
88
89 %% Disable standard title (but keep PDF info).
90 \renewcommand{\maketitle}{
91   \ifsphinxpdfoutput
92     \begingroup
93     % These \defs are required to deal with multi-line authors; it
94     % changes \\ to ', ' (comma-space), making it pass muster for
95     % generating document info in the PDF file.
96     \def\\{, }
97     \def\and{and }
98     \pdfinfo{
99       /Title (${title})
100       /Author (${author})
101     }
102     \endgroup
103   \fi
104 }
105
106 %% Fix up index and references.
107 \makeatletter
108
109 \renewcommand{\theindex}{
110   \newpage
111   \phantomsection
112   \py@OldTheindex
113   \addcontentsline{toc}{section}{Index}
114 }
115
116 \renewcommand{\thebibliography}[1]{
117   \newpage
118   \phantomsection
119   \py@OldThebibliography{1}
120   \addcontentsline{toc}{section}{References}
121 }
122
123 \makeatother