Synchronize with FreeType. [2/2]
[ttfautohint.git] / doc / template.tex
blobbbbc3eaf2f8e29fb71deafc9838f4ff0f9740e31
1 \documentclass[$if(fontsize)$$fontsize$,$endif$%
2 $if(lang)$$lang$,$endif$%
3 DIV=13]{scrreprt}
5 \usepackage{ifxetex,ifluatex}
6 \usepackage[T1]{fontenc}
7 \usepackage[utf8]{inputenc}
8 \usepackage{fixltx2e}
9 \usepackage{libertine}
11 % Libertine Mono is too ugly; we use lmodern instead
12 \renewcommand{\ttfamily}{\fontfamily{lmtt}\selectfont}
14 \setkomafont{sectioning}{\normalfont\bfseries}
15 \setkomafont{descriptionlabel}{\normalfont}
16 \setkomafont{caption}{\normalfont\small}
18 $if(highlighting-macros)$
19 $highlighting-macros$
20 $endif$
22 $if(verbatim-in-note)$
23 \usepackage{fancyvrb}
24 $endif$
26 $if(fancy-enums)$
27 % Redefine labelwidth for lists; otherwise, the enumerate package will cause
28 % markers to extend beyond the left margin.
29 \makeatletter
31 \AtBeginDocument{%
32 \renewcommand{\@listi}
33 {\setlength{\labelwidth}{4em}}%
36 \makeatother
38 \usepackage{enumerate}
39 $endif$
41 $if(tables)$
42 \usepackage{longtable}
44 % We redefine the main `longtable' macro to suppress the ugly \medskip which
45 % pandoc inserts between rows.
47 % We also don't want line breaks after horizontal lines. This is quite
48 % tricky, since `longtable' doesn't provide a proper command. The solution
49 % below is taken from
51 % http://tex.stackexchange.com/questions/6350/how-to-disable-pagebreak-on-hline-in-longtable
53 % (with slight modifications) and we use it to simply redefine \hline
54 % locally. Note that this macro also adds some slight vertical space before
55 % and after the line to get better results (similar to `ctable').
57 \makeatletter
59 \def\LT@nobreakhline{%
60 \noalign{\ifnum0=`}\fi
61 \penalty\@M
62 \futurelet\@let@token\LT@@nobreakhline}
64 \def\LT@@nobreakhline{%
65 \ifx\@let@token\hline
66 \global\let\@gtempa\@gobble
67 \gdef\LT@sep{%
68 \penalty\@M
69 \vskip\doublerulesep}%
70 \else
71 \global\let\@gtempa\@empty
72 \gdef\LT@sep{%
73 \penalty\@M
74 \vskip-\arrayrulewidth}%
75 \fi
76 \ifnum0=`{\fi}%
78 \noalign{\vskip 0.4ex%
79 \penalty\@M}%
81 \multispan\LT@cols
82 \unskip\leaders\hrule\@height\arrayrulewidth\hfill\cr
83 \noalign{\LT@sep}%
84 \multispan\LT@cols
85 \unskip\leaders\hrule\@height\arrayrulewidth\hfill\cr
87 \noalign{\penalty\@M
88 \vskip 0.4ex}%
90 \noalign{\penalty\@M}%
91 \@gtempa}
93 \let\original@LT@array\LT@array
94 \def\LT@array{%
95 \let\medskip\relax
96 \let\LT@hline\LT@nobreakhline
97 \original@LT@array}
99 \makeatother
100 $endif$
102 $if(url)$
103 \usepackage{url}
104 $endif$
106 $if(graphics)$
107 \usepackage{graphicx}
109 % We will generate all images so they have a width 0.6\maxwidth. This means
110 % that they will get their normal width if they fit onto the page, but are
111 % scaled down if they would overflow this limit.
112 \makeatletter
114 \def\maxwidth{%
115 \ifdim\Gin@nat@width>\linewidth
116 \linewidth
117 \else
118 \Gin@nat@width
119 \fi}
121 \makeatother
123 \let\Oldincludegraphics\includegraphics
124 \renewcommand{\includegraphics}[1]{%
125 \Oldincludegraphics[width=0.6\maxwidth]{#1}}
126 $endif$
128 \ifxetex
129 \usepackage[setpagesize=false, % page size defined by xetex
130 unicode=false, % unicode breaks when used with xetex
131 xetex,
132 colorlinks=true,
133 linkcolor=blue]{hyperref}
134 \else
135 \usepackage[unicode=true,
136 colorlinks=true,
137 linkcolor=blue]{hyperref}
138 \usepackage{microtype}
140 \hypersetup{breaklinks=true,
141 pdfauthor={$author-meta$},
142 pdftitle={$title-meta$},
143 pdfborder={0 0 0}}
145 % We want the names `section 2', `subsection 4.1', and the like in local
146 % links, omitting the original link text. To do that, we redefine
147 % \hyperref.
148 \makeatletter
150 % We transform
152 % \hyperref[foo]{bar}
154 % into
156 % bar (\autoref{foo})
158 \def\label@hyperref[#1]#2{%
159 #2 (\autoref{#1})}
161 \makeatother
163 $if(subscript)$
164 \newcommand{\textsubscr}[1]{%
165 \ensuremath{_{\scriptsize\textrm{#1}}}}
166 $endif$
168 \setlength{\parindent}{0pt}
169 \setlength{\parskip}{6pt plus 2pt minus 1pt}
170 \setlength{\emergencystretch}{3em} % prevent overfull lines
172 % We want a break after the description label (if there is one).
173 \makeatletter
175 \let\original@item\@item
176 \def\description@item[#1]{%
177 \if@noparitem
178 \@donoparitem
179 \else
180 \if@inlabel
181 \indent \par
183 \ifhmode
184 \unskip\unskip \par
186 \if@newlist
187 \if@nobreak
188 \@nbitem
189 \else
190 \addpenalty\@beginparpenalty
191 \addvspace\@topsep
192 \addvspace{-\parskip}%
194 \else
195 \addpenalty\@itempenalty
196 \addvspace\itemsep
198 \global\@inlabeltrue
200 \everypar{%
201 \@minipagefalse
202 \global\@newlistfalse
203 \if@inlabel
204 \global\@inlabelfalse
205 {\setbox\z@\lastbox
206 \ifvoid\z@
207 \kern-\itemindent
208 \fi}%
209 \box\@labels
210 \penalty\z@
212 \if@nobreak
213 \@nobreakfalse
214 \clubpenalty \@M
215 \else
216 \clubpenalty \@clubpenalty
217 \everypar{}%
218 \fi}%
219 \if@noitemarg
220 \@noitemargfalse
221 \if@nmbrlist
222 \refstepcounter\@listctr
225 \sbox\@tempboxa{\makelabel{#1}}%
226 \global\setbox\@labels\hbox{%
227 \unhbox\@labels
228 \hskip \itemindent
229 \hskip -\labelwidth
230 \hskip -\labelsep
231 \ifdim \wd\@tempboxa >\labelwidth
232 \box\@tempboxa
233 \else
234 \hbox to\labelwidth {\unhbox\@tempboxa}%
236 \hskip \labelsep}%
237 \def\reserved@a{#1}%
238 \def\reserved@b{\@itemlabel}%
239 \ifx\reserved@a \reserved@b
240 \else
241 \leavevmode\\
243 \ignorespaces}
245 \renewenvironment{description}{%
246 \list{}{\labelwidth\z@ \itemindent-\leftmargin
247 \let\makelabel\descriptionlabel
248 \let\@item\description@item}%
250 \let\@item\original@item
251 \endlist
254 \makeatother
256 % we want block quotes formatted as italic
257 \renewenvironment{quote}{%
258 \list{}{\rightmargin\leftmargin}%
259 \item\relax
260 \itshape
262 \endlist
267 $if(numbersections)$
268 \setcounter{secnumdepth}{5}
269 $else$
270 \setcounter{secnumdepth}{0}
271 $endif$
273 $if(verbatim-in-note)$
274 \VerbatimFootnotes % allows verbatim text in footnotes
275 $endif$
277 $if(lang)$
278 \ifxetex
279 \usepackage{polyglossia}
280 \setmainlanguage{$mainlang$}
281 \else
282 \usepackage[$lang$]{babel}
284 $endif$
286 $for(header-includes)$
287 $header-includes$
288 $endfor$
290 $if(title)$
291 \title{$title$}
292 $endif$
293 \author{$for(author)$$author$$sep$ \and $endfor$}
294 $if(version)$
295 \date{Version $version$}
296 $endif$
298 \begin{document}
299 $if(title)$
300 \maketitle
301 $endif$
303 $for(include-before)$
304 $include-before$
305 $endfor$
307 $if(toc)$
308 \tableofcontents
309 $endif$
311 $body$
313 $for(include-after)$
314 $include-after$
315 $endfor$
317 \end{document}