| 1 |
\documentclass[b5paper,twoside,openright,final]{memoir} |
| 2 |
\usepackage[b5paper]{geometry} |
| 3 |
\usepackage[T1]{fontenc} |
| 4 |
\usepackage{lmodern} |
| 5 |
\usepackage{amssymb,amsmath,xcolor,calc} |
| 6 |
\usepackage{ifxetex,ifluatex} |
| 7 |
\usepackage{fixltx2e} % provides \textsubscript |
| 8 |
% use upquote if available, for straight quotes in verbatim environments |
| 9 |
\IfFileExists{upquote.sty}{\usepackage{upquote}}{} |
| 10 |
% \usepackage[utf8]{inputenc} |
| 11 |
\usepackage{mathspec} |
| 12 |
\usepackage{xltxtra,xunicode} |
| 13 |
\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase} |
| 14 |
\setmainfont{$mainfont$} |
| 15 |
\setsansfont{$sansfont$} |
| 16 |
\setmonofont[Mapping=tex-ansi]{$monofont$} |
| 17 |
|
| 18 |
\usepackage{microtype} |
| 19 |
\usepackage[backend=bibtex]{biblatex} |
| 20 |
\bibliography{$biblio-files$} |
| 21 |
\usepackage{listings} |
| 22 |
\lstdefinelanguage{cafeobj} |
| 23 |
{morekeywords={mod,mod!,mod*,CafeOBJ>,open,close,red,reduce,exec,op,ops,var,vars,eq,ceq,beq,trans,:,.,=,==,pr}, |
| 24 |
sensitive=false, |
| 25 |
morecomment=[l]{--}} |
| 26 |
\lstset{frame=shadowbox,basicstyle=\ttfamily,showspaces=false,% |
| 27 |
language=cafeobj,columns=fullflexible,% |
| 28 |
breaklines,prebreak={\Righttorque},postbreak={\Lefttorque}} |
| 29 |
|
| 30 |
% |
| 31 |
% fix overlap of subsubsections |
| 32 |
\AtBeginDocument{ |
| 33 |
\addtolength{\cftsectionnumwidth}{.5em} |
| 34 |
\addtolength{\cftsubsectionnumwidth}{.5em} |
| 35 |
} |
| 36 |
|
| 37 |
%%%%%%%%%%% |
| 38 |
% chapter heads from http://texblog.org/2012/07/03/fancy-latex-chapter-styles/ |
| 39 |
\definecolor{chaptercolor}{gray}{0.8} |
| 40 |
% helper macros |
| 41 |
\newcommand\numlifter[1]{\raisebox{-2cm}[0pt][0pt]{\smash{#1}}} |
| 42 |
\newcommand\numindent{\kern37pt} |
| 43 |
\newlength\chaptertitleboxheight |
| 44 |
\makechapterstyle{hansen}{ |
| 45 |
\renewcommand\printchaptername{\raggedleft} |
| 46 |
\renewcommand\printchapternum{% |
| 47 |
\begingroup% |
| 48 |
\leavevmode% |
| 49 |
\chapnumfont% |
| 50 |
\strut% |
| 51 |
\numlifter{\thechapter}% |
| 52 |
\numindent% |
| 53 |
\endgroup% |
| 54 |
} |
| 55 |
\renewcommand*{\printchapternonum}{% |
| 56 |
\vphantom{\begingroup% |
| 57 |
\leavevmode% |
| 58 |
\chapnumfont% |
| 59 |
\numlifter{\vphantom{9}}% |
| 60 |
\numindent% |
| 61 |
\endgroup} |
| 62 |
\afterchapternum} |
| 63 |
\setlength\midchapskip{0pt} |
| 64 |
\setlength\beforechapskip{0.5\baselineskip} |
| 65 |
\setlength{\afterchapskip}{3\baselineskip} |
| 66 |
\renewcommand\chapnumfont{% |
| 67 |
\fontsize{4cm}{0cm}% |
| 68 |
\bfseries% |
| 69 |
\sffamily% |
| 70 |
\color{chaptercolor}% |
| 71 |
} |
| 72 |
\renewcommand\chaptitlefont{% |
| 73 |
\normalfont% |
| 74 |
\huge% |
| 75 |
\bfseries% |
| 76 |
\raggedleft% |
| 77 |
}% |
| 78 |
\settototalheight\chaptertitleboxheight{% |
| 79 |
\parbox{\textwidth}{\chaptitlefont \strut bg\\bg\strut}} |
| 80 |
\renewcommand\printchaptertitle[1]{% |
| 81 |
\parbox[t][\chaptertitleboxheight][t]{\textwidth}{% |
| 82 |
%\microtypesetup{protrusion=false}% add this if you use microtype |
| 83 |
\chaptitlefont\strut ##1\strut}% |
| 84 |
}} |
| 85 |
\chapterstyle{hansen} |
| 86 |
\aliaspagestyle{chapter}{empty} % just to save some space |
| 87 |
|
| 88 |
\usepackage{graphicx} |
| 89 |
% Redefine \includegraphics so that, unless explicit options are |
| 90 |
% given, the image width will not exceed the width of the page. |
| 91 |
% Images get their normal width if they fit onto the page, but |
| 92 |
% are scaled down if they would overflow the margins. |
| 93 |
\makeatletter |
| 94 |
\def\ScaleIfNeeded{% |
| 95 |
\ifdim\Gin@nat@width>\linewidth |
| 96 |
\linewidth |
| 97 |
\else |
| 98 |
\Gin@nat@width |
| 99 |
\fi |
| 100 |
} |
| 101 |
\makeatother |
| 102 |
\let\Oldincludegraphics\includegraphics |
| 103 |
{% |
| 104 |
\catcode`\@=11\relax% |
| 105 |
\gdef\includegraphics{\@ifnextchar[{\Oldincludegraphics}{\Oldincludegraphics[width=\ScaleIfNeeded]}}% |
| 106 |
}% |
| 107 |
|
| 108 |
\usepackage[setpagesize=false, % page size defined by xetex |
| 109 |
unicode=false, % unicode breaks when used with xetex |
| 110 |
xetex]{hyperref} |
| 111 |
\hypersetup{breaklinks=true, |
| 112 |
bookmarks=true, |
| 113 |
pdfauthor={$author-meta$}, |
| 114 |
pdftitle={$title-meta$}, |
| 115 |
colorlinks=true, |
| 116 |
citecolor=$if(citecolor)$$citecolor$$else$blue$endif$, |
| 117 |
urlcolor=$if(urlcolor)$$urlcolor$$else$blue$endif$, |
| 118 |
linkcolor=$if(linkcolor)$$linkcolor$$else$magenta$endif$, |
| 119 |
pdfborder={0 0 0}} |
| 120 |
\urlstyle{same} % don't use monospace font for urls |
| 121 |
\setlength{\parindent}{0pt} |
| 122 |
\setlength{\parskip}{6pt plus 2pt minus 1pt} |
| 123 |
\setlength{\emergencystretch}{3em} % prevent overfull lines |
| 124 |
$if(numbersections)$ |
| 125 |
\setcounter{secnumdepth}{4} |
| 126 |
$else$ |
| 127 |
\setcounter{secnumdepth}{0} |
| 128 |
$endif$ |
| 129 |
|
| 130 |
\makeatletter |
| 131 |
\newlength\drop |
| 132 |
\newcommand*{\titleGM}{% |
| 133 |
\thispagestyle{empty} |
| 134 |
\begingroup% Gentle Madness |
| 135 |
\drop = 0.1\textheight |
| 136 |
\vspace*{\baselineskip} |
| 137 |
\vfill |
| 138 |
\hbox{% |
| 139 |
\hspace*{0.2\textwidth}% |
| 140 |
\rule{1pt}{\dimexpr\textheight-28pt\relax}% |
| 141 |
\hspace*{0.05\textwidth}% |
| 142 |
\parbox[b]{0.75\textwidth}{% |
| 143 |
\vbox{% |
| 144 |
\vspace{\drop} |
| 145 |
{\Huge\bfseries\raggedright\thetitle\par}\vskip2.37\baselineskip |
| 146 |
{\Large\bfseries\theauthor\par} |
| 147 |
\vspace{0.5\textheight} |
| 148 |
{\small\thedate\par} |
| 149 |
\vskip2\baselineskip |
| 150 |
}% end of vbox |
| 151 |
}% end of parbox |
| 152 |
}% end of hbox |
| 153 |
\vfill |
| 154 |
\null |
| 155 |
\endgroup |
| 156 |
\cleardoublepage} |
| 157 |
\makeatother |
| 158 |
|
| 159 |
$if(title)$ |
| 160 |
\title{$title$} |
| 161 |
$endif$ |
| 162 |
$if(subtitle)$ |
| 163 |
\subtitle{$subtitle$} |
| 164 |
$endif$ |
| 165 |
\author{$for(author)$$author$$sep$ \and $endfor$} |
| 166 |
\date{$date$} |
| 167 |
$for(header-includes)$ |
| 168 |
$header-includes$ |
| 169 |
$endfor$ |
| 170 |
|
| 171 |
\begin{document} |
| 172 |
\frontmatter |
| 173 |
$if(title)$ |
| 174 |
\begin{titlingpage} |
| 175 |
\titleGM |
| 176 |
%\maketitle |
| 177 |
\end{titlingpage} |
| 178 |
$endif$ |
| 179 |
$if(abstract)$ |
| 180 |
\begin{abstract} |
| 181 |
$abstract$ |
| 182 |
\end{abstract} |
| 183 |
$endif$ |
| 184 |
|
| 185 |
$for(include-before)$ |
| 186 |
$include-before$ |
| 187 |
|
| 188 |
$endfor$ |
| 189 |
$if(toc)$ |
| 190 |
{ |
| 191 |
\hypersetup{linkcolor=black} |
| 192 |
\setcounter{tocdepth}{$toc-depth$} |
| 193 |
\tableofcontents |
| 194 |
} |
| 195 |
$endif$ |
| 196 |
\mainmatter |
| 197 |
$body$ |
| 198 |
|
| 199 |
$if(natbib)$ |
| 200 |
$if(biblio-files)$ |
| 201 |
$if(biblio-title)$ |
| 202 |
$if(book-class)$ |
| 203 |
\renewcommand\bibname{$biblio-title$} |
| 204 |
$else$ |
| 205 |
\renewcommand\refname{$biblio-title$} |
| 206 |
$endif$ |
| 207 |
$endif$ |
| 208 |
\bibliography{$biblio-files$} |
| 209 |
|
| 210 |
$endif$ |
| 211 |
$endif$ |
| 212 |
$if(biblatex)$ |
| 213 |
\printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$ |
| 214 |
|
| 215 |
$endif$ |
| 216 |
$for(include-after)$ |
| 217 |
$include-after$ |
| 218 |
|
| 219 |
$endfor$ |
| 220 |
\end{document} |