mirror of
https://github.com/sdiehl/write-you-a-haskell.git
synced 2024-08-16 15:11:06 +03:00
313 lines
7.0 KiB
Plaintext
313 lines
7.0 KiB
Plaintext
\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$$if(papersize)$$papersize$,$endif$$for(classoption)$$classoption$$sep$,$endfor$]{$documentclass$}
|
|
\usepackage{geometry}
|
|
\usepackage{xcolor}
|
|
\usepackage{graphicx}
|
|
\usepackage[labelformat=empty]{caption}
|
|
\usepackage{afterpage}
|
|
|
|
\newcommand\blankpage{%
|
|
\null
|
|
\thispagestyle{empty}%
|
|
\addtocounter{page}{-1}%
|
|
\newpage}
|
|
|
|
$if(fontfamily)$
|
|
\usepackage{$fontfamily$}
|
|
$else$
|
|
\usepackage{lmodern}
|
|
$endif$
|
|
$if(linestretch)$
|
|
\usepackage{setspace}
|
|
\setstretch{$linestretch$}
|
|
$endif$
|
|
\usepackage{amssymb,amsmath}
|
|
\usepackage{ifxetex,ifluatex}
|
|
\usepackage{fixltx2e} % provides \textsubscript
|
|
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
|
|
\usepackage[T1]{fontenc}
|
|
\usepackage[utf8]{inputenc}
|
|
$if(euro)$
|
|
\usepackage{eurosym}
|
|
$endif$
|
|
\else % if luatex or xelatex
|
|
\ifxetex
|
|
\usepackage{mathspec}
|
|
\usepackage{xltxtra,xunicode}
|
|
\else
|
|
\usepackage{fontspec}
|
|
\fi
|
|
\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
|
|
\newcommand{\euro}{€}
|
|
$if(mainfont)$
|
|
\setmainfont{$mainfont$}
|
|
$endif$
|
|
$if(sansfont)$
|
|
\setsansfont{$sansfont$}
|
|
$endif$
|
|
$if(monofont)$
|
|
%\setmonofont[Mapping=tex-ansi]{$monofont$}
|
|
% custom override
|
|
$endif$
|
|
|
|
$if(mathfont)$
|
|
\setmathfont(Digits,Latin,Greek){$mathfont$}
|
|
$endif$
|
|
|
|
\usepackage{fontspec}
|
|
\setmainfont[Ligatures=Common,
|
|
ItalicFont={Adobe Garamond Pro Italic}]
|
|
{Adobe Garamond Pro}
|
|
\setmonofont[Ligatures=NoCommon]{Source Code Pro}
|
|
|
|
\fi
|
|
% use upquote if available, for straight quotes in verbatim environments
|
|
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
|
|
% use microtype if available
|
|
\IfFileExists{microtype.sty}{%
|
|
\usepackage{microtype}
|
|
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
|
|
}{}
|
|
$if(geometry)$
|
|
\usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
|
|
$endif$
|
|
$if(lang)$
|
|
\ifxetex
|
|
\usepackage{polyglossia}
|
|
\setmainlanguage{$mainlang$}
|
|
\else
|
|
\usepackage[shorthands=off,$lang$]{babel}
|
|
\fi
|
|
$endif$
|
|
$if(natbib)$
|
|
\usepackage{natbib}
|
|
\bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$}
|
|
$endif$
|
|
$if(biblatex)$
|
|
\usepackage{biblatex}
|
|
$if(biblio-files)$
|
|
\bibliography{$biblio-files$}
|
|
$endif$
|
|
$endif$
|
|
$if(listings)$
|
|
\usepackage{listings}
|
|
$endif$
|
|
$if(lhs)$
|
|
\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
|
|
$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}
|
|
% Redefine \includegraphics so that, unless explicit options are
|
|
% given, the image width will not exceed the width or the height of the page.
|
|
% Images get their normal width if they fit onto the page, but
|
|
% are scaled down if they would overflow the margins.
|
|
\makeatletter
|
|
\def\ScaleWidthIfNeeded{%
|
|
\ifdim\Gin@nat@width>\linewidth
|
|
\linewidth
|
|
\else
|
|
\Gin@nat@width
|
|
\fi
|
|
}
|
|
\def\ScaleHeightIfNeeded{%
|
|
\ifdim\Gin@nat@height>0.9\textheight
|
|
0.9\textheight
|
|
\else
|
|
\Gin@nat@width
|
|
\fi
|
|
}
|
|
\makeatother
|
|
\setkeys{Gin}{width=\ScaleWidthIfNeeded,height=\ScaleHeightIfNeeded,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}}}
|
|
$endif$
|
|
$if(strikeout)$
|
|
\usepackage[normalem]{ulem}
|
|
% avoid problems with \sout in headers with hyperref:
|
|
\pdfstringdefDisableCommands{\renewcommand{\sout}{}}
|
|
$endif$
|
|
\setlength{\parindent}{0pt}
|
|
\setlength{\parskip}{6pt plus 2pt minus 1pt}
|
|
\setlength{\emergencystretch}{3em} % prevent overfull lines
|
|
$if(numbersections)$
|
|
\setcounter{secnumdepth}{5}
|
|
$else$
|
|
\setcounter{secnumdepth}{0}
|
|
$endif$
|
|
$if(verbatim-in-note)$
|
|
\VerbatimFootnotes % allows verbatim text in footnotes
|
|
$endif$
|
|
|
|
$if(title)$
|
|
\title{$title$$if(subtitle)$\\\vspace{0.5em}{\large $subtitle$}$endif$}
|
|
$endif$
|
|
$if(author)$
|
|
\author{$for(author)$$author$$sep$ \and $endfor$}
|
|
$endif$
|
|
\date{$date$}
|
|
$for(header-includes)$
|
|
$header-includes$
|
|
$endfor$
|
|
|
|
\begin{document}
|
|
$if(title)$
|
|
% ----------
|
|
% Title page
|
|
% ----------
|
|
|
|
\begin{titlepage}
|
|
|
|
\definecolor{titlepagecolor}{cmyk}{1,.60,0,.40}
|
|
\definecolor{namecolor}{cmyk}{1,.50,0,.10}
|
|
\newgeometry{left=7.5cm} %defines the geometry for the titlepage
|
|
\pagecolor{titlepagecolor}
|
|
\begin{figure}
|
|
\centering
|
|
\includegraphics[height=3in,width=3in]{img/Haskell-Logo.ps}
|
|
\end{figure}
|
|
|
|
\color{white}
|
|
\makebox[0pt][l]{\rule{1.3\textwidth}{1pt}}
|
|
\par
|
|
\noindent
|
|
{\huge \textsf{Write You a Haskell}}
|
|
\par
|
|
\noindent
|
|
{\textit{\textsf{Building a modern functional compiler from first principles}}}
|
|
%\textbf{\textsf{Something}} \textcolor{namecolor}{\textsf{Else}}
|
|
\vfill
|
|
\noindent
|
|
%{\huge \textsf{Write You a Haskell}}
|
|
\vskip\baselineskip
|
|
\noindent
|
|
{\huge \textsf{Stephen Diehl}}
|
|
\\
|
|
\textsf{December 2015 (Draft)}
|
|
|
|
\end{titlepage}
|
|
\pagecolor{white}
|
|
\restoregeometry % restores the geometry
|
|
|
|
% Filler page
|
|
%\null
|
|
%\thispagestyle{empty}
|
|
%\addtocounter{page}{-1}
|
|
%\newpage
|
|
|
|
% Subtitle page
|
|
%\vfill{3in}
|
|
%\begin{centering}
|
|
%{\HUGE \textsf{Write You a Haskell}}
|
|
%\end{centering}
|
|
|
|
%\thispagestyle{empty}
|
|
%\addtocounter{page}{-1}
|
|
%\newpage
|
|
|
|
% Copyright page
|
|
\thispagestyle{empty}
|
|
\addtocounter{page}{-1}
|
|
|
|
\begin{minipage}[b]{0.9\textwidth}
|
|
\footnotesize\raggedright
|
|
\setlength{\parskip}{0.5\baselineskip}
|
|
|
|
\begin{textsf}
|
|
{\textbf{Write You a Haskell}}\\
|
|
by Stephen Diehl
|
|
|
|
\par
|
|
Copyright \copyright\ 2013-2015. \\
|
|
\href{http://www.stephendiehl.com}{www.stephendiehl.com}
|
|
|
|
\par
|
|
This written work is licensed under a Creative Commons
|
|
Attribution-NonCommercial-ShareAlike 4.0 International License. You may
|
|
reproduce and edit this work with attribution for all non-commercial purposes.
|
|
\par
|
|
The included source is released under the terms of the MIT License.
|
|
\par
|
|
Git commit: 23a5afe76a51032ecfd08ac8c69932364520906c
|
|
\end{textsf}
|
|
\end{minipage}
|
|
\vspace*{2\baselineskip}
|
|
\cleardoublepage
|
|
|
|
$endif$
|
|
$if(abstract)$
|
|
\begin{abstract}
|
|
$abstract$
|
|
\end{abstract}
|
|
$endif$
|
|
|
|
$for(include-before)$
|
|
$include-before$
|
|
|
|
$endfor$
|
|
$if(toc)$
|
|
{
|
|
\hypersetup{linkcolor=black}
|
|
\setcounter{tocdepth}{$toc-depth$}
|
|
\tableofcontents
|
|
}
|
|
\pagebreak
|
|
$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}
|