summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2015-05-14 18:11:15 +0900
committerSean Whitton <spwhitton@spwhitton.name>2015-05-14 18:11:15 +0900
commit22b1c9902f76b68627985d11724019ba954552d1 (patch)
tree52faebe21518b09ce3fe2a90778959b50e39e8c8
parent8aaaf2240625fcbd1951b61b25da381937ba4141 (diff)
downloaddotfiles-22b1c9902f76b68627985d11724019ba954552d1.tar.gz
pandoc for essays
-rw-r--r--.pandoc/templates/default.latex191
-rw-r--r--texmf/tex/latex/pessay/pessay.cls151
2 files changed, 342 insertions, 0 deletions
diff --git a/.pandoc/templates/default.latex b/.pandoc/templates/default.latex
new file mode 100644
index 00000000..9503b04d
--- /dev/null
+++ b/.pandoc/templates/default.latex
@@ -0,0 +1,191 @@
+\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$$if(papersize)$$papersize$,$endif$$for(classoption)$$classoption$$sep$,$endfor$]{$documentclass$}
+\usepackage{amssymb,amsmath}
+$if(fontfamily)$
+\usepackage{$fontfamily$}
+$else$
+%% \usepackage{lmodern}
+$endif$
+$if(linestretch)$
+\usepackage{setspace}
+\setstretch{$linestretch$}
+$endif$
+\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$}
+$endif$
+$if(mathfont)$
+ \setmathfont(Digits,Latin,Greek){$mathfont$}
+$endif$
+\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}}{}
+$if(geometry)$
+\usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
+$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}
+$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$
+\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(lang)$
+\ifxetex
+ \usepackage{polyglossia}
+ \setmainlanguage{$mainlang$}
+\else
+ \usepackage[$lang$]{babel}
+\fi
+$endif$
+
+$if(title)$
+\title{$title$}
+$endif$
+$if(subtitle)$
+\subtitle{$subtitle$}
+$endif$
+$if(author)$
+\author{$for(author)$$author$$sep$ \and $endfor$}
+$endif$
+$if(date)$
+\date{$date$}
+$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)$
+{
+\hypersetup{linkcolor=black}
+\setcounter{tocdepth}{$toc-depth$}
+\tableofcontents
+}
+$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}
diff --git a/texmf/tex/latex/pessay/pessay.cls b/texmf/tex/latex/pessay/pessay.cls
new file mode 100644
index 00000000..08d2d0b3
--- /dev/null
+++ b/texmf/tex/latex/pessay/pessay.cls
@@ -0,0 +1,151 @@
+%% ---- Sean's Pandoc essay document class, derived from his spwpaper
+%% ---- class. Some features of the spwpaper class have not yet been
+%% ---- implemented here, such as endnotes and some maths symbols.
+
+\ProvidesClass{pessay}
+
+%% ---- Commands to set up line spacing.
+
+\newcommand{\initialdouble}{%
+ \RequirePackage[doublespacing]{setspace}%
+ \setstretch{2}%
+}
+\newcommand{\startdouble}{%
+ \doublespacing%
+ \setstretch{2}%
+}
+\newcommand{\finishdouble}{\onehalfspacing}
+
+%% ---- Options for our document class.
+
+%% One-half spacing
+
+\DeclareOption{onehalf}{%
+ \renewcommand{\initialdouble}{%
+ \RequirePackage{setspace}%
+ \onehalfspacing%
+ }%
+ \renewcommand{\startdouble}{}%
+}
+
+%% Pseudo double spacing
+
+\DeclareOption{pseudodouble}{%
+ \renewcommand{\initialdouble}{%
+ \RequirePackage[doublespacing]{setspace}%
+ \onehalfspacing%
+ }%
+ \renewcommand{\startdouble}{\doublespacing}%
+}
+
+%% Single spacing
+
+\DeclareOption{single}{%
+ \renewcommand{\initialdouble}{%
+ \RequirePackage{setspace}%
+ }%
+ \renewcommand{\startdouble}{}%
+ \renewcommand{\finishdouble}{}%
+}
+
+%% A4 paper instead of (default) letter paper
+
+\newcommand{\papersettings}{%
+ \LoadClass[12pt,letterpaper]{article}%
+ \RequirePackage[letterpaper,headheight=0.5in,margin=1in,nofoot]{geometry}%
+}
+
+\DeclareOption{a4paper}{%
+ \renewcommand{\papersettings}{%
+ \LoadClass[12pt,a4paper]{article}%
+ \RequirePackage[a4paper,headheight=0.5in,margin=1in,nofoot]{geometry}%
+ }%
+}
+
+\newcommand{\notesandrefs}[1]{\noteshere
+ \bibhere{#1}}
+\newcommand{\doendnotes}{
+ \renewcommand{\footnote}[1]{\endnote{##1}}}
+\DeclareOption{footnotes}{\renewcommand{\notesandrefs}[1]{\bibhere{#1}}\renewcommand{\doendnotes}{}}
+
+
+%% ---- Pass options to the article class and then load it with
+%% ---- \papersettings (defined just above)
+
+\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
+\ProcessOptions
+\papersettings
+
+%% ---- Load all the other packages we'll need
+
+\RequirePackage{amsmath} % load it before loading fonts
+\RequirePackage{enumitem}
+\RequirePackage[british]{babel}
+\RequirePackage{newtxtext} % would be good to use 'osf' option for old style figures: see newtxdoc.pdf
+\RequirePackage[sc,sf,bf,compact,medium]{titlesec}
+\RequirePackage{textcomp}
+\RequirePackage[norule,splitrule,stable,multiple]{footmisc}
+%% \RequirePackage[utf8]{inputenc}
+%% \RequirePackage{ellipsis}
+%% \RequirePackage{stmaryrd}
+\RequirePackage{ifthen}
+%% \RequirePackage[all]{nowidow}
+\RequirePackage{fancyhdr}
+\initialdouble % defined above, loads setspace package
+
+%% ---- Useful enumerations
+
+\setenumerate[1]{resume,label={\arabic*.},ref={(\arabic*)},itemindent=0.30in,labelsep=1em,itemsep=-1em,before=\vspace{-0.5em},after=\vspace{-0.5em}}
+
+%% ---- Sectioning
+
+%% First define my custom sectioning command for essay sections
+
+%% see http://tex.stackexchange.com/a/8755
+
+\newcommand{\essaysection}[1]{%
+ \par
+ \ifthenelse{\equal{\thesection}{0}}{}{\bigskip}
+ \pagebreak[2]%
+ \refstepcounter{section}%
+ \everypar={%
+ {\setbox0=\lastbox} % remove the indentation
+ \thesection. $\quad$%
+ \ifthenelse{\equal{#1}{}}{}{ \textsl{#1} $\quad$}
+ \everypar={}%
+ }%
+ \ignorespaces
+}
+
+%% Now set up \section* to point to the old \section*, but \section to
+%% point to my \essaysection. This works well with pandoc-citeproc.
+
+%% see http://tex.stackexchange.com/a/77906
+
+\makeatletter
+\let\latex@section\section
+\def\section{\secdef\my@section{\latex@section*}}
+\def\my@section[#1]#2{\essaysection{#2}}
+\makeatother
+
+%% ---- Headers and footers
+
+\pagestyle{fancy}
+\fancyhf{}
+\fancyhead[R]{\textsf{\thepage}}
+\fancypagestyle{plain}{ %
+ \fancyhf{} % remove everything
+ \renewcommand{\headrulewidth}{0pt} % remove lines as well
+ \renewcommand{\footrulewidth}{0pt}}
+\renewcommand{\headrulewidth}{0pt}
+
+%% ---- Document title
+
+\makeatletter\renewcommand{\maketitle}{\finishdouble\thispagestyle{plain}
+ \begin{center}\textsf{\@title}
+
+
+ \textsf{\@author}\ifthenelse{\equal{\@date}{}}{}{$\qquad\quad$}\textsf{\@date}
+
+\end{center}\startdouble
+}\makeatother