1 % For non-ASCII characters, this template only works with luatex or XeTeX.
2 % Arabic, Devanagari, Telugu, and Thai support currently works with XeTeX
5 \documentclass[$if(fontsize)$$fontsize$,$endif$
%
6 $if(lang)$$lang$,$endif$
%
9 \usepackage{ifxetex,ifluatex
}
10 \usepackage[T1]{fontenc}
12 \usepackage{libertine
}
15 \usepackage{ucharclasses
}
17 \newfontfamily{\devanagarifont}[Script=Devanagari
]{FreeSerif
}
18 \newfontfamily{\telugufont}[Script=Telugu
]{Pothana2000
}
19 \newfontfamily{\thaifont}[Script=Thai
]{FreeSerif
}
20 \newfontfamily{\arabicfont}[Script=Arabic
]{FreeSerif
}
22 \setTransitionTo{Devanagari
}{\begingroup\devanagarifont}
23 \setTransitionFrom{Devanagari
}{\endgroup}
24 \setTransitionTo{Telugu
}{\begingroup\telugufont}
25 \setTransitionFrom{Telugu
}{\endgroup}
26 \setTransitionTo{Thai
}{\begingroup\thaifont}
27 \setTransitionFrom{Thai
}{\endgroup}
28 \setTransitionTo{Arabic
}{\begingroup\arabicfont}
29 \setTransitionFrom{Arabic
}{\endgroup}
32 % Libertine Mono is too ugly; we use lmodern instead
33 \renewcommand{\ttfamily}{\fontfamily{lmtt
}\selectfont}
35 \setkomafont{sectioning
}{\normalfont\bfseries}
36 \setkomafont{descriptionlabel
}{\normalfont}
37 \setkomafont{caption
}{\normalfont\small}
39 $if(highlighting-macros)$
43 $if(verbatim-in-note)$
48 % Redefine labelwidth for lists; otherwise, the enumerate package will cause
49 % markers to extend beyond the left margin.
53 \renewcommand{\@listi
}
54 {\setlength{\labelwidth}{4em
}}%
59 \usepackage{enumerate
}
63 % We use a patched version of longtable until a serious clash with
65 \usepackage{longtable-patched
}
68 % pandoc inserts \addlinespace after each line...
71 % XXX The \addlinespace macro, as used in the LaTeX code generated by
72 % pandoc, overrides any vertical space adjustments for \toprule and friends,
73 % which is quite unfortunate. I consider this a bug in pandoc 1.12.2.1.
74 % It's not too difficult to fix this, but I had to redefine a lot of
75 % booktabs commands, which I don't want. Since the layout degradation is
76 % minor, I simply wait until it gets fixed in pandoc.
89 % We will generate all images so they have a width 0.6\maxwidth. This means
90 % that they will get their normal width if they fit onto the page, but are
91 % scaled down if they would overflow this limit.
95 \ifdim\Gin@nat@width>
\linewidth
103 \let\Oldincludegraphics\includegraphics
104 \renewcommand{\includegraphics}[1]{%
105 \Oldincludegraphics[width=
0.6\maxwidth]{#1}}
109 \usepackage[setpagesize=false,
% page size defined by xetex
110 unicode=false,
% unicode breaks when used with xetex
113 linkcolor=blue
]{hyperref
}
115 \usepackage[unicode=true,
117 linkcolor=blue
]{hyperref
}
118 \usepackage{microtype
}
119 % don't apply protrusion to \texttt
120 \UseMicrotypeSet[protrusion
]{basicmath
}
122 \hypersetup{breaklinks=true,
123 pdfauthor=
{$author-meta$
},
124 pdftitle=
{$title-meta$
},
127 % We want the names `section 2', `subsection 4.1', and the like in local
128 % links, omitting the original link text. To do that, we redefine
134 % \hyperref[foo]{bar}
138 % bar (\autoref{foo})
140 \def\label@hyperref
[#1]#2{%
146 \newcommand{\textsubscr}[1]{%
147 \ensuremath{_
{\scriptsize\textrm{#1}}}}
150 \setlength{\parindent}{0pt
}
151 \setlength{\parskip}{6pt plus
2pt minus
1pt
}
152 \setlength{\emergencystretch}{4em
} % prevent overfull lines
154 % We want a break after the description label (if there is one).
157 \let\original@item\@item
158 \def\description@item
[#1]{%
172 \addpenalty\@beginparpenalty
174 \addvspace{-
\parskip}%
177 \addpenalty\@itempenalty
184 \global\@newlistfalse
186 \global\@inlabelfalse
198 \clubpenalty \@clubpenalty
204 \refstepcounter\@listctr
207 \sbox\@tempboxa
{\makelabel{#1}}%
208 \global\setbox\@labels
\hbox{%
213 \ifdim \wd\@tempboxa >
\labelwidth
216 \hbox to
\labelwidth {\unhbox\@tempboxa
}%
220 \def\reserved@b
{\@itemlabel
}%
221 \ifx\reserved@a
\reserved@b
227 \renewenvironment{description
}{%
228 \list{}{\labelwidth\z@
\itemindent-
\leftmargin
229 \let\makelabel\descriptionlabel
230 \let\@item
\description@item
}%
232 \let\@item
\original@item
238 % we want block quotes formatted as italic
239 \renewenvironment{quote
}{%
240 \list{}{\rightmargin\leftmargin}%
250 \setcounter{secnumdepth
}{5}
252 \setcounter{secnumdepth
}{0}
255 $if(verbatim-in-note)$
256 \VerbatimFootnotes % allows verbatim text in footnotes
261 \usepackage{polyglossia
}
262 \setmainlanguage{$mainlang$
}
264 \usepackage[$lang$
]{babel
}
268 $for(header-includes)$
275 \author{$for(author)$$author$$sep$
\and $endfor$
}
277 \date{Version $version$
}
285 $for(include-before)$