% Turabian Formatting for LaTeX -- Package Documentation
%
% ==============================
% Copyright 2013 Omar Abdool
%
% This work may be distributed and/or modified under the conditions of the LaTeX
% Project Public License (LPPL), either version 1.3 of this license or (at your
% option) any later version.
%
% The latest version of this license is in:
%	http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX version
% 2005/12/01 or later.
%
% LPPL Maintenance Status: maintained (by Omar Abdool)
%
% This work consists of the files: turabian-formatting.sty,
% turabian-researchpaper.cls, turabian-thesis.cls, turabian-formatting-doc.tex,
% and turabian-formatting-doc.pdf (in addition to the README file).
%
% ==============================
% Last updated: 2015/11/14
%
%


\documentclass{article}

\usepackage{polyglossia, fontspec, csquotes, ellipsis}
\setmainlanguage{english}
\defaultfontfeatures{Ligatures=TeX}

\usepackage{filecontents}
\begin{filecontents}{references.bib}
	@book{turabian_manual_2013,
		author = {Turabian, Kate L.},
		edition = {8th edition},
		title = {A Manual for Writers of Research Papers, Theses, and Dissertations: Chicago Style for Students and Researchers},
		shorttitle = {A Manual for Writers of Research Papers, Theses, and Dissertations},
		publisher = {University of Chicago Press},
		year = {2013}}
\end{filecontents}

\usepackage[authordate,backend=biber]{biblatex-chicago}
\addbibresource{references.bib}

\usepackage{units, metalogo, setspace}

\usepackage{marginnote}
\renewcommand*{\raggedleftmarginnote}{}
\renewcommand*{\marginfont}{\ttfamily}
\renewcommand*{\marginnotevadjust}{1\baselineskip}

\usepackage{geometry}
\geometry{top=1.5in, bottom=1.75in, left=1.75in, right=1.75in}

\usepackage[bottom, marginal]{footmisc}

\interfootnotelinepenalty=10000

\RequirePackage[defaultlines=2, all]{nowidow}

\usepackage[hidelinks]{hyperref}

\usepackage{listings}
\lstset{%
	language=TeX,
	aboveskip=10pt,
	belowskip=0pt,
	showstringspaces=false,
	columns=flexible,
	basicstyle={\normalsize\ttfamily},
	numbers=none,
	breaklines=true,
	breakatwhitespace=true,
	breakindent=0pt}

\newcommand{\versionDateText}{2015/11/14}

\title{Turabian Formatting for \LaTeX{}}
\author{Omar Abdool}
\date{\today}



\begin{document}

\maketitle

\renewcommand{\abstractname}{\vspace{-\baselineskip}}

\begin{abstract}
\noindent This package provides Chicago-style formatting based on Kate L. Turabian's \emph{A Manual for Writers of Research Papers, Theses, and Dissertations: Chicago Style for Students and Researchers} (8th edition).
\end{abstract}


\tableofcontents

% Formatting for document content

\newgeometry{top=1.75in, bottom=1.75in, left=2.25in, right=1.25in, marginparsep=0.25in, marginparwidth=1.25in}

\reversemarginpar
\setlength{\parindent}{0in}
\setlength{\parskip}{1\baselineskip}



\section*{Introduction}
\label{sec:introduction}

This package provides Chicago-style formatting based on Kate L. Turabian's \emph{A Manual for Writers of Research Papers, Theses, and Dissertations: Chicago Style for Students and Researchers}, 8th edition. In doing so, this package adheres closely to the formatting guidelines described in Turabian's work while, also, being readily adaptable to additional formatting requirements (e.g. formatting requirements specific to an institution and/or department).

It is hoped that authors will find this package relatively easy to implement. There are few (if any) new commands to learn, as the package builds upon (and makes adjustments to) already-existing \LaTeX{} commands. As such, formatting research papers, theses, and dissertations should require a minimum amount of changes to a standard \LaTeX{} source file (your \texttt{.tex} file).

For citations, this package is designed to work well with David Fussner's outstanding (and highly-recommended) \texttt{biblatex-chicago}.



\section{Using the Package and Document Classes}
\label{sec:implementation}

