|
@@ -1,4 +1,5 @@
|
|
|
-\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$$if(papersize)$$papersize$,$endif$$for(classoption)$$classoption$$sep$,$endfor$]{$documentclass$}
|
|
|
+\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$$if(papersize)$$papersize$,$endif$$for(classoption)$$classoption$$sep$,$endfor$]
|
|
|
+{$documentclass$}
|
|
|
\usepackage[a4paper,margin=1.5cm]{geometry}
|
|
|
% \geometry{a4paper}
|
|
|
$if(fontfamily)$
|
|
@@ -40,6 +41,10 @@ $endif$
|
|
|
$if(mathfont)$
|
|
|
\setmathfont(Digits,Latin,Greek){$mathfont$}
|
|
|
$endif$
|
|
|
+$if(CJKmainfont)$
|
|
|
+ \usepackage{xeCJK}
|
|
|
+ \setCJKmainfont[$CJKoptions$]{$CJKmainfont$}
|
|
|
+$endif$
|
|
|
\fi
|
|
|
% use upquote if available, for straight quotes in verbatim environments
|
|
|
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
|
|
@@ -51,10 +56,29 @@ $endif$
|
|
|
$if(geometry)$
|
|
|
\usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
|
|
|
$endif$
|
|
|
+\ifxetex
|
|
|
+ \usepackage[setpagesize=false, % page size defined by xetex
|
|
|
+ unicode=false, % unicode breaks when used with xetex
|
|
|
+ xetex]{hyperref}
|
|
|
+\else
|
|
|
+ \usepackage[unicode=true]{hyperref}
|
|
|
+\fi
|
|
|
+\usepackage[usenames,dvipsnames]{color}
|
|
|
+\hypersetup{breaklinks=true,
|
|
|
+ bookmarks=true,
|
|
|
+ pdfauthor={$author-meta$},
|
|
|
+ pdftitle={$title-meta$},
|
|
|
+ colorlinks=true,
|
|
|
+ citecolor=$if(citecolor)$$citecolor$$else$blue$endif$,
|
|
|
+ urlcolor=$if(urlcolor)$$urlcolor$$else$blue$endif$,
|
|
|
+ linkcolor=$if(linkcolor)$$linkcolor$$else$magenta$endif$,
|
|
|
+ pdfborder={0 0 0}}
|
|
|
+\urlstyle{same} % don't use monospace font for urls
|
|
|
$if(lang)$
|
|
|
\ifxetex
|
|
|
\usepackage{polyglossia}
|
|
|
\setmainlanguage{$mainlang$}
|
|
|
+ \setotherlanguages{$for(otherlang)$$otherlang$$sep$,$endfor$}
|
|
|
\else
|
|
|
\usepackage[shorthands=off,$lang$]{babel}
|
|
|
\fi
|
|
@@ -65,9 +89,9 @@ $if(natbib)$
|
|
|
$endif$
|
|
|
$if(biblatex)$
|
|
|
\usepackage{biblatex}
|
|
|
-$if(biblio-files)$
|
|
|
-\bibliography{$biblio-files$}
|
|
|
-$endif$
|
|
|
+$for(bibliography)$
|
|
|
+\addbibresource{$bibliography$}
|
|
|
+$endfor$
|
|
|
$endif$
|
|
|
$if(listings)$
|
|
|
\usepackage{listings}
|
|
@@ -86,7 +110,7 @@ $if(tables)$
|
|
|
\usepackage{longtable,booktabs}
|
|
|
$endif$
|
|
|
$if(graphics)$
|
|
|
-\usepackage{graphicx}
|
|
|
+\usepackage{graphicx,grffile}
|
|
|
\makeatletter
|
|
|
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
|
|
|
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
|
|
@@ -96,23 +120,6 @@ $if(graphics)$
|
|
|
% using explicit options in \includegraphics[width, height, ...]{}
|
|
|
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
|
|
|
$endif$
|
|
|
-\ifxetex
|
|
|
- \usepackage[setpagesize=false, % page size defined by xetex
|
|
|
- unicode=false, % unicode breaks when used with xetex
|
|
|
- xetex]{hyperref}
|
|
|
-\else
|
|
|
- \usepackage[unicode=true]{hyperref}
|
|
|
-\fi
|
|
|
-\hypersetup{breaklinks=true,
|
|
|
- bookmarks=true,
|
|
|
- pdfauthor={$author-meta$},
|
|
|
- pdftitle={$title-meta$},
|
|
|
- colorlinks=true,
|
|
|
- citecolor=$if(citecolor)$$citecolor$$else$blue$endif$,
|
|
|
- urlcolor=$if(urlcolor)$$urlcolor$$else$blue$endif$,
|
|
|
- linkcolor=$if(linkcolor)$$linkcolor$$else$magenta$endif$,
|
|
|
- pdfborder={0 0 0}}
|
|
|
-\urlstyle{same} % don't use monospace font for urls
|
|
|
$if(links-as-notes)$
|
|
|
% Make links footnotes instead of hotlinks:
|
|
|
\renewcommand{\href}[2]{#2\footnote{\url{#1}}}
|
|
@@ -125,6 +132,8 @@ $endif$
|
|
|
\setlength{\parindent}{0pt}
|
|
|
\setlength{\parskip}{6pt plus 2pt minus 1pt}
|
|
|
\setlength{\emergencystretch}{3em} % prevent overfull lines
|
|
|
+\providecommand{\tightlist}{%
|
|
|
+ \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
|
|
|
$if(numbersections)$
|
|
|
\setcounter{secnumdepth}{5}
|
|
|
$else$
|
|
@@ -145,6 +154,16 @@ $for(header-includes)$
|
|
|
$header-includes$
|
|
|
$endfor$
|
|
|
|
|
|
+% Redefines (sub)paragraphs to behave more like sections
|
|
|
+\ifx\paragraph\undefined\else
|
|
|
+\let\oldparagraph\paragraph
|
|
|
+\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
|
|
|
+\fi
|
|
|
+\ifx\subparagraph\undefined\else
|
|
|
+\let\oldsubparagraph\subparagraph
|
|
|
+\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
|
|
|
+\fi
|
|
|
+
|
|
|
\begin{document}
|
|
|
$if(title)$
|
|
|
\maketitle
|
|
@@ -161,7 +180,7 @@ $include-before$
|
|
|
$endfor$
|
|
|
$if(toc)$
|
|
|
{
|
|
|
-\hypersetup{linkcolor=black}
|
|
|
+\hypersetup{linkcolor=$if(toccolor)$$toccolor$$else$black$endif$}
|
|
|
\setcounter{tocdepth}{$toc-depth$}
|
|
|
\tableofcontents
|
|
|
}
|
|
@@ -175,7 +194,7 @@ $endif$
|
|
|
$body$
|
|
|
|
|
|
$if(natbib)$
|
|
|
-$if(biblio-files)$
|
|
|
+$if(bibliography)$
|
|
|
$if(biblio-title)$
|
|
|
$if(book-class)$
|
|
|
\renewcommand\bibname{$biblio-title$}
|
|
@@ -183,7 +202,7 @@ $else$
|
|
|
\renewcommand\refname{$biblio-title$}
|
|
|
$endif$
|
|
|
$endif$
|
|
|
-\bibliography{$biblio-files$}
|
|
|
+\bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$}
|
|
|
|
|
|
$endif$
|
|
|
$endif$
|