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