[doc] Update to display all glyphs in PDF.
[ttfautohint.git] / doc / template.tex
bloba7ce7d548ea73c7cacd9dc6eaeab098fe2193aa9
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, Mongolian, Myanmar,
4 % Sinhala, 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{libertine}
15 \ifxetex
16 % with newer releases of `fontspec', fonts should be defined before
17 % including `ucharclasses'
18 \newfontfamily{\adlamfont}[Script=Adlam]{NotoSansAdlam-Regular.ttf}
19 \newfontfamily{\arabicfont}[Script=Arabic]{NotoSansArabic-Regular.ttf}
20 \newfontfamily{\armenianfont}[Script=Armenian]{NotoSansArmenian-Regular.ttf}
21 \newfontfamily{\avestanfont}[Script=Avestan]{NotoSansAvestan-Regular.ttf}
22 \newfontfamily{\bamumfont}[Script=Bamum]{NotoSansBamum-Regular.ttf}
23 \newfontfamily{\bengalifont}[Script=Bengali]{NotoSansBengali-Regular.ttf}
24 \newfontfamily{\buhidfont}[Script=Buhid]{NotoSansBuhid-Regular.ttf}
25 \newfontfamily{\canadianfont}[Script=Canadian Syllabics]{NotoSansCanadianAboriginal-Regular.ttf}
26 \newfontfamily{\carianfont}[Script=Carian]{NotoSansCarian-Regular.ttf}
27 \newfontfamily{\chakmafont}[Script=Chakma]{NotoSansChakma-Regular.ttf}
28 \newfontfamily{\cherokeefont}[Script=Cherokee]{NotoSansCherokee-Regular.ttf}
29 \newfontfamily{\copticfont}[Script=Coptic]{NotoSansCoptic-Regular.ttf}
30 \newfontfamily{\cypriotfont}[Script=Cypriot Syllabary]{NotoSansCypriot-Regular.ttf}
31 \newfontfamily{\cyrillicfont}[Script=Cyrillic]{NotoSans-Regular.ttf}
32 \newfontfamily{\devanagarifont}[Script=Devanagari]{NotoSansDevanagari-Regular.ttf}
33 \newfontfamily{\deseretfont}[Script=Deseret]{NotoSansDeseret-Regular.ttf}
34 \newfontfamily{\ethiopicfont}[Script=Ethiopic]{NotoSansEthiopic-Regular.ttf}
35 \newfontfamily{\georgianfont}[Script=Georgian]{NotoSansGeorgian-Regular.ttf}
36 \newfontfamily{\glagoliticfont}[Script=Glagolitic]{NotoSansGlagolitic-Regular.ttf}
37 \newfontfamily{\gothicfont}[Script=Gothic]{NotoSansGothic-Regular.ttf}
38 \newfontfamily{\greekfont}[Script=Greek]{NotoSans-Regular.ttf}
39 \newfontfamily{\gujaratifont}[Script=Gujarati]{NotoSansGujarati-Regular.ttf}
40 \newfontfamily{\gurmukhifont}[Script=Gurmukhi]{NotoSansGurmukhi-Regular.ttf}
41 \newfontfamily{\hebrewfont}[Script=Hebrew]{NotoSansHebrew-Regular.ttf}
42 \newfontfamily{\kannadafont}[Script=Kannada]{NotoSansKannada-Regular.ttf}
43 \newfontfamily{\kayahlifont}[Script=Kayah Li]{NotoSansKayahLi-Regular.ttf}
44 \newfontfamily{\khmerfont}[Script=Khmer]{NotoSansKhmer-Regular.ttf}
45 \newfontfamily{\laofont}[Script=Lao]{NotoSansLao-Regular.ttf}
46 \newfontfamily{\latinfont}[Script=Latin]{NotoSans-Regular.ttf}
47 \newfontfamily{\lisufont}[Script=Lisu]{NotoSansLisu-Regular.ttf}
48 \newfontfamily{\malayalamfont}[Script=Malayalam]{NotoSansMalayalam-Regular.ttf}
49 \newfontfamily{\mongolianfont}[Script=Mongolian]{NotoSansMongolian-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}
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 \setTransitionsForDevanagari{\begingroup\devanagarifont}{\endgroup}
97 \setTransitionsForEthiopicFull{\begingroup\ethiopicfont}{\endgroup}
98 \setTransitionsForGeorgianFull{\begingroup\georgianfont}{\endgroup}
99 % in Noto, Glagolitic is not part of a Cyrillic font;
100 % we thus have to set up the ranges separately
101 \setTransitionTo{Glagolitic}{\begingroup\glagoliticfont}
102 \setTransitionFrom{Glagolitic}{\endgroup}
103 \setTransitionTo{GlagoliticSupplement}{\begingroup\glagoliticfont}
104 \setTransitionFrom{GlagoliticSupplement}{\endgroup}
105 \setTransitionTo{Gothic}{\begingroup\gothicfont}
106 \setTransitionFrom{Gothic}{\endgroup}
107 % no transition for Greek font; we do that manually
108 \setTransitionTo{Gujarati}{\begingroup\gujaratifont}
109 \setTransitionFrom{Gujarati}{\endgroup}
110 \setTransitionTo{Gurmukhi}{\begingroup\gurmukhifont}
111 \setTransitionFrom{Gurmukhi}{\endgroup}
112 \setTransitionTo{Hebrew}{\begingroup\hebrewfont}
113 \setTransitionFrom{Hebrew}{\endgroup}
114 \setTransitionTo{Kannada}{\begingroup\kannadafont}
115 \setTransitionFrom{Kannada}{\endgroup}
116 \setTransitionTo{KayahLi}{\begingroup\kayahlifont}
117 \setTransitionFrom{KayahLi}{\endgroup}
118 \setTransitionTo{Khmer}{\begingroup\khmerfont}
119 \setTransitionFrom{Khmer}{\endgroup}
120 \setTransitionTo{KhmerSymbols}{\begingroup\khmerfont}
121 \setTransitionFrom{KhmerSymbols}{\endgroup}
122 \setTransitionTo{Lao}{\begingroup\laofont}
123 \setTransitionFrom{Lao}{\endgroup}
124 % no transition for Latin font; we do that manually
125 \setTransitionTo{Lisu}{\begingroup\lisufont}
126 \setTransitionFrom{Lisu}{\endgroup}
127 \setTransitionTo{Malayalam}{\begingroup\malayalamfont}
128 \setTransitionFrom{Malayalam}{\endgroup}
129 % no transition for Mongolian font; we do that manually
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}
168 \def\Mongolian{\begingroup\mongolianfont}
169 \def\mongolian{\endgroup}
172 % Libertine Mono is too ugly; we use lmodern instead
173 \renewcommand{\ttfamily}{\fontfamily{lmtt}\selectfont}
175 \setkomafont{sectioning}{\normalfont\bfseries}
176 \setkomafont{descriptionlabel}{\normalfont}
177 \setkomafont{caption}{\normalfont\small}
179 $if(highlighting-macros)$
180 $highlighting-macros$
181 $endif$
183 $if(verbatim-in-note)$
184 \usepackage{fancyvrb}
185 $endif$
187 $if(fancy-enums)$
188 % Redefine labelwidth for lists; otherwise, the enumerate package will cause
189 % markers to extend beyond the left margin.
190 \makeatletter
192 \AtBeginDocument{%
193 \renewcommand{\@listi}
194 {\setlength{\labelwidth}{4em}}%
197 \makeatother
199 \usepackage{enumerate}
200 $endif$
202 $if(tables)$
203 % We use a patched version of longtable until a serious clash with
204 % floats get fixed.
205 \usepackage{longtable-patched}
206 \usepackage{booktabs}
208 % pandoc inserts \addlinespace after each line...
209 \defaultaddspace=1pt
211 % XXX The \addlinespace macro, as used in the LaTeX code generated by
212 % pandoc, overrides any vertical space adjustments for \toprule and friends,
213 % which is quite unfortunate. I consider this a bug in pandoc 1.12.2.1.
214 % It's not too difficult to fix this, but I had to redefine a lot of
215 % booktabs commands, which I don't want. Since the layout degradation is
216 % minor, I simply wait until it gets fixed in pandoc.
218 %\aboverulesep=0.3em
219 %\belowrulesep=0.3em
220 $endif$
222 $if(url)$
223 \usepackage{url}
224 $endif$
226 $if(graphics)$
227 \usepackage{graphicx}
229 % We will generate all images so they have a width 0.6\maxwidth. This means
230 % that they will get their normal width if they fit onto the page, but are
231 % scaled down if they would overflow this limit.
232 \makeatletter
234 \def\maxwidth{%
235 \ifdim\Gin@nat@width>\linewidth
236 \linewidth
237 \else
238 \Gin@nat@width
239 \fi}
241 \makeatother
243 \let\Oldincludegraphics\includegraphics
244 \renewcommand{\includegraphics}[1]{%
245 \Oldincludegraphics[width=0.6\maxwidth]{#1}}
246 $endif$
248 \ifxetex
249 \usepackage[setpagesize=false, % page size defined by xetex
250 unicode=false, % unicode breaks when used with xetex
251 xetex,
252 colorlinks=true,
253 linkcolor=blue]{hyperref}
254 \else
255 \usepackage[unicode=true,
256 colorlinks=true,
257 linkcolor=blue]{hyperref}
258 \usepackage{microtype}
259 % don't apply protrusion to \texttt
260 \UseMicrotypeSet[protrusion]{basicmath}
262 \hypersetup{breaklinks=true,
263 pdfauthor={$author-meta$},
264 pdftitle={$title-meta$},
265 pdfborder={0 0 0}}
267 % We want the names `section 2', `subsection 4.1', and the like in local
268 % links, omitting the original link text. To do that, we redefine
269 % \hyperref.
270 \makeatletter
272 % We transform
274 % \hyperref[foo]{bar}
276 % into
278 % bar (\autoref{foo})
280 \def\label@hyperref[#1]#2{%
281 #2 (\autoref{#1})}
283 % pandoc >= 1.15.2 uses \hyperlink instead.
285 \def\hyperlink#1#2{%
286 #2 (\autoref{#1})}
289 \makeatother
291 $if(subscript)$
292 \newcommand{\textsubscr}[1]{%
293 \ensuremath{_{\scriptsize\textrm{#1}}}}
294 $endif$
296 \setlength{\parindent}{0pt}
297 \setlength{\parskip}{6pt plus 2pt minus 1pt}
298 \setlength{\emergencystretch}{4em} % prevent overfull lines
299 \providecommand{\tightlist}{%
300 \setlength{\itemsep}{0pt}%
301 \setlength{\parskip}{0pt}}
303 % avoid float pages as much as possible
304 \renewcommand{\topfraction}{.99}
305 \renewcommand{\bottomfraction}{.99}
306 \setcounter{topnumber}{9}
307 \setcounter{bottomnumber}{9}
308 \renewcommand{\textfraction}{.1}
309 \renewcommand{\floatpagefraction}{.9}
311 % We want a break after the description label (if there is one).
312 \makeatletter
314 \let\original@item\@item
315 \def\description@item[#1]{%
316 \if@noparitem
317 \@donoparitem
318 \else
319 \if@inlabel
320 \indent \par
322 \ifhmode
323 \unskip\unskip \par
325 \if@newlist
326 \if@nobreak
327 \@nbitem
328 \else
329 \addpenalty\@beginparpenalty
330 \addvspace\@topsep
331 \addvspace{-\parskip}%
333 \else
334 \addpenalty\@itempenalty
335 \addvspace\itemsep
337 \global\@inlabeltrue
339 \everypar{%
340 \@minipagefalse
341 \global\@newlistfalse
342 \if@inlabel
343 \global\@inlabelfalse
344 {\setbox\z@\lastbox
345 \ifvoid\z@
346 \kern-\itemindent
347 \fi}%
348 \box\@labels
349 \penalty\z@
351 \if@nobreak
352 \@nobreakfalse
353 \clubpenalty \@M
354 \else
355 \clubpenalty \@clubpenalty
356 \everypar{}%
357 \fi}%
358 \if@noitemarg
359 \@noitemargfalse
360 \if@nmbrlist
361 \refstepcounter\@listctr
364 \sbox\@tempboxa{\makelabel{#1}}%
365 \global\setbox\@labels\hbox{%
366 \unhbox\@labels
367 \hskip \itemindent
368 \hskip -\labelwidth
369 \hskip -\labelsep
370 \ifdim \wd\@tempboxa >\labelwidth
371 \box\@tempboxa
372 \else
373 \hbox to\labelwidth {\unhbox\@tempboxa}%
375 \hskip \labelsep}%
376 \def\reserved@a{#1}%
377 \def\reserved@b{\@itemlabel}%
378 \ifx\reserved@a \reserved@b
379 \else
380 \leavevmode\\
382 \ignorespaces}
384 \renewenvironment{description}{%
385 \list{}{\labelwidth\z@ \itemindent-\leftmargin
386 \let\makelabel\descriptionlabel
387 \let\@item\description@item}%
389 \let\@item\original@item
390 \endlist
393 \makeatother
395 % we want block quotes formatted as italic
396 \renewenvironment{quote}{%
397 \list{}{\rightmargin\leftmargin}%
398 \item\relax
401 \endlist
406 $if(numbersections)$
407 \setcounter{secnumdepth}{5}
408 $else$
409 \setcounter{secnumdepth}{0}
410 $endif$
412 $if(verbatim-in-note)$
413 \VerbatimFootnotes % allows verbatim text in footnotes
414 $endif$
416 $if(lang)$
417 \ifxetex
418 \usepackage{polyglossia}
419 \setmainlanguage{$mainlang$}
420 \else
421 \usepackage[$lang$]{babel}
423 $endif$
425 $for(header-includes)$
426 $header-includes$
427 $endfor$
429 $if(title)$
430 \title{$title$}
431 $endif$
432 \author{$for(author)$$author$$sep$ \and $endfor$}
433 $if(version)$
434 \date{Version $version$}
435 $endif$
437 \begin{document}
438 $if(title)$
439 \maketitle
440 $endif$
442 $for(include-before)$
443 $include-before$
444 $endfor$
446 $if(toc)$
447 \tableofcontents
448 $endif$
450 $body$
452 $for(include-after)$
453 $include-after$
454 $endfor$
456 \end{document}