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