Distribute `ttfautohint-scripts.h' and `ttfautohint-coverages.h' also.
[ttfautohint.git] / doc / template.tex
blobc8cf07181d616709bb5b197afe0dadab60d70dcd
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{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{\myanmarfont}[Script=Myanmar]{NotoSansMyanmar-Regular.ttf}
50 \newfontfamily{\nkofont}[Script=N'Ko]{NotoSansNKo-Regular.ttf}
51 \newfontfamily{\olchikifont}[Script=Ol Chiki]{NotoSansOlChiki-Regular.ttf}
52 \newfontfamily{\oldturkicfont}[Script=Old Turkic]{NotoSansOldTurkic-Regular.ttf}
53 \newfontfamily{\osagefont}[Script=Osage]{NotoSansOsage-Regular.ttf}
54 \newfontfamily{\osmanyafont}[Script=Osmanya]{NotoSansOsmanya-Regular.ttf}
55 \newfontfamily{\saurashtrafont}[Script=Saurashtra]{NotoSansSaurashtra-Regular.ttf}
56 \newfontfamily{\shavianfont}[Script=Shavian]{NotoSansShavian-Regular.ttf}
57 \newfontfamily{\sinhalafont}[Script=Sinhala]{NotoSansSinhala-Regular.ttf}
58 \newfontfamily{\sundanesefont}[Script=Sundanese]{NotoSansSundanese-Regular.ttf}
59 \newfontfamily{\taivietfont}[Script=Tai Viet]{NotoSansTaiViet-Regular.ttf}
60 \newfontfamily{\tamilfont}[Script=Tamil]{NotoSansTamil-Regular.ttf}
61 \newfontfamily{\telugufont}[Script=Telugu]{NotoSansTelugu-Regular.ttf}
62 \newfontfamily{\thaifont}[Script=Thai]{NotoSansThai-Regular.ttf}
63 \newfontfamily{\tifinaghfont}[Script=Tifinagh]{NotoSansTifinagh-Regular.ttf}
64 \newfontfamily{\vaifont}[Script=Vai]{NotoSansVai-Regular.ttf}
66 \usepackage{ucharclasses}
68 \setTransitionTo{Adlam}{\begingroup\adlamfont}
69 \setTransitionFrom{Adlam}{\endgroup}
70 \setTransitionTo{Arabic}{\begingroup\arabicfont}
71 \setTransitionFrom{Arabic}{\endgroup}
72 \setTransitionTo{Armenian}{\begingroup\armenianfont}
73 \setTransitionFrom{Armenian}{\endgroup}
74 \setTransitionTo{Avestan}{\begingroup\avestanfont}
75 \setTransitionFrom{Avestan}{\endgroup}
76 \setTransitionTo{Bamum}{\begingroup\bamumfont}
77 \setTransitionFrom{Bamum}{\endgroup}
78 \setTransitionTo{Bengali}{\begingroup\bengalifont}
79 \setTransitionFrom{Bengali}{\endgroup}
80 \setTransitionTo{Buhid}{\begingroup\buhidfont}
81 \setTransitionFrom{Buhid}{\endgroup}
82 \setTransitionsForCanadianSyllabics{\begingroup\canadianfont}{\endgroup}
83 \setTransitionTo{Carian}{\begingroup\carianfont}
84 \setTransitionFrom{Carian}{\endgroup}
85 \setTransitionTo{Chakma}{\begingroup\chakmafont}
86 \setTransitionFrom{Chakma}{\endgroup}
87 \setTransitionsForCherokeeFull{\begingroup\cherokeefont}{\endgroup}
88 \setTransitionTo{Coptic}{\begingroup\copticfont}
89 \setTransitionFrom{Coptic}{\endgroup}
90 \setTransitionTo{CypriotSyllabary}{\begingroup\cypriotfont}
91 \setTransitionFrom{CypriotSyllabary}{\endgroup}
92 % no transition for Cyrillic font; we do that manually
93 \setTransitionTo{Deseret}{\begingroup\deseretfont}
94 \setTransitionFrom{Deseret}{\endgroup}
95 \setTransitionTo{Devanagari}{\begingroup\devanagarifont}
96 \setTransitionFrom{Devanagari}{\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 \setTransitionsForMyanmarFull{\begingroup\myanmarfont}{\endgroup}
130 \setTransitionTo{NKo}{\begingroup\nkofont}
131 \setTransitionFrom{NKo}{\endgroup}
132 \setTransitionTo{OlChiki}{\begingroup\olchikifont}
133 \setTransitionFrom{OlChiki}{\endgroup}
134 \setTransitionTo{OldTurkic}{\begingroup\oldturkicfont}
135 \setTransitionFrom{OldTurkic}{\endgroup}
136 \setTransitionTo{Osage}{\begingroup\osagefont}
137 \setTransitionFrom{Osage}{\endgroup}
138 \setTransitionTo{Osmanya}{\begingroup\osmanyafont}
139 \setTransitionFrom{Osmanya}{\endgroup}
140 \setTransitionTo{Saurashtra}{\begingroup\saurashtrafont}
141 \setTransitionFrom{Saurashtra}{\endgroup}
142 \setTransitionTo{Shavian}{\begingroup\shavianfont}
143 \setTransitionFrom{Shavian}{\endgroup}
144 \setTransitionTo{Sinhala}{\begingroup\sinhalafont}
145 \setTransitionFrom{Sinhala}{\endgroup}
146 \setTransitionsForSundaneseFull{\begingroup\sundanesefont}{\endgroup}
147 \setTransitionTo{TaiViet}{\begingroup\taivietfont}
148 \setTransitionFrom{TaiViet}{\endgroup}
149 \setTransitionTo{Tamil}{\begingroup\tamilfont}
150 \setTransitionFrom{Tamil}{\endgroup}
151 \setTransitionTo{Telugu}{\begingroup\telugufont}
152 \setTransitionFrom{Telugu}{\endgroup}
153 \setTransitionTo{Thai}{\begingroup\thaifont}
154 \setTransitionFrom{Thai}{\endgroup}
155 \setTransitionTo{Tifinagh}{\begingroup\tifinaghfont}
156 \setTransitionFrom{Tifinagh}{\endgroup}
157 \setTransitionTo{Vai}{\begingroup\vaifont}
158 \setTransitionFrom{Vai}{\endgroup}
160 % the next commands are needed for manually switching fonts
161 \def\Cyrillic{\begingroup\cyrillicfont}
162 \def\cyrillic{\endgroup}
163 \def\Greek{\begingroup\greekfont}
164 \def\greek{\endgroup}
165 \def\Latin{\begingroup\latinfont}
166 \def\latin{\endgroup}
169 % Libertine Mono is too ugly; we use lmodern instead
170 \renewcommand{\ttfamily}{\fontfamily{lmtt}\selectfont}
172 \setkomafont{sectioning}{\normalfont\bfseries}
173 \setkomafont{descriptionlabel}{\normalfont}
174 \setkomafont{caption}{\normalfont\small}
176 $if(highlighting-macros)$
177 $highlighting-macros$
178 $endif$
180 $if(verbatim-in-note)$
181 \usepackage{fancyvrb}
182 $endif$
184 $if(fancy-enums)$
185 % Redefine labelwidth for lists; otherwise, the enumerate package will cause
186 % markers to extend beyond the left margin.
187 \makeatletter
189 \AtBeginDocument{%
190 \renewcommand{\@listi}
191 {\setlength{\labelwidth}{4em}}%
194 \makeatother
196 \usepackage{enumerate}
197 $endif$
199 $if(tables)$
200 % We use a patched version of longtable until a serious clash with
201 % floats get fixed.
202 \usepackage{longtable-patched}
203 \usepackage{booktabs}
205 % pandoc inserts \addlinespace after each line...
206 \defaultaddspace=1pt
208 % XXX The \addlinespace macro, as used in the LaTeX code generated by
209 % pandoc, overrides any vertical space adjustments for \toprule and friends,
210 % which is quite unfortunate. I consider this a bug in pandoc 1.12.2.1.
211 % It's not too difficult to fix this, but I had to redefine a lot of
212 % booktabs commands, which I don't want. Since the layout degradation is
213 % minor, I simply wait until it gets fixed in pandoc.
215 %\aboverulesep=0.3em
216 %\belowrulesep=0.3em
217 $endif$
219 $if(url)$
220 \usepackage{url}
221 $endif$
223 $if(graphics)$
224 \usepackage{graphicx}
226 % We will generate all images so they have a width 0.6\maxwidth. This means
227 % that they will get their normal width if they fit onto the page, but are
228 % scaled down if they would overflow this limit.
229 \makeatletter
231 \def\maxwidth{%
232 \ifdim\Gin@nat@width>\linewidth
233 \linewidth
234 \else
235 \Gin@nat@width
236 \fi}
238 \makeatother
240 \let\Oldincludegraphics\includegraphics
241 \renewcommand{\includegraphics}[1]{%
242 \Oldincludegraphics[width=0.6\maxwidth]{#1}}
243 $endif$
245 \ifxetex
246 \usepackage[setpagesize=false, % page size defined by xetex
247 unicode=false, % unicode breaks when used with xetex
248 xetex,
249 colorlinks=true,
250 linkcolor=blue]{hyperref}
251 \else
252 \usepackage[unicode=true,
253 colorlinks=true,
254 linkcolor=blue]{hyperref}
255 \usepackage{microtype}
256 % don't apply protrusion to \texttt
257 \UseMicrotypeSet[protrusion]{basicmath}
259 \hypersetup{breaklinks=true,
260 pdfauthor={$author-meta$},
261 pdftitle={$title-meta$},
262 pdfborder={0 0 0}}
264 % We want the names `section 2', `subsection 4.1', and the like in local
265 % links, omitting the original link text. To do that, we redefine
266 % \hyperref.
267 \makeatletter
269 % We transform
271 % \hyperref[foo]{bar}
273 % into
275 % bar (\autoref{foo})
277 \def\label@hyperref[#1]#2{%
278 #2 (\autoref{#1})}
280 % pandoc >= 1.15.2 uses \hyperlink instead.
282 \def\hyperlink#1#2{%
283 #2 (\autoref{#1})}
286 \makeatother
288 $if(subscript)$
289 \newcommand{\textsubscr}[1]{%
290 \ensuremath{_{\scriptsize\textrm{#1}}}}
291 $endif$
293 \setlength{\parindent}{0pt}
294 \setlength{\parskip}{6pt plus 2pt minus 1pt}
295 \setlength{\emergencystretch}{4em} % prevent overfull lines
296 \providecommand{\tightlist}{%
297 \setlength{\itemsep}{0pt}%
298 \setlength{\parskip}{0pt}}
300 % avoid float pages as much as possible
301 \renewcommand{\topfraction}{.99}
302 \renewcommand{\bottomfraction}{.99}
303 \setcounter{topnumber}{9}
304 \setcounter{bottomnumber}{9}
305 \renewcommand{\textfraction}{.1}
306 \renewcommand{\floatpagefraction}{.9}
308 % We want a break after the description label (if there is one).
309 \makeatletter
311 \let\original@item\@item
312 \def\description@item[#1]{%
313 \if@noparitem
314 \@donoparitem
315 \else
316 \if@inlabel
317 \indent \par
319 \ifhmode
320 \unskip\unskip \par
322 \if@newlist
323 \if@nobreak
324 \@nbitem
325 \else
326 \addpenalty\@beginparpenalty
327 \addvspace\@topsep
328 \addvspace{-\parskip}%
330 \else
331 \addpenalty\@itempenalty
332 \addvspace\itemsep
334 \global\@inlabeltrue
336 \everypar{%
337 \@minipagefalse
338 \global\@newlistfalse
339 \if@inlabel
340 \global\@inlabelfalse
341 {\setbox\z@\lastbox
342 \ifvoid\z@
343 \kern-\itemindent
344 \fi}%
345 \box\@labels
346 \penalty\z@
348 \if@nobreak
349 \@nobreakfalse
350 \clubpenalty \@M
351 \else
352 \clubpenalty \@clubpenalty
353 \everypar{}%
354 \fi}%
355 \if@noitemarg
356 \@noitemargfalse
357 \if@nmbrlist
358 \refstepcounter\@listctr
361 \sbox\@tempboxa{\makelabel{#1}}%
362 \global\setbox\@labels\hbox{%
363 \unhbox\@labels
364 \hskip \itemindent
365 \hskip -\labelwidth
366 \hskip -\labelsep
367 \ifdim \wd\@tempboxa >\labelwidth
368 \box\@tempboxa
369 \else
370 \hbox to\labelwidth {\unhbox\@tempboxa}%
372 \hskip \labelsep}%
373 \def\reserved@a{#1}%
374 \def\reserved@b{\@itemlabel}%
375 \ifx\reserved@a \reserved@b
376 \else
377 \leavevmode\\
379 \ignorespaces}
381 \renewenvironment{description}{%
382 \list{}{\labelwidth\z@ \itemindent-\leftmargin
383 \let\makelabel\descriptionlabel
384 \let\@item\description@item}%
386 \let\@item\original@item
387 \endlist
390 \makeatother
392 % we want block quotes formatted as italic
393 \renewenvironment{quote}{%
394 \list{}{\rightmargin\leftmargin}%
395 \item\relax
398 \endlist
403 $if(numbersections)$
404 \setcounter{secnumdepth}{5}
405 $else$
406 \setcounter{secnumdepth}{0}
407 $endif$
409 $if(verbatim-in-note)$
410 \VerbatimFootnotes % allows verbatim text in footnotes
411 $endif$
413 $if(lang)$
414 \ifxetex
415 \usepackage{polyglossia}
416 \setmainlanguage{$mainlang$}
417 \else
418 \usepackage[$lang$]{babel}
420 $endif$
422 $for(header-includes)$
423 $header-includes$
424 $endfor$
426 $if(title)$
427 \title{$title$}
428 $endif$
429 \author{$for(author)$$author$$sep$ \and $endfor$}
430 $if(version)$
431 \date{Version $version$}
432 $endif$
434 \begin{document}
435 $if(title)$
436 \maketitle
437 $endif$
439 $for(include-before)$
440 $include-before$
441 $endfor$
443 $if(toc)$
444 \tableofcontents
445 $endif$
447 $body$
449 $for(include-after)$
450 $include-after$
451 $endfor$
453 \end{document}