A document may be formatted using \texttt{turabian-formatting} in one of three ways: either (1) loading the package in the \LaTeX{} source-file preamble, (2) specifying the document class as a turabian-formatted research paper (\texttt{turabian-researchpaper}), or (3) specifying the document class as a thesis/dissertation with turabian-style formatting (\texttt{turabian-thesis}).


\subsection{Package for Turabian-Style Formatting}

\marginnote{turabian-\newline formatting}%
The \texttt{turabian-formatting} package is loaded in the preamble of the source file:

\begin{lstlisting}
	\usepackage{turabian-formatting}
\end{lstlisting}

Do not use this approach if the document class is either \texttt{turabian-researchpaper} or \texttt{turabian-thesis}.\footnote{%
	The \texttt{turabian-formatting} package has been tested with the standard \texttt{article}, \texttt{report}, and \texttt{book} \LaTeX{} document classes.}

This package should, also, always be loaded \emph{before} loading the \texttt{biblatex-chicago} package.


\clearpage
\subsection{Document Class for Research Papers}

\marginnote{turabian-\newline researchpaper}%
The \texttt{turabian-researchpaper} document class provides formatting specific to research papers. The requisite code:
\begin{lstlisting}
	\documentclass{turabian-researchpaper}
\end{lstlisting}

This document class builds on the \texttt{turabian-formatting} package and is based on the \texttt{article} document class.


\subsection{Document Class for Theses and Dissertations}

\marginnote{turabian-thesis}%
The \texttt{turabian-thesis} document class offers formatting specific to theses and dissertations. The requisite code:
\begin{lstlisting}
	\documentclass{turabian-thesis}
\end{lstlisting}

This document class builds on the \texttt{turabian-formatting} package and is based on the \texttt{book} document class. As such, support for chapter headings (\texttt{\textbackslash chapter} and \texttt{\textbackslash chapter*}), title pages specific to theses/dissertations (refer to subsection~\ref{subsec:titlepage}), table of contents, and formatting commands to structure the document into front matter, main matter, and back matter (refer to subsection~\ref{subsec:td_structure}), are also included.



\section{Formatting Options}
\label{sec:formatting_options}

The \texttt{turabian-formatting} package adheres to the manual’s guidelines on the formatting of text. This includes double-spacing all text throughout the document except items that should have single-spacing \autocite[373]{turabian_manual_2013}. Paragraph indentation is set to 0.5 inches.


\subsection{Standard Options for Document Classes}
Both \texttt{turabian-thesis} and \texttt{turabian-researchpaper} document classes support most of the standard document class options.\footnote{%
	Neither the \texttt{notitlepage} nor the \texttt{twocolumn} options, however, are supported by either document class.}

The default \texttt{normal} font size is twelve-point type (\texttt{12pt})---the preferred font type size for the body of the text \autocite[373]{turabian_manual_2013}. This package also supports \texttt{normal} font type sizes of \texttt{10pt} and \texttt{11pt}.

The default page size, for both document classes, is 8\nicefrac{1}{2} × 11 inches (US Letter size). And as with other standard \LaTeX{} document classes, different paper sizes and can be specified as class options, including \texttt{letterpaper} (the default), \texttt{a4paper}, and \texttt{legalpaper}.

Both documents classes, by default, are set to \texttt{oneside}.


\subsection{Page Layout and Empty Margins}
\label{subsec:pagelayout_emptymargins}

Page margins, by default, are 1 inch from the edges of the paper.\footnote{
	The \texttt{turabian-thesis} document class has an additional binding offset of 0.5 inches, effectively creating a left/inside margin of 1\nicefrac{1}{2} inches. The binding offset can be adjusted through the \texttt{geometry} package by using the \texttt{bindingoffset} option of the \texttt{\textbackslash geometry} command.}
To make changes to the page layout, use of the \texttt{geometry} package is recommended.

Headers and footers, by default, are placed inside the margins. The top of the header is 0.5 inches from the top of the page. The baseline of the footer is 0.5 inches from the bottom edge of the page. (Refer to section~\ref{sec:page_styles} for typesetting headers and footers.)

