s/--components/--composites/, s/hint-with-components/hint-composites/.
[ttfautohint.git] / doc / template.tex
blob3f5eb5072ffae2b1ccfbd65d925c9290e234e5d9
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...
12 \renewcommand{\ttfamily}{\fontfamily{cmtt}\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{ctable}
43 \usepackage{float} % provides the H option for float placement
45 % pandoc uses \medskip between table rows which looks ugly
46 \setupctable{%
47 doinside={\let\medskip\relax}}
48 $endif$
50 $if(url)$
51 \usepackage{url}
52 $endif$
54 $if(graphics)$
55 \usepackage{graphicx}
57 % We will generate all images so they have a width 0.6\maxwidth. This means
58 % that they will get their normal width if they fit onto the page, but are
59 % scaled down if they would overflow this limit.
60 \makeatletter
62 \def\maxwidth{%
63 \ifdim\Gin@nat@width>\linewidth
64 \linewidth
65 \else
66 \Gin@nat@width
67 \fi}
69 \makeatother
71 \let\Oldincludegraphics\includegraphics
72 \renewcommand{\includegraphics}[1]{%
73 \Oldincludegraphics[width=0.6\maxwidth]{#1}}
74 $endif$
76 \ifxetex
77 \usepackage[setpagesize=false, % page size defined by xetex
78 unicode=false, % unicode breaks when used with xetex
79 xetex,
80 colorlinks=true,
81 linkcolor=blue]{hyperref}
82 \else
83 \usepackage[unicode=true,
84 colorlinks=true,
85 linkcolor=blue]{hyperref}
86 \usepackage{microtype}
87 \fi
88 \hypersetup{breaklinks=true, pdfborder={0 0 0}}
90 % We want the names `section 2', `subsection 4.1', and the like in local
91 % links, omitting the original link text. To do that, we redefine \href.
92 \makeatletter
94 \let\original@href\href
96 % Here is the new \href wrapper. We check whether the first token is \#.
97 % If yes, we call \autoref, otherwise the original \href macro. \@nil is a
98 % delimiter token which we need, because we call the arguments in
99 % \modified@href without braces so that we can split off the first token.
100 \def\href#1{%
101 \modified@href #1\@nil}
103 % Using \expandafter makes TeX finish the \if clause before one of the
104 % \almost@xxx macros picks up the arguments.
105 \def\modified@href#1#2\@nil{%
106 \ifx #1\#%
107 \expandafter\almost@autoref
108 \else
109 \expandafter\almost@original@href
111 {#1}{#2}}
113 % We normalize \_ in the reference (argument #2), which we put into
114 % parentheses after the label (argument #3). Argument #1 holds \# which we
115 % skip.
116 \def\almost@autoref#1#2#3{%
117 #3 (\hyper@normalise\autoref{#2})}
119 % For a non-local link, unify the split off first character with the
120 % remaining part of the link.
121 \def\almost@original@href#1#2{%
122 \original@href{#1#2}}
124 \makeatother
126 $if(subscript)$
127 \newcommand{\textsubscr}[1]{%
128 \ensuremath{_{\scriptsize\textrm{#1}}}}
129 $endif$
131 \setlength{\parindent}{0pt}
132 \setlength{\parskip}{6pt plus 2pt minus 1pt}
133 \setlength{\emergencystretch}{3em} % prevent overfull lines
135 % We want a break after the description label (if there is one).
136 \makeatletter
138 \let\original@item\@item
139 \def\description@item[#1]{%
140 \if@noparitem
141 \@donoparitem
142 \else
143 \if@inlabel
144 \indent \par
146 \ifhmode
147 \unskip\unskip \par
149 \if@newlist
150 \if@nobreak
151 \@nbitem
152 \else
153 \addpenalty\@beginparpenalty
154 \addvspace\@topsep
155 \addvspace{-\parskip}%
157 \else
158 \addpenalty\@itempenalty
159 \addvspace\itemsep
161 \global\@inlabeltrue
163 \everypar{%
164 \@minipagefalse
165 \global\@newlistfalse
166 \if@inlabel
167 \global\@inlabelfalse
168 {\setbox\z@\lastbox
169 \ifvoid\z@
170 \kern-\itemindent
171 \fi}%
172 \box\@labels
173 \penalty\z@
175 \if@nobreak
176 \@nobreakfalse
177 \clubpenalty \@M
178 \else
179 \clubpenalty \@clubpenalty
180 \everypar{}%
181 \fi}%
182 \if@noitemarg
183 \@noitemargfalse
184 \if@nmbrlist
185 \refstepcounter\@listctr
188 \sbox\@tempboxa{\makelabel{#1}}%
189 \global\setbox\@labels\hbox{%
190 \unhbox\@labels
191 \hskip \itemindent
192 \hskip -\labelwidth
193 \hskip -\labelsep
194 \ifdim \wd\@tempboxa >\labelwidth
195 \box\@tempboxa
196 \else
197 \hbox to\labelwidth {\unhbox\@tempboxa}%
199 \hskip \labelsep}%
200 \def\reserved@a{#1}%
201 \def\reserved@b{\@itemlabel}%
202 \ifx\reserved@a \reserved@b
203 \else
204 \leavevmode\\
206 \ignorespaces}
208 \renewenvironment{description}{%
209 \list{}{\labelwidth\z@ \itemindent-\leftmargin
210 \let\makelabel\descriptionlabel
211 \let\@item\description@item}%
213 \let\@item\original@item
214 \endlist
217 \makeatother
219 % we want block quotes formatted as italic
220 \renewenvironment{quote}{%
221 \list{}{\rightmargin\leftmargin}%
222 \item\relax
223 \itshape
225 \endlist
230 $if(numbersections)$
231 $else$
232 \setcounter{secnumdepth}{0}
233 $endif$
235 $if(verbatim-in-note)$
236 \VerbatimFootnotes % allows verbatim text in footnotes
237 $endif$
239 $if(lang)$
240 \ifxetex
241 \usepackage{polyglossia}
242 \setmainlanguage{$mainlang$}
243 \else
244 \usepackage[$lang$]{babel}
246 $endif$
248 $for(header-includes)$
249 $header-includes$
250 $endfor$
252 $if(title)$
253 \title{$title$}
254 $endif$
255 \author{$for(author)$$author$$sep$ \and $endfor$}
256 $if(version)$
257 \date{Version $version$}
258 $endif$
260 \begin{document}
261 $if(title)$
262 \maketitle
263 $endif$
265 $for(include-before)$
266 $include-before$
267 $endfor$
269 $if(toc)$
270 \tableofcontents
271 $endif$
273 $body$
275 $for(include-after)$
276 $include-after$
277 $endfor$
279 \end{document}