Typo.
[ttfautohint.git] / doc / template.tex
blobf6a39f48a54e2dc2cd036a5b4a4b1daaae3c7c1a
1 \documentclass[$if(fontsize)$$fontsize$,$endif$
2 $if(lang)$$lang$,$endif$]{scrartcl}
4 \usepackage{ifxetex,ifluatex}
5 \usepackage[T1]{fontenc}
6 \usepackage[utf8]{inputenc}
7 \usepackage{fixltx2e}
8 \usepackage{libertine}
10 \setkomafont{sectioning}{\normalfont\bfseries}
11 \setkomafont{descriptionlabel}{\normalfont}
12 \setkomafont{caption}{\normalfont\small}
14 $if(highlighting-macros)$
15 $highlighting-macros$
16 $endif$
18 $if(verbatim-in-note)$
19 \usepackage{fancyvrb}
20 $endif$
22 $if(fancy-enums)$
23 % Redefine labelwidth for lists; otherwise, the enumerate package will cause
24 % markers to extend beyond the left margin.
25 \makeatletter
27 \AtBeginDocument{%
28 \renewcommand{\@listi}
29 {\setlength{\labelwidth}{4em}}%
32 \makeatother
34 \usepackage{enumerate}
35 $endif$
37 $if(tables)$
38 \usepackage{ctable}
39 \usepackage{float} % provides the H option for float placement
41 % pandoc uses \medskip between table rows which looks ugly
42 \setupctable{%
43 doinside={\let\medskip\relax}}
44 $endif$
46 $if(url)$
47 \usepackage{url}
48 $endif$
50 $if(graphics)$
51 \usepackage{graphicx}
53 % We will generate all images so they have a width 0.6\maxwidth. This means
54 % that they will get their normal width if they fit onto the page, but are
55 % scaled down if they would overflow this limit.
56 \makeatletter
58 \def\maxwidth{%
59 \ifdim\Gin@nat@width>\linewidth
60 \linewidth
61 \else
62 \Gin@nat@width
63 \fi}
65 \makeatother
67 \let\Oldincludegraphics\includegraphics
68 \renewcommand{\includegraphics}[1]{%
69 \Oldincludegraphics[width=0.6\maxwidth]{#1}}
70 $endif$
72 \ifxetex
73 \usepackage[setpagesize=false, % page size defined by xetex
74 unicode=false, % unicode breaks when used with xetex
75 xetex,
76 colorlinks=true,
77 linkcolor=blue]{hyperref}
78 \else
79 \usepackage[unicode=true,
80 colorlinks=true,
81 linkcolor=blue]{hyperref}
82 \fi
83 \hypersetup{breaklinks=true, pdfborder={0 0 0}}
85 % We want the names `section 2', `subsection 4.1', and the like in local
86 % links, omitting the original link text. To do that, we redefine \href.
87 \makeatletter
89 \let\original@href\href
91 % Here is the new \href wrapper. We check whether the first token is \#.
92 % If yes, we call \autoref, otherwise the original \href macro. \@nil is a
93 % delimiter token which we need, because we call the arguments in
94 % \modified@href without braces so that we can split off the first token.
95 \def\href#1{%
96 \modified@href #1\@nil}
98 % Using \expandafter makes TeX finish the \if clause before one of the
99 % \almost@xxx macros picks up the arguments.
100 \def\modified@href#1#2\@nil{%
101 \ifx #1\#%
102 \expandafter\almost@autoref
103 \else
104 \expandafter\almost@original@href
106 {#1}{#2}}
108 % We normalize \_ in the reference (argument #2), which we put into
109 % parentheses after the label (argument #3). Argument #1 holds \# which we
110 % skip.
111 \def\almost@autoref#1#2#3{%
112 #3 (\hyper@normalise\autoref{#2})}
114 % For a non-local link, unify the split off first character with the
115 % remaining part of the link.
116 \def\almost@original@href#1#2{%
117 \original@href{#1#2}}
119 \makeatother
121 $if(subscript)$
122 \newcommand{\textsubscr}[1]{%
123 \ensuremath{_{\scriptsize\textrm{#1}}}}
124 $endif$
126 \setlength{\parindent}{0pt}
127 \setlength{\parskip}{6pt plus 2pt minus 1pt}
128 \setlength{\emergencystretch}{3em} % prevent overfull lines
130 % We want a break after the description label. Alas, it is necessary to
131 % copy the whole definition of \@item and the `description' environemnt just
132 % to insert `\\'...
133 \makeatletter
135 \let\original@item\@item
136 \def\description@item[#1]{%
137 \if@noparitem
138 \@donoparitem
139 \else
140 \if@inlabel
141 \indent \par
143 \ifhmode
144 \unskip\unskip \par
146 \if@newlist
147 \if@nobreak
148 \@nbitem
149 \else
150 \addpenalty\@beginparpenalty
151 \addvspace\@topsep
152 \addvspace{-\parskip}%
154 \else
155 \addpenalty\@itempenalty
156 \addvspace\itemsep
158 \global\@inlabeltrue
160 \everypar{%
161 \@minipagefalse
162 \global\@newlistfalse
163 \if@inlabel
164 \global\@inlabelfalse
165 {\setbox\z@\lastbox
166 \ifvoid\z@
167 \kern-\itemindent
168 \fi}%
169 \box\@labels
170 \penalty\z@
172 \if@nobreak
173 \@nobreakfalse
174 \clubpenalty \@M
175 \else
176 \clubpenalty \@clubpenalty
177 \everypar{}%
178 \fi}%
179 \if@noitemarg
180 \@noitemargfalse
181 \if@nmbrlist
182 \refstepcounter\@listctr
185 \sbox\@tempboxa{\makelabel{#1}}%
186 \global\setbox\@labels\hbox{%
187 \unhbox\@labels
188 \hskip \itemindent
189 \hskip -\labelwidth
190 \hskip -\labelsep
191 \ifdim \wd\@tempboxa >\labelwidth
192 \box\@tempboxa
193 \else
194 \hbox to\labelwidth {\unhbox\@tempboxa}%
195 \fi}%
196 \leavevmode\\
197 \ignorespaces}
199 \renewenvironment{description}{%
200 \list{}{\labelwidth\z@ \itemindent-\leftmargin
201 \let\makelabel\descriptionlabel
202 \let\@item\description@item}%
204 \let\@item\original@item
205 \endlist
208 \makeatother
210 % we want block quotes formatted as italic
211 \renewenvironment{quote}{%
212 \list{}{\rightmargin\leftmargin}%
213 \item\relax
214 \itshape
216 \endlist
221 $if(numbersections)$
222 $else$
223 \setcounter{secnumdepth}{0}
224 $endif$
226 $if(verbatim-in-note)$
227 \VerbatimFootnotes % allows verbatim text in footnotes
228 $endif$
230 $if(lang)$
231 \ifxetex
232 \usepackage{polyglossia}
233 \setmainlanguage{$mainlang$}
234 \else
235 \usepackage[$lang$]{babel}
237 $endif$
239 $for(header-includes)$
240 $header-includes$
241 $endfor$
243 $if(title)$
244 \title{$title$}
245 $endif$
246 \author{$for(author)$$author$$sep$ \and $endfor$}
247 $if(version)$
248 \date{Version $version$}
249 $endif$
251 \begin{document}
252 $if(title)$
253 \maketitle
254 $endif$
256 $for(include-before)$
257 $include-before$
258 $endfor$
260 $if(toc)$
261 \tableofcontents
262 $endif$
264 $body$
266 $for(include-after)$
267 $include-after$
268 $endfor$
270 \end{document}