b4f8bcab981e2e010766b66afe1a71df33e8f736
[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 %% History page.
73 \def\historypage{
74     \fancyfoot[C]{\pagefoot}
75     \huge \textbf{Release history} \normalsize
76     \vspace{3em}
77
78     \begin{tabular}{|l|l|l|}
79     \hline
80     First Edition       & April 2002    & \\
81     \hline
82     Second Edition      & August 2002   & Minor revisions \\
83     \hline
84     Third Edition       & August 2004   & Alignment with Inform 6.30 \\
85                         &               & Further minor revisions \\
86     \hline
87     \end{tabular}
88     \newpage
89 }
90
91 %% Contents page.
92 \def\contentspage{
93     \fancyfoot[C]{\pagefoot}
94     \tableofcontents
95 }
96
97 %% Main text.
98 \def\maintext{
99     \fancyfoot[C]{\pagefoot}
100     \pagenumbering{arabic}
101     \renewcommand\thepage{\arabic{page}}
102     \setcounter{page}{1}
103 }
104
105 %% Start the main chapter text.
106 \def\startchapters{
107     \setcounter{secnumdepth}{1}
108 }
109
110 %% Start the appendices
111 \def\startappendices{
112     \setcounter{secnumdepth}{0}
113 }
114
115 %% Disable standard title (but keep PDF info).
116 \renewcommand{\maketitle}{
117   \ifsphinxpdfoutput
118     \begingroup
119     % These \defs are required to deal with multi-line authors; it
120     % changes \\ to ', ' (comma-space), making it pass muster for
121     % generating document info in the PDF file.
122     \def\\{, }
123     \def\and{and }
124     \pdfinfo{
125       /Title (${title})
126       /Author (${author})
127     }
128     \endgroup
129   \fi
130 }
131
132 %% Fix up index and references.
133 \makeatletter
134
135 \renewcommand{\theindex}{
136   \newpage
137   \phantomsection
138   \py@OldTheindex
139   \addcontentsline{toc}{section}{Index}
140 }
141
142 \renewcommand{\thebibliography}[1]{
143   \newpage
144   \phantomsection
145   \py@OldThebibliography{1}
146   \addcontentsline{toc}{section}{References}
147 }
148
149 \makeatother
150
151 %% For picture alphabet drop caps
152 \newcommand{\dropcap}[1]{\lettrine[lines=3]{\ECFAPicture{\fontsize{50}{60}\selectfont #1}\normalfont}{}}