Skip to content

Instantly share code, notes, and snippets.

@famuvie
Created October 31, 2015 20:57
Show Gist options
  • Save famuvie/5f27e90b0732b53b79a0 to your computer and use it in GitHub Desktop.
Save famuvie/5f27e90b0732b53b79a0 to your computer and use it in GitHub Desktop.
$if(abstract)$
%TC:envir abstract [] ignore
$endif$
$if(arara)$
$for(arara)$
% arara: $arara$
$endfor$
$endif$
\RequirePackage{fixltx2e}
\documentclass[$if(fontsize)$$fontsize$,$endif$$if(papersize)$$papersize$$else$a4paper,$endif$$for(classoption)$$classoption$$sep$,$endfor$]{$documentclass$}
\usepackage{amssymb,amsmath}
\usepackage{textcomp}
\usepackage{ifxetex,ifluatex}
$if(linestretch)$
\usepackage{setspace}
\setstretch{$linestretch$}
$endif$
% use footnotebackref.sty
\usepackage{footnotebackref}
$if(affiliation)$
% use authblk for author affiliation
$if(anonymous)$
$else$
\usepackage{authblk}
$endif$
$endif$
% single space after a period
\frenchspacing
% use titling to give title hooks
\usepackage{titling}
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
$if(fontfamily)$
\usepackage{$fontfamily$}
$else$
\usepackage{lmodern}
$endif$
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
$if(euro)$
\usepackage{eurosym}
$endif$
\else % if luatex or xelatex
\usepackage{fontspec}
\usepackage{realscripts}
\usepackage{unicode-math}
\unimathsetup{math-style=TeX}
$if(mainfont)$
\setmainfont{$mainfont$}
$endif$
$if(sansfont)$
\setsansfont{$sansfont$}
$endif$
$if(monofont)$
\setmonofont{$monofont$}
$endif$
$if(mathfont)$
\setmathfont{$mathfont$}
$else$
$if(mainfont)$
\setmathfont{$mainfont$}
$endif$
$endif$
\fi
% use upquote for straight quotes in verbatim environments
\usepackage{upquote}
% use microtype
\usepackage{microtype}
% use csquotes
\usepackage[style=british]{csquotes}
$if(geometry)$
\usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
$endif$
$if(anonymous)$
$else$
\usepackage{pageslts}
\pagenumbering{arabic}
\newcommand*{\pages}{\thepage{}/\lastpageref*{VeryLastPage}}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
$if(lhead)$
\fancyhead[L]{$lhead$}
$else$
\fancyhead[L]{\nouppercase\leftmark}
$endif$
$if(chead)$
\fancyhead[C]{$chead$}
$endif$
$if(rhead)$
\fancyhead[R]{$rhead$}
$else$
\fancyhead[R]{\theauthor}
$endif$
$if(lfoot)$
\fancyfoot[L]{$lfoot$}
$endif$
$if(cfoot)$
\fancyfoot[C]{$cfoot$}
$else$
\fancyfoot[C]{\pages}
$endif$
$if(rfoot)$
\fancyfoot[R]{$rfoot$}
$endif$
\fancypagestyle{plain}{
\renewcommand{\headrulewidth}{0pt}
\fancyhf{}
$if(message)$
\fancyhead[C]{$message$}
$endif$
$if(lfoot)$
\fancyfoot[L]{$lfoot$}
$endif$
$if(cfoot)$
\fancyfoot[C]{$cfoot$}
$else$
\fancyfoot[C]{\pages}
$endif$
$if(rfoot)$
\fancyfoot[R]{$rfoot$}
$endif$}
$endif$
$if(natbib)$
\usepackage{natbib}
\bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$}
$endif$
$if(listings)$
\usepackage{listings}
$endif$
$if(lhs)$
\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
$endif$
$if(code)$
\lstloadlanguages{$code$}
\lstset{language=$code$,basicstyle=\small\ttfamily,showstringspaces=false}
$endif$
$if(highlighting-macros)$
$highlighting-macros$
$endif$
$if(verbatim-in-note)$
\usepackage{fancyvrb}
\VerbatimFootnotes
$endif$
$if(tables)$
\usepackage{longtable,booktabs}
$endif$
$if(graphics)$
\usepackage{graphicx}
\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}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
$endif$
\usepackage{hyperref}
\hypersetup{breaklinks=true,
pdfinfo={$if(anonymous)$$else$Author={$author-meta$},$endif$Title={$title-meta$}},
$if(colorlinks)$colorlinks$else$hidelinks$endif$}
$if(links-as-notes)$
% Make links footnotes instead of hotlinks:
\renewcommand{\href}[2]{#2\footnote{\url{#1}}}
$endif$
$if(strikeout)$
\usepackage[normalem]{ulem}
% avoid problems with \sout in headers with hyperref:
\pdfstringdefDisableCommands{\renewcommand{\sout}{}}
$endif$
$if(numbersections)$
\setcounter{secnumdepth}{5}
$else$
\setcounter{secnumdepth}{0}
$endif$
$if(verbatim-in-note)$
\VerbatimFootnotes % allows verbatim text in footnotes
$endif$
\ifxetex
\usepackage{polyglossia}
\setmainlanguage[variant=british]{english}
\else
\usepackage[shorthands=off,british]{babel}
\fi
$if(biblatex)$
$if(biblio-style)$
\usepackage[backend=biber,style=$biblio-style$,$for(biblatex-option)$$biblatex-option$$sep$,$endfor$]{biblatex}
$else$
$if(anonymous)$
\usepackage[backend=biber,language=british,sortlocale=en-GB,style=authoryear]{biblatex}
$else$
\usepackage[authordate,backend=biber,backref]{biblatex-chicago}
$endif$
$endif$
$if(biblio-files)$
$for(biblio-files)$
\addbibresource{$biblio-files$.bib}
$endfor$
$endif$
$endif$
$if(title)$
\title{$title$$if(thanks)$$if(anonymous)$$else$\thanks{$thanks$}$endif$$endif$$if(subtitle)$\\\vspace{0.5em}{\large $subtitle$}$endif$}
$endif$
$if(author)$
$if(anonymous)$
$else$
\author{$for(author)$$author$$sep$ \and $endfor$}
$endif$
$endif$
$if(affiliation)$
$if(anonymous)$
$else$
\newcommand*{\theaffiliation}{$affiliation$}
\affil{$affiliation$}
$endif$
$endif$
$if(email)$
$if(anonymous)$
$else$
\newcommand*{\theemail}{\href{mailto:$email$}{\nolinkurl{$email$}}}
\renewcommand*{\maketitlehookc}{\begin{center}\large\theemail\end{center}}
$endif$
$endif$
$if(gitinfo)$
\usepackage[english,cleanlook]{isodate}
\usepackage[grumpy]{gitinfo2}
\date{\printdate{\gitAuthorDate}}
$else$
$if(date)$
\date{$date$}
$else$
\date{}
$endif$
$endif$
$if(words)$
\newcommand*{\thewords}{$words$ words}
\renewcommand*{\maketitlehookd}{\begin{center}\large\thewords\end{center}}
$endif$
$for(header-includes)$
$header-includes$
$endfor$
\begin{document}
$if(title)$
\maketitle
$endif$
$if(abstract)$
\begin{abstract}
$abstract$
\end{abstract}
$endif$
$for(include-before)$
$include-before$
$endfor$
$if(toc)$
{
\setcounter{tocdepth}{$toc-depth$}
\tableofcontents
}
$endif$
$if(lot)$
\listoftables
$endif$
$if(lof)$
\listoffigures
$endif$
$body$
$if(natbib)$
$if(biblio-files)$
$if(biblio-title)$
$if(book-class)$
\renewcommand\bibname{$biblio-title$}
$else$
\renewcommand\refname{$biblio-title$}
$endif$
$endif$
\bibliography{$biblio-files$}
$endif$
$endif$
$if(biblatex)$
\printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$
$endif$
$for(include-after)$
$include-after$
$endfor$
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment