autotroll.m4: Clean up Qt path stuff.
[ttfautohint.git] / doc / template.tex
blob07ead95219f0a1390e8839c90c412147ddcf22c2
1 % For non-ASCII characters, this template only works with luatex or XeTeX.
2 % Arabic, Armenian, Bengali, Cherokee, Devanagari, Ethiopic, Georgian,
3 % Gujarati, Gurmukhi, Kannada, Khmer, Lao, Malayalam, Myanmar, Sinhala,
4 % Tamil, Telugu, and Thai support currently works with XeTeX only.
6 \documentclass[$if(fontsize)$$fontsize$,$endif$%
7 $if(lang)$$lang$,$endif$%
8 DIV=13]{scrreprt}
10 \usepackage{ifxetex,ifluatex}
11 \usepackage[T1]{fontenc}
12 \usepackage{fixltx2e}
13 \usepackage{fontspec-patched}
14 \usepackage{libertine}
16 \ifxetex
17 % with newer releases of `fontspec', fonts should be defined before
18 % including `ucharclasses'
19 \newfontfamily{\adlamfont}[Script=Adlam]{NotoSansAdlam-Regular.ttf}
20 \newfontfamily{\arabicfont}[Script=Arabic]{NotoSansArabic-Regular.ttf}
21 \newfontfamily{\armenianfont}[Script=Armenian]{NotoSansArmenian-Regular.ttf}
22 \newfontfamily{\avestanfont}[Script=Avestan]{NotoSansAvestan-Regular.ttf}
23 \newfontfamily{\bamumfont}[Script=Bamum]{NotoSansBamum-Regular.ttf}
24 \newfontfamily{\bengalifont}[Script=Bengali]{NotoSansBengali-Regular.ttf}
25 \newfontfamily{\buhidfont}[Script=Buhid]{NotoSansBuhid-Regular.ttf}
26 \newfontfamily{\canadianfont}[Script=Canadian Syllabics]{NotoSansCanadianAboriginal-Regular.ttf}
27 \newfontfamily{\carianfont}[Script=Carian]{NotoSansCarian-Regular.ttf}
28 \newfontfamily{\chakmafont}[Script=Chakma]{NotoSansChakma-Regular.ttf}
29 \newfontfamily{\cherokeefont}[Script=Cherokee]{NotoSansCherokee-Regular.ttf}
30 \newfontfamily{\copticfont}[Script=Coptic]{NotoSansCoptic-Regular.ttf}
31 \newfontfamily{\cypriotfont}[Script=Cypriot Syllabary]{NotoSansCypriot-Regular.ttf}
32 \newfontfamily{\cyrillicfont}[Script=Cyrillic]{NotoSans-Regular.ttf}
33 \newfontfamily{\devanagarifont}[Script=Devanagari]{NotoSansDevanagari-Regular.ttf}
34 \newfontfamily{\deseretfont}[Script=Deseret]{NotoSansDeseret-Regular.ttf}
35 \newfontfamily{\ethiopicfont}[Script=Ethiopic]{NotoSansEthiopic-Regular.ttf}
36 \newfontfamily{\georgianfont}[Script=Georgian]{NotoSansGeorgian-Regular.ttf}
37 \newfontfamily{\glagoliticfont}[Script=Glagolitic]{NotoSansGlagolitic-Regular.ttf}
38 \newfontfamily{\gothicfont}[Script=Gothic]{NotoSansGothic-Regular.ttf}
39 \newfontfamily{\greekfont}[Script=Greek]{NotoSans-Regular.ttf}
40 \newfontfamily{\gujaratifont}[Script=Gujarati]{NotoSansGujarati-Regular.ttf}
41 \newfontfamily{\gurmukhifont}[Script=Gurmukhi]{NotoSansGurmukhi-Regular.ttf}
42 \newfontfamily{\hebrewfont}[Script=Hebrew]{NotoSansHebrew-Regular.ttf}
43 \newfontfamily{\kannadafont}[Script=Kannada]{NotoSansKannada-Regular.ttf}
44 \newfontfamily{\kayahlifont}[Script=Kayah Li]{NotoSansKayahLi-Regular.ttf}
45 \newfontfamily{\khmerfont}[Script=Khmer]{NotoSansKhmer-Regular.ttf}
46 \newfontfamily{\laofont}[Script=Lao]{NotoSansLao-Regular.ttf}
47 \newfontfamily{\latinfont}[Script=Latin]{NotoSans-Regular.ttf}
48 \newfontfamily{\lisufont}[Script=Lisu]{NotoSansLisu-Regular.ttf}
49 \newfontfamily{\malayalamfont}[Script=Malayalam]{NotoSansMalayalam-Regular.ttf}
50 \newfontfamily{\myanmarfont}[Script=Myanmar]{NotoSansMyanmar-Regular.ttf}
51 \newfontfamily{\nkofont}[Script=N'Ko]{NotoSansNKo-Regular.ttf}
52 \newfontfamily{\olchikifont}[Script=Ol Chiki]{NotoSansOlChiki-Regular.ttf}
53 \newfontfamily{\oldturkicfont}[Script=Old Turkic]{NotoSansOldTurkic-Regular.ttf}
54 \newfontfamily{\osagefont}[Script=Osage]{NotoSansOsage-Regular.ttf}
55 \newfontfamily{\osmanyafont}[Script=Osmanya]{NotoSansOsmanya-Regular.ttf}
56 \newfontfamily{\saurashtrafont}[Script=Saurashtra]{NotoSansSaurashtra-Regular.ttf}
57 \newfontfamily{\shavianfont}[Script=Shavian]{NotoSansShavian-Regular.ttf}
58 \newfontfamily{\sinhalafont}[Script=Sinhala]{NotoSansSinhala-Regular.ttf}
59 \newfontfamily{\sundanesefont}[Script=Sundanese]{NotoSansSundanese-Regular.ttf}
60 \newfontfamily{\taivietfont}[Script=Tai Viet]{NotoSansTaiViet-Regular.ttf}
61 \newfontfamily{\tamilfont}[Script=Tamil]{NotoSansTamil-Regular.ttf}
62 \newfontfamily{\telugufont}[Script=Telugu]{NotoSansTelugu-Regular.ttf}
63 \newfontfamily{\thaifont}[Script=Thai]{NotoSansThai-Regular.ttf}
64 \newfontfamily{\tifinaghfont}[Script=Tifinagh]{NotoSansTifinagh-Regular.ttf}
65 \newfontfamily{\vaifont}[Script=Vai]{NotoSansVai-Regular.ttf}
67 \usepackage{ucharclasses-patched}
69 \setTransitionTo{Adlam}{\begingroup\adlamfont}
70 \setTransitionFrom{Adlam}{\endgroup}
71 \setTransitionTo{Arabic}{\begingroup\arabicfont}
72 \setTransitionFrom{Arabic}{\endgroup}
73 \setTransitionTo{Armenian}{\begingroup\armenianfont}
74 \setTransitionFrom{Armenian}{\endgroup}
75 \setTransitionTo{Avestan}{\begingroup\avestanfont}
76 \setTransitionFrom{Avestan}{\endgroup}
77 \setTransitionTo{Bamum}{\begingroup\bamumfont}
78 \setTransitionFrom{Bamum}{\endgroup}
79 \setTransitionTo{Bengali}{\begingroup\bengalifont}
80 \setTransitionFrom{Bengali}{\endgroup}
81 \setTransitionTo{Buhid}{\begingroup\buhidfont}
82 \setTransitionFrom{Buhid}{\endgroup}
83 \setTransitionsForCanadianSyllabics{\begingroup\canadianfont}{\endgroup}
84 \setTransitionTo{Carian}{\begingroup\carianfont}
85 \setTransitionFrom{Carian}{\endgroup}
86 \setTransitionTo{Chakma}{\begingroup\chakmafont}
87 \setTransitionFrom{Chakma}{\endgroup}
88 \setTransitionsForCherokeeFull{\begingroup\cherokeefont}{\endgroup}
89 \setTransitionTo{Coptic}{\begingroup\copticfont}
90 \setTransitionFrom{Coptic}{\endgroup}
91 \setTransitionTo{CypriotSyllabary}{\begingroup\cypriotfont}
92 \setTransitionFrom{CypriotSyllabary}{\endgroup}
93 % no transition for Cyrillic font; we do that manually
94 \setTransitionTo{Deseret}{\begingroup\deseretfont}
95 \setTransitionFrom{Deseret}{\endgroup}
96 \setTransitionTo{Devanagari}{\begingroup\devanagarifont}
97 \setTransitionFrom{Devanagari}{\endgroup}
98 \setTransitionsForEthiopicFull{\begingroup\ethiopicfont}{\endgroup}
99 \setTransitionsForGeorgianFull{\begingroup\georgianfont}{\endgroup}
100 % in Noto, Glagolitic is not part of a Cyrillic font;
101 % we thus have to set up the ranges separately
102 \setTransitionTo{Glagolitic}{\begingroup\glagoliticfont}
103 \setTransitionFrom{Glagolitic}{\endgroup}
104 \setTransitionTo{GlagoliticSupplement}{\begingroup\glagoliticfont}
105 \setTransitionFrom{GlagoliticSupplement}{\endgroup}
106 \setTransitionTo{Gothic}{\begingroup\gothicfont}
107 \setTransitionFrom{Gothic}{\endgroup}
108 % no transition for Greek font; we do that manually
109 \setTransitionTo{Gujarati}{\begingroup\gujaratifont}
110 \setTransitionFrom{Gujarati}{\endgroup}
111 \setTransitionTo{Gurmukhi}{\begingroup\gurmukhifont}
112 \setTransitionFrom{Gurmukhi}{\endgroup}
113 \setTransitionTo{Hebrew}{\begingroup\hebrewfont}
114 \setTransitionFrom{Hebrew}{\endgroup}
115 \setTransitionTo{Kannada}{\begingroup\kannadafont}
116 \setTransitionFrom{Kannada}{\endgroup}
117 \setTransitionTo{KayahLi}{\begingroup\kayahlifont}
118 \setTransitionFrom{KayahLi}{\endgroup}
119 \setTransitionTo{Khmer}{\begingroup\khmerfont}
120 \setTransitionFrom{Khmer}{\endgroup}
121 \setTransitionTo{KhmerSymbols}{\begingroup\khmerfont}
122 \setTransitionFrom{KhmerSymbols}{\endgroup}
123 \setTransitionTo{Lao}{\begingroup\laofont}
124 \setTransitionFrom{Lao}{\endgroup}
125 % no transition for Latin font; we do that manually
126 \setTransitionTo{Lisu}{\begingroup\lisufont}
127 \setTransitionFrom{Lisu}{\endgroup}
128 \setTransitionTo{Malayalam}{\begingroup\malayalamfont}
129 \setTransitionFrom{Malayalam}{\endgroup}
130 \setTransitionsForMyanmarFull{\begingroup\myanmarfont}{\endgroup}
131 \setTransitionTo{NKo}{\begingroup\nkofont}
132 \setTransitionFrom{NKo}{\endgroup}
133 \setTransitionTo{OlChiki}{\begingroup\olchikifont}
134 \setTransitionFrom{OlChiki}{\endgroup}
135 \setTransitionTo{OldTurkic}{\begingroup\oldturkicfont}
136 \setTransitionFrom{OldTurkic}{\endgroup}
137 \setTransitionTo{Osage}{\begingroup\osagefont}
138 \setTransitionFrom{Osage}{\endgroup}
139 \setTransitionTo{Osmanya}{\begingroup\osmanyafont}
140 \setTransitionFrom{Osmanya}{\endgroup}
141 \setTransitionTo{Saurashtra}{\begingroup\saurashtrafont}
142 \setTransitionFrom{Saurashtra}{\endgroup}
143 \setTransitionTo{Shavian}{\begingroup\shavianfont}
144 \setTransitionFrom{Shavian}{\endgroup}
145 \setTransitionTo{Sinhala}{\begingroup\sinhalafont}
146 \setTransitionFrom{Sinhala}{\endgroup}
147 \setTransitionsForSundaneseFull{\begingroup\sundanesefont}{\endgroup}
148 \setTransitionTo{TaiViet}{\begingroup\taivietfont}
149 \setTransitionFrom{TaiViet}{\endgroup}
150 \setTransitionTo{Tamil}{\begingroup\tamilfont}
151 \setTransitionFrom{Tamil}{\endgroup}
152 \setTransitionTo{Telugu}{\begingroup\telugufont}
153 \setTransitionFrom{Telugu}{\endgroup}
154 \setTransitionTo{Thai}{\begingroup\thaifont}
155 \setTransitionFrom{Thai}{\endgroup}
156 \setTransitionTo{Tifinagh}{\begingroup\tifinaghfont}
157 \setTransitionFrom{Tifinagh}{\endgroup}
158 \setTransitionTo{Vai}{\begingroup\vaifont}
159 \setTransitionFrom{Vai}{\endgroup}
161 % the next commands are needed for manually switching fonts
162 \def\Cyrillic{\begingroup\cyrillicfont}
163 \def\cyrillic{\endgroup}
164 \def\Greek{\begingroup\greekfont}
165 \def\greek{\endgroup}
166 \def\Latin{\begingroup\latinfont}
167 \def\latin{\endgroup}
170 % Libertine Mono is too ugly; we use lmodern instead
171 \renewcommand{\ttfamily}{\fontfamily{lmtt}\selectfont}
173 \setkomafont{sectioning}{\normalfont\bfseries}
174 \setkomafont{descriptionlabel}{\normalfont}
175 \setkomafont{caption}{\normalfont\small}
177 $if(highlighting-macros)$
178 $highlighting-macros$
179 $endif$
181 $if(verbatim-in-note)$
182 \usepackage{fancyvrb}
183 $endif$
185 $if(fancy-enums)$
186 % Redefine labelwidth for lists; otherwise, the enumerate package will cause
187 % markers to extend beyond the left margin.
188 \makeatletter
190 \AtBeginDocument{%
191 \renewcommand{\@listi}
192 {\setlength{\labelwidth}{4em}}%
195 \makeatother
197 \usepackage{enumerate}
198 $endif$
200 $if(tables)$
201 % We use a patched version of longtable until a serious clash with
202 % floats get fixed.
203 \usepackage{longtable-patched}
204 \usepackage{booktabs}
206 % pandoc inserts \addlinespace after each line...
207 \defaultaddspace=1pt
209 % XXX The \addlinespace macro, as used in the LaTeX code generated by
210 % pandoc, overrides any vertical space adjustments for \toprule and friends,
211 % which is quite unfortunate. I consider this a bug in pandoc 1.12.2.1.
212 % It's not too difficult to fix this, but I had to redefine a lot of
213 % booktabs commands, which I don't want. Since the layout degradation is
214 % minor, I simply wait until it gets fixed in pandoc.
216 %\aboverulesep=0.3em
217 %\belowrulesep=0.3em
218 $endif$
220 $if(url)$
221 \usepackage{url}
222 $endif$
224 $if(graphics)$
225 \usepackage{graphicx}
227 % We will generate all images so they have a width 0.6\maxwidth. This means
228 % that they will get their normal width if they fit onto the page, but are
229 % scaled down if they would overflow this limit.
230 \makeatletter
232 \def\maxwidth{%
233 \ifdim\Gin@nat@width>\linewidth
234 \linewidth
235 \else
236 \Gin@nat@width
237 \fi}
239 \makeatother
241 \let\Oldincludegraphics\includegraphics
242 \renewcommand{\includegraphics}[1]{%
243 \Oldincludegraphics[width=0.6\maxwidth]{#1}}
244 $endif$
246 \ifxetex
247 \usepackage[setpagesize=false, % page size defined by xetex
248 unicode=false, % unicode breaks when used with xetex
249 xetex,
250 colorlinks=true,
251 linkcolor=blue]{hyperref}
252 \else
253 \usepackage[unicode=true,
254 colorlinks=true,
255 linkcolor=blue]{hyperref}
256 \usepackage{microtype}
257 % don't apply protrusion to \texttt
258 \UseMicrotypeSet[protrusion]{basicmath}
260 \hypersetup{breaklinks=true,
261 pdfauthor={$author-meta$},
262 pdftitle={$title-meta$},
263 pdfborder={0 0 0}}
265 % We want the names `section 2', `subsection 4.1', and the like in local
266 % links, omitting the original link text. To do that, we redefine
267 % \hyperref.
268 \makeatletter
270 % We transform
272 % \hyperref[foo]{bar}
274 % into
276 % bar (\autoref{foo})
278 \def\label@hyperref[#1]#2{%
279 #2 (\autoref{#1})}
281 % pandoc >= 1.15.2 uses \hyperlink instead.
283 \def\hyperlink#1#2{%
284 #2 (\autoref{#1})}
287 \makeatother
289 $if(subscript)$
290 \newcommand{\textsubscr}[1]{%
291 \ensuremath{_{\scriptsize\textrm{#1}}}}
292 $endif$
294 \setlength{\parindent}{0pt}
295 \setlength{\parskip}{6pt plus 2pt minus 1pt}
296 \setlength{\emergencystretch}{4em} % prevent overfull lines
297 \providecommand{\tightlist}{%
298 \setlength{\itemsep}{0pt}%
299 \setlength{\parskip}{0pt}}
301 % avoid float pages as much as possible
302 \renewcommand{\topfraction}{.99}
303 \renewcommand{\bottomfraction}{.99}
304 \setcounter{topnumber}{9}
305 \setcounter{bottomnumber}{9}
306 \renewcommand{\textfraction}{.1}
307 \renewcommand{\floatpagefraction}{.9}
309 % We want a break after the description label (if there is one).
310 \makeatletter
312 \let\original@item\@item
313 \def\description@item[#1]{%
314 \if@noparitem
315 \@donoparitem
316 \else
317 \if@inlabel
318 \indent \par
320 \ifhmode
321 \unskip\unskip \par
323 \if@newlist
324 \if@nobreak
325 \@nbitem
326 \else
327 \addpenalty\@beginparpenalty
328 \addvspace\@topsep
329 \addvspace{-\parskip}%
331 \else
332 \addpenalty\@itempenalty
333 \addvspace\itemsep
335 \global\@inlabeltrue
337 \everypar{%
338 \@minipagefalse
339 \global\@newlistfalse
340 \if@inlabel
341 \global\@inlabelfalse
342 {\setbox\z@\lastbox
343 \ifvoid\z@
344 \kern-\itemindent
345 \fi}%
346 \box\@labels
347 \penalty\z@
349 \if@nobreak
350 \@nobreakfalse
351 \clubpenalty \@M
352 \else
353 \clubpenalty \@clubpenalty
354 \everypar{}%
355 \fi}%
356 \if@noitemarg
357 \@noitemargfalse
358 \if@nmbrlist
359 \refstepcounter\@listctr
362 \sbox\@tempboxa{\makelabel{#1}}%
363 \global\setbox\@labels\hbox{%
364 \unhbox\@labels
365 \hskip \itemindent
366 \hskip -\labelwidth
367 \hskip -\labelsep
368 \ifdim \wd\@tempboxa >\labelwidth
369 \box\@tempboxa
370 \else
371 \hbox to\labelwidth {\unhbox\@tempboxa}%
373 \hskip \labelsep}%
374 \def\reserved@a{#1}%
375 \def\reserved@b{\@itemlabel}%
376 \ifx\reserved@a \reserved@b
377 \else
378 \leavevmode\\
380 \ignorespaces}
382 \renewenvironment{description}{%
383 \list{}{\labelwidth\z@ \itemindent-\leftmargin
384 \let\makelabel\descriptionlabel
385 \let\@item\description@item}%
387 \let\@item\original@item
388 \endlist
391 \makeatother
393 % we want block quotes formatted as italic
394 \renewenvironment{quote}{%
395 \list{}{\rightmargin\leftmargin}%
396 \item\relax
399 \endlist
404 $if(numbersections)$
405 \setcounter{secnumdepth}{5}
406 $else$
407 \setcounter{secnumdepth}{0}
408 $endif$
410 $if(verbatim-in-note)$
411 \VerbatimFootnotes % allows verbatim text in footnotes
412 $endif$
414 $if(lang)$
415 \ifxetex
416 \usepackage{polyglossia}
417 \setmainlanguage{$mainlang$}
418 \else
419 \usepackage[$lang$]{babel}
421 $endif$
423 $for(header-includes)$
424 $header-includes$
425 $endfor$
427 $if(title)$
428 \title{$title$}
429 $endif$
430 \author{$for(author)$$author$$sep$ \and $endfor$}
431 $if(version)$
432 \date{Version $version$}
433 $endif$
435 \begin{document}
436 $if(title)$
437 \maketitle
438 $endif$
440 $for(include-before)$
441 $include-before$
442 $endfor$
444 $if(toc)$
445 \tableofcontents
446 $endif$
448 $body$
450 $for(include-after)$
451 $include-after$
452 $endfor$
454 \end{document}