[doc] Add PDF template.
[ttfautohint.git] / doc / template.tex
blobcec8c33d93753a2e35b652e49b6430379374c1bb
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}
13 $if(highlighting-macros)$
14 $highlighting-macros$
15 $endif$
17 $if(verbatim-in-note)$
18 \usepackage{fancyvrb}
19 $endif$
21 $if(fancy-enums)$
22 % Redefine labelwidth for lists; otherwise, the enumerate package will cause
23 % markers to extend beyond the left margin.
24 \makeatletter\AtBeginDocument{%
25 \renewcommand{\@listi}
26 {\setlength{\labelwidth}{4em}}
27 }\makeatother
28 \usepackage{enumerate}
29 $endif$
31 $if(tables)$
32 \usepackage{ctable}
33 \usepackage{float} % provides the H option for float placement
34 % pandoc uses \medskip between table rows which looks ugly
35 \setupctable{
36 doinside={\let\medskip\relax}
38 $endif$
40 $if(url)$
41 \usepackage{url}
42 $endif$
44 $if(graphics)$
45 \usepackage{graphicx}
46 % We will generate all images so they have a width \maxwidth. This means
47 % that they will get their normal width if they fit onto the page, but
48 % are scaled down if they would overflow the margins.
49 \makeatletter
50 \def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth
51 \else\Gin@nat@width\fi}
52 \makeatother
53 \let\Oldincludegraphics\includegraphics
54 \renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=0.6\maxwidth]{#1}}
55 $endif$
57 \ifxetex
58 \usepackage[setpagesize=false, % page size defined by xetex
59 unicode=false, % unicode breaks when used with xetex
60 xetex,
61 colorlinks=true,
62 linkcolor=blue]{hyperref}
63 \else
64 \usepackage[unicode=true,
65 colorlinks=true,
66 linkcolor=blue]{hyperref}
67 \fi
68 \hypersetup{breaklinks=true, pdfborder={0 0 0}}
70 $if(subscript)$
71 \newcommand{\textsubscr}[1]{\ensuremath{_{\scriptsize\textrm{#1}}}}
72 $endif$
74 \setlength{\parindent}{0pt}
75 \setlength{\parskip}{6pt plus 2pt minus 1pt}
76 \setlength{\emergencystretch}{3em} % prevent overfull lines
78 % We want a break after the description label. Alas, it is necessary to
79 % copy the whole definition of \@item and the `description' environemnt just
80 % to insert `\\'...
81 \makeatletter
83 \let\original@item\@item
84 \def\description@item[#1]{%
85 \if@noparitem
86 \@donoparitem
87 \else
88 \if@inlabel
89 \indent \par
90 \fi
91 \ifhmode
92 \unskip\unskip \par
93 \fi
94 \if@newlist
95 \if@nobreak
96 \@nbitem
97 \else
98 \addpenalty\@beginparpenalty
99 \addvspace\@topsep
100 \addvspace{-\parskip}%
102 \else
103 \addpenalty\@itempenalty
104 \addvspace\itemsep
106 \global\@inlabeltrue
108 \everypar{%
109 \@minipagefalse
110 \global\@newlistfalse
111 \if@inlabel
112 \global\@inlabelfalse
113 {\setbox\z@\lastbox
114 \ifvoid\z@
115 \kern-\itemindent
116 \fi}%
117 \box\@labels
118 \penalty\z@
120 \if@nobreak
121 \@nobreakfalse
122 \clubpenalty \@M
123 \else
124 \clubpenalty \@clubpenalty
125 \everypar{}%
126 \fi}%
127 \if@noitemarg
128 \@noitemargfalse
129 \if@nmbrlist
130 \refstepcounter\@listctr
133 \sbox\@tempboxa{\makelabel{#1}}%
134 \global\setbox\@labels\hbox{%
135 \unhbox\@labels
136 \hskip \itemindent
137 \hskip -\labelwidth
138 \hskip -\labelsep
139 \ifdim \wd\@tempboxa >\labelwidth
140 \box\@tempboxa
141 \else
142 \hbox to\labelwidth {\unhbox\@tempboxa}%
143 \fi}%
144 \leavevmode\\
145 \ignorespaces}
147 \renewenvironment{description}{%
148 \list{}{\labelwidth\z@ \itemindent-\leftmargin
149 \let\makelabel\descriptionlabel
150 \let\@item\description@item}%
152 \let\@item\original@item
153 \endlist
156 \makeatother
158 $if(numbersections)$
159 $else$
160 \setcounter{secnumdepth}{0}
161 $endif$
163 $if(verbatim-in-note)$
164 \VerbatimFootnotes % allows verbatim text in footnotes
165 $endif$
167 $if(lang)$
168 \ifxetex
169 \usepackage{polyglossia}
170 \setmainlanguage{$mainlang$}
171 \else
172 \usepackage[$lang$]{babel}
174 $endif$
176 $for(header-includes)$
177 $header-includes$
178 $endfor$
180 $if(title)$
181 \title{$title$}
182 $endif$
183 \author{$for(author)$$author$$sep$ \and $endfor$}
184 $if(version)$
185 \date{Version $version$}
186 $endif$
188 \begin{document}
189 $if(title)$
190 \maketitle
191 $endif$
193 $for(include-before)$
194 $include-before$
195 $endfor$
197 $if(toc)$
198 \tableofcontents
199 $endif$
201 $body$
203 $for(include-after)$
204 $include-after$
205 $endfor$
207 \end{document}