documentclass[a4paper]{book} usepackage[
%urlbordercolor = {1 1 1}, %linkbordercolor = {1 1 1}, %citebordercolor = {1 1 1}, urlcolor = blue, colorlinks = true, citecolor = black, linkcolor = black]{hyperref}
usepackage{graphicx} usepackage{xltxtra} usepackage{fancyhdr} usepackage{booktabs} usepackage{indentfirst} usepackage{framed,color} usepackage{caption} captionsetup{font=bf,position=below}
usepackage{ctable}
definecolor{shadecolor}{gray}{0.90}
setromanfont[Mapping=tex-text,BoldFont=<%= cfg %>]{<%= cfg %>} setmonofont[Scale=.85]{<%= cfg %>}
XeTeXlinebreaklocale{<%= lang %>} <%= cfg %>
settowidth{parindent}{<%= cfg %>}
title{<%= info %>} author{<%= info %>}
makeatletter letsavedauthor=@author letsavedtitle=@title defimgwidth{.6linewidth} defmaxwidth{ifdimGin@nat@width>imgwidthimgwidth elseGin@nat@widthfi} makeatother
title{textbf{savedtitle}} author{textbf{savedauthor}thanks{<%= cfg %>}} defw3cdtfymd{theyear-ifnummonth<10 0fithemonth-ifnumday<10 0fitheday} date{w3cdtfymd} renewcommand{thefootnote}{fnsymbol{footnote}}
makeatletter
\setlength\headheight{12\p@} \setlength\headsep {.25in} \setlength\topskip {10\p@} \setlength\footskip{.35in} \setlength\textwidth{400\p@} \setlength\@tempdima{\paperheight} \addtolength\@tempdima{-2in} \divide\@tempdima\baselineskip \@tempcnta=\@tempdima \setlength\textheight{\@tempcnta\baselineskip} \addtolength\textheight{\topskip} \setlength\@tempdima {\paperwidth} \addtolength\@tempdima {-\textwidth} \setlength\oddsidemargin {\paperwidth} \addtolength\oddsidemargin {-2.35in} \addtolength\oddsidemargin {-\textwidth} \setlength\marginparwidth {0pt} \@settopoint\oddsidemargin \@settopoint\marginparwidth \setlength\evensidemargin {\paperwidth} \addtolength\evensidemargin{-2.35in} \addtolength\evensidemargin{-\textwidth} \@settopoint\evensidemargin \setlength\topmargin{\paperheight} \addtolength\topmargin{-2in} \addtolength\topmargin{-\headheight} \addtolength\topmargin{-\headsep} \addtolength\topmargin{-\textheight} \addtolength\topmargin{-\footskip} % this might be wrong! \addtolength\topmargin{-.5\topmargin} \@settopoint\topmargin
makeatother
fancypagestyle{plain}{fancyhf{}fancyfoot{footnotesizetextbfthepage}} pagestyle{plain}
renewcommand{headrulewidth}{0pt} renewcommand{footrulewidth}{0pt}
newcounterimg renewcommandtheimg}{thechapter.arabic{img}} newcommand{img}[1]{begin{figure
\refstepcounter{img} \label{img:\theimg} \centering\IfFileExists{figures/\theimg.pdf}{\includegraphics[width=\maxwidth]{figures/\theimg.pdf}}{\includegraphics[width=\maxwidth]{figures/\theimg.png}} \caption{#1}
end{figure}}
newcountertab renewcommand{thetab}{thechapter.arabic{tab}}
newcommandprechap}{<%= cfg['prechap'] %>} newcommand{postchap}{<%= cfg['postchap'] %>} newcommand{presect}{<%= cfg['presect'] %>} newcommand{postsect}{<%= cfg['postsect'] %>} renewcommand{chaptermark}[1]{markboth{textbf{prechap thechapter postchap}hspace*{1ex}#1}{}} renewcommand{sectionmark}[1]{markright{textbf{presect thesection postsect}hspace*{1ex}#1}} newcommand{chap}[1]{newpagethispagestyle{empty}chapter{#1}label{chap:thechapter}} newcommand{chapref}[1]{hyperref[chap:#1]{prechap #1postchap}} newcommand{imgref}[1]{hyperref[img:#1]{<%= cfg['fig'] %>#1}} newcommand{tabref}[1]{hyperref[tab:#1]{<%= cfg['tab'] %>#1}} newcommand{e{$ times 10^{#1}$} renewcommand{contentsname}{<%= cfg %>} renewcommand{figurename}{<%= cfg %>} renewcommand{tablename}{<%= cfg %>}
makeatletter def@makechapterhead#1{%
\vspace*{50\p@}% {\parindent \z@ \raggedright \normalfont \ifnum \c@secnumdepth >\m@ne \if@mainmatter \huge\bfseries \prechap \thechapter \postchap \par\nobreak \vskip 20\p@ \fi \fi \interlinepenalty\@M \Huge \bfseries #1\par\nobreak \vskip 40\p@ }}
makeatother
linespread{1.3}
begin{document} frontmatter maketitle thispagestyle{empty} setcounter{tocdepth}{4} tableofcontentsnewpagethispagestyle{empty}
mainmatter fancyhf{} fancyhead[LE]{{smallleftmark}} fancyhead[RO]{{smallrightmark}} fancyhead[RE,LO]{{smallsavedauthorhspace*{1ex}textbf{savedtitle}}} fancyfoot[LE,RO]{smalltextbfthepage} pagestyle{fancy}
<%= latex %> end{document}