\marginnote{emptymargins}%
The \texttt{emptymargins} option removes headers and footers from within the margin and, instead, places them within the space normally used for the body text. As such, the page margins are empty of all text.

Using the \texttt{emptymargins} option, however, reduces the text height (\texttt{textheight}) by 0.5 inches when a header or footer is placed on the page. Because some pages within a document will have headers, and others footers, the \texttt{emptymargins} option allows for pages to have either a header or a footer on a page---although not both on the same page. Empty pages have neither a header nor a footer (refer to section~\ref{sec:page_styles}).


\subsection{Ragged Right (Left Align) Text}

\marginnote{raggedright}%
By default, text consisting of more than one line is justified on both sides of the document with the last line flush left. Turabian, however, recommends setting ``your word processor to align text flush left with a ragged right margin" while also not using its ``automated hyphenation feature" \autocite[404]{turabian_manual_2013}. For ragged right formatting without hyphenations throughout the work, use the \texttt{raggedright} formatting option.


\subsection{Support for Endnotes}

Endnotes can be used instead of footnotes by loading the \texttt{endnotes} package in the \LaTeX{} document source preamble.\footnote{%
	When using the \texttt{endnotes} package, cite keys must not contain an underscore character, ``\texttt{\_}".}

\marginnote{endnotes}%
Formatting support for the \texttt{endnotes} package can be enabled using the \texttt{endnotes} option. With the \texttt{endnotes} option, footnotes are restarted on each page and labelled using symbols in the sequence of: * $\dagger$ $\ddagger$ $\S$ \autocite[156]{turabian_manual_2013}. More so, each endnote is single-spaced with a ``blank line between notes." The list of endnotes is labelled \emph{Notes}.\footnote{%
	The \emph{Notes} heading is typeset using either \texttt{\textbackslash chapter*} or \texttt{\textbackslash section*}, depending upon the document class.}
Numbering of endnotes is also restarted for each chapter with subheadings dividing the list by each chapter \autocite[157]{turabian_manual_2013}.

To place the \emph{Notes} list, use the \texttt{\textbackslash theendnotes} command provided by the \texttt{endnotes} package.


\subsection{Adjusting Bibliography Formatting}

For citations, this package is designed to work well with the \texttt{biblatex-chicago} package. This includes support for both the Notes-Bibliography and Author-Date styles (the former being the default style).\footnote{%
	To maintain this support if \texttt{turabian-formatting} is loaded as a package, the package should always be loaded \emph{before} loading the \texttt{biblatex-chicago} package. If \texttt{biblatex-chicago} is loaded, the following options are passed to it: \texttt{isbn=false}, \texttt{autolang=other}, \texttt{footmarkoff}, and \texttt{backend=biber}. If the \texttt{endnotes} option is enabled for \texttt{turabian-formatting}, then \texttt{notetype=endonly} is also passed to the \texttt{biblatex-chicago} package.}

\marginnote{noadjustbib}%
Formatting support that adjusts the Bibliography, generated by \texttt{biblatex-chicago}, can be disabled using the \texttt{nodajustbib} formatting option. This option is only available when loading \texttt{turabian-formatting} as a package. The following code is affected by this option:

\begin{lstlisting}
	\AtBeginBibliography{\vspace*{-0.333\baselineskip}}
	\renewcommand{\bibsetup}{\singlespacing}
	\renewcommand{\bibitemsep}{1\baselineskip}
	\renewcommand{\bibhang}{0.5in}
\end{lstlisting}



\section{Formatting Commands}
\label{sec:formatting_commands}


\subsection{Headings: Chapters, Sections, and Subsections}

The \texttt{turabian-formatting} package provides support for document classes that allow text to be divided into sections and subsections. This package also provides support for document classes that define \texttt{\textbackslash chapter} and \texttt{\textbackslash chapter*}, including the \texttt{report}, \texttt{book}, and \texttt{turabian-thesis} document classes.

\subsubsection*{Chapters}

\marginnote{\textbackslash chapter}
The \texttt{\textbackslash chapter} command starts a new page and creates a \emph{Chapter} label ``followed by the chapter number at the top of the page" in arabic numerals. The ``descriptive title" of the chapter is placed ``two lines down, following a blank line" and is separated from the first line of following text by ``two blank lines" \autocite[391]{turabian_manual_2013}.

\marginnote{\textbackslash chapter*}
\texttt{\textbackslash chapter*}, unlike \texttt{\textbackslash chapter}, does not provide a line with a \emph{Chapter} label and numbering nor is it included in the Table of Contents.\footnote{%
	To add a numberless ``chapter" to the Table of Contents, use the \texttt{\textbackslash addcontentsline} command immediately following the \texttt{\textbackslash chapter*} command. For the \emph{Bibliography} or \emph{References} heading from \texttt{\textbackslash printbibliography} (from the \texttt{biblatex-chicago} package), place this command immediately \emph{after} the use of the \texttt{\textbackslash clearpage} and \texttt{\textbackslash addcontentsline} commands. The same applies to the \texttt{\textbackslash theendnotes} command from the \texttt{endnotes} package.}
This is useful for the titles/headings of specific elements, including the \emph{Introduction} \autocite[390]{turabian_manual_2013}, \emph{Abstract} \autocite[389]{turabian_manual_2013}, \emph{Conclusion} \autocite[398]{turabian_manual_2013}, \emph{Appendixes} \autocite[398]{turabian_manual_2013}, \emph{Notes} \autocite[399]{turabian_manual_2013}, and \emph{Bibliography} \autocite[401]{turabian_manual_2013}.

\subsubsection*{Sections and Subsections}

\marginnote{\textbackslash section\newline \textbackslash subsection\newline \textbackslash subsubsection}
This package provides support for three levels of sections and subsections: \texttt{\textbackslash section}, \texttt{\textbackslash subsection}, and \texttt{\textbackslash subsubsection} (including their asterisked versions). These section and subsection commands do not provide any label or numbering.

\texttt{\textbackslash section} places ``more space before a subhead than after (up to two blank lines before and one line, or double line spacing, after)" \autocite[393]{turabian_manual_2013}.

\marginnote{\textbackslash section*}
If the document class does not define chapter headings, \texttt{\textbackslash section*} will instead provide two blank lines between the title/subheading and the first line of text. This is particularly useful for the subheadings of specific elements, including the \emph{Introduction} \autocite[390]{turabian_manual_2013}, \emph{Notes} \autocite[399]{turabian_manual_2013}, and \emph{Bibliography} \autocite[401]{turabian_manual_2013}.


\subsection{Page Styles: Headers and Footers}
\label{sec:page_styles}

\marginnote{\textbackslash pagestyle\newline \textbackslash thispagestyle}
Headers and footers are determined by the specific page styles. They are used with the \texttt{\textbackslash pagestyle} and \texttt{\textbackslash thispagestyle} commands.

\textbf{\texttt{empty}}: An empty page style with no header or footer.

\textbf{\texttt{plain}}: A ``plain" page style that centres the page number in the footer. For a thesis or dissertation, it applies to pages with page numbers in the front matter as well as the first page of each chapter in the main matter and back matter (refer to subsection~\ref{subsec:td_structure}).

\textbf{\texttt{headings}}: The default page style places a page number in the right-hand corner of the header.

The \texttt{fancyhdr} package can be used to typset (and adjust) these page styles. This includes placing optional text (such as a page identifier) in the header and/or footer \autocite[374]{turabian_manual_2013}.


\subsection{Document Structure for Thesis/Dissertation}
\label{subsec:td_structure}
A thesis/dissertation is divided into three, distinct components: (1) front matter, (2) main matter or text of the paper, and (3) back matter \autocite[375]{turabian_manual_2013}. As such, this package provides support for document classes that use the \texttt{\textbackslash frontmatter}, \texttt{\textbackslash mainmatter}, and \texttt{\textbackslash backmatter} commands (such as the \texttt{book} and \texttt{turabian-thesis} document classes).

\subsubsection*{Front Matter}

\marginnote{\textbackslash frontmatter}
The front matter is declared with the \texttt{\textbackslash frontmatter} command. By default, the \texttt{\textbackslash pagestyle} is set to \texttt{empty} (refer to section~\ref{sec:page_styles}). The numbering of pages in the front matter begins with the title page, although page numbers are not placed on pages until the Table of Contents \autocite[373--374, 376, 380]{turabian_manual_2013}.

Placing the \texttt{\textbackslash tableofcontents} command in the front matter will cause page numbers to appear on pages with the Table of Contents and subsequent pages of the front matter. These page numbers use roman numerals and are placed in centre of the footer \autocite[373--374]{turabian_manual_2013} using the \texttt{plain} page style (refer to section~\ref{sec:page_styles}).

\subsubsection*{Main Matter}

\marginnote{\textbackslash mainmatter}
The main matter (or text of the paper) begins with the \texttt{\textbackslash mainmatter} command. Page numbering restarts with arabic numerals, starting with page 1. Page numbers are placed on the right-side of the header, using the \texttt{headings} page style (with the exception of the first page of each chapter, which instead use the \texttt{plain} page style) \autocite[373--374]{turabian_manual_2013}.

\subsubsection*{Back Matter}

\marginnote{\textbackslash backmatter}
The back matter is declared using the \texttt{\textbackslash backmatter} command. Page numbering and page styles are continued from the main matter \autocite[373--374]{turabian_manual_2013}.


\subsection{Title Page}
\label{subsec:titlepage}

\marginnote{\textbackslash maketitle}%
The \texttt{\textbackslash maketitle} command will create a separate title page if the document class specifies (or has as default) the \texttt{titlepage} option---the default document class option for both \texttt{turabian-researchpaper} and \texttt{turabian-thesis}.

The \texttt{turabian-researchpaper} document class produces a title page intended for research papers. Page numbering begins immediately following the title page.

\marginnote{\textbackslash title\newline \textbackslash subtitle\newline \textbackslash author\newline \textbackslash date\newline \textbackslash course\newline \textbackslash institution}
\texttt{\textbackslash maketitle} uses information specified in the source document preamble, through the following commands (each of which is self-evident): \texttt{\textbackslash title}, \texttt{\textbackslash author}, \texttt{\textbackslash date}, \texttt{\textbackslash subtitle}, \texttt{\textbackslash course}, and \texttt{\textbackslash institution}.

The \texttt{turabian-thesis} document class provides a ``model" title page intended for a thesis or dissertation---a title page different than one intended for a research paper. The title page of a thesis/dissertation is included in the page numbering of the front matter \autocite[376, 378]{turabian_manual_2013}.\footnote{%
	When \texttt{turabian-formatting} is loaded as a package, the default title page created is for that of a research paper. The ``model" title page for theses/dissertations is only available to the \texttt{turabian-thesis} document class.}

\marginnote{\textbackslash faculty\newline \textbackslash mydegree\newline \textbackslash department\newline \textbackslash location}
The following commands are available only with a title page for \texttt{turabian-thesis}: \texttt{\textbackslash faculty}, \texttt{\textbackslash mydegree}, \texttt{\textbackslash department}, and \texttt{\textbackslash location}.

To create a custom title page, however, use the \texttt{titlepage} environment.


\subsection{Table Footnotes}

A table is described as having four kinds of footnotes: ``(1) source lines \dots, (2) general footnotes that apply to the whole table, (3) footnotes that apply to specific parts of the table, and (4) notes on levels of statistical significance" \autocite[366]{turabian_manual_2013}.

\marginnote{\textbackslash tablenote}%
The optional \texttt{\textbackslash tablenote} command provides formatting for each table footnote. It can be repeatedly used for each footnote accompanying a table.\footnote{A footnote mark for specific parts, however, is \emph{not} generated by the \texttt{\textbackslash tablenote} command. This must either be done manually or through the use of another package.}

For each table, \texttt{\textbackslash tablenote} must be located inside the \texttt{table} environment, after the table itself.

The following is an example accompanying the use of the \texttt{tabular} environment:
\begin{lstlisting}
	\begin{table}
		...
		\end{tabular}
		\footnotesize
		\tablenote{\emph{Source:} Citation for the table.}
		\tablenote{\emph{Note:} A note related to the table.}
		...
	\end{table}
\end{lstlisting}



\section{Required and Recommended Packages}
\label{sec:required_packages}

This package requires \LaTeX{}2e and makes use of the following packages installed as part of a standard \LaTeX{} distribution: \texttt{setspace}, \texttt{xifthen}, \texttt{etoolbox}, \texttt{geometry}, \texttt{nowidow}, \texttt{footmisc}, \texttt{fancyhdr}, \texttt{titlesec}, \texttt{quoting}, \texttt{flafter}, \texttt{caption}, \texttt{endnotes}, \texttt{url}, \texttt{chngcntr}, and \texttt{xparse}.

The following packages are highly recommended: \texttt{biblatex-chicago} and \texttt{ellipsis}.

The \texttt{emptypage} package is also helpful in making empty pages without header and footers when using the \texttt{twoside} document class option.



\section{Updates}
\label{sec:updates}

\marginnote{\rmfamily{\versionDateText}}%

Added support for the \texttt{endnotes} package. An \texttt{endnotes} option has been added, removing the need for an \texttt{endnotesonly} option for \texttt{turabian-researchpaper}.

Improved support for the \texttt{biblatex-chicago} package, including added support for the Author-Date citation style.

Footnote lines are no longer forced together, allowing a footnote to run over to the next page.

Adjustments to the spacing that follow the \texttt{\textbackslash chapter*} and \texttt{\textbackslash section*} commands.

Updated use of page style options, removing the \texttt{fancy} page style.

\texttt{\textbackslash frontmatter} and \texttt{\textbackslash tableofcontents} no longer ignore the \texttt{bindingoffset} value and margin sizes specified in the source document preamble, through the \texttt{geometry} package.

Improved implementation of the \texttt{raggedright} formatting option with: (1) table and figure captions; and (2) the \texttt{\textbackslash tablenote} command.

Adjustments to the behaviour of table and figure positioning.

Deprecated commands: \texttt{\textbackslash setwordcount}, \texttt{\textbackslash setpageidentifier}, and \texttt{\textbackslash tablesource}.

Removed commands: 
\texttt{\textbackslash mytitlepage}, and \texttt{\textbackslash setdraftindicator}.

\marginnote{\rmfamily{2014/12/27}}%
Formatting changes to both subsection titles and title page for both research papers and theses/dissertations.

\marginnote{\rmfamily{2014/12/10}}%
Adjustments to formatting that more-accurately reflect the 8th edition of Turabian's \emph{A Manual for Writers of Research Papers, Theses, and Dissertations}.



\section{Known Bugs}
\label{sec:bugs}

The \texttt{endnotes} option generates an error if a cite key contains an underscore character (\texttt{\_}) when used with the \texttt{biblatex-chicago} package.

Table captions, when the table is positioned at the top of a page, will have an additional vertical space of \texttt{0.5\textbackslash baselineskip} between the caption text and the top margin.

Using the \texttt{geometry} package's \texttt{showframe} formatting option with the \texttt{emptymargins} formatting option, when making adjustments to the header and/or footer of the \texttt{plain} page style, will not render properly.



\printbibliography



\clearpage

\section*{Appendix: Sample Code for a Research Paper}
\label{sec:sample_code}
\addcontentsline{toc}{section}{Appendix: Sample Code for a Research Paper}

The following is for a research paper using the \LaTeX{} markup language.
\vspace{1.3\baselineskip}

\begin{lstlisting}
\documentclass{turabian-researchpaper}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{csquotes, ellipsis}

\usepackage{biblatex-chicago}
\addbibresource{mybibfile.bib}

\title{An Interesting Work}
\author{Author's Name}
\date{\today}


\begin{document}

\maketitle

\section{Introduction}
Amazing, introductory ideas that provide unique insight into your field of interest and ``wows" your professor.

\section{An Interesting Section}
Great thoughts that further your argument. This includes lots of strong evidence presented throughout several paragraphs, each accompanied by necessary citations.\autocite[8]{authortitle2013}

\section{Another Insightful Section}
More ideas that really make this a great paper. Maybe a footnote or two.\footnote{Some peripheral thoughts.}

\section{Conclusions}
At this point, you've changed everything (including your marks!). Time to wrap up!

\clearpage
\printbibliography[title=Bibliography]

\end{document}
\end{lstlisting}



\end{document}