% 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 this README file).
%
% ==============================
% Last updated: 2014/12/27
%
% Corresponding package items:
%	2014/12/27 Turabian Formatting
%	2014/12/27 Turabian Research Paper
%	2014/12/27 Turabian Theses and Dissertations
%


\documentclass{article}

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

\usepackage{csquotes, units, metalogo}

\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}

\usepackage{setspace}

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


\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 (ie. 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 provides optional support for David Fussner's outstanding (and highly-recommended) \texttt{biblatex-chicago}.



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

To format a document with this package, one can load the \texttt{turabian-formatting} package in the \LaTeX{} source file preamble. Alternatively, the document class can be specified as either a research paper (\texttt{turabian-researchpaper}) or a thesis/dissertation (\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:\footnote{
	The \texttt{turabian-formatting} package has been tested with the standard \texttt{article}, \texttt{report}, and \texttt{book} \LaTeX{} document classes.}
\begin{lstlisting}
	\usepackage{turabian-formatting}
\end{lstlisting}

\underline{Important note}: The \texttt{turabian-formatting} package should always be loaded \emph{before} loading the \texttt{biblatex-chicago} package.

\newpage
\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.


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

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

The default page size, for both document classes, is 8\nicefrac{1}{2} × 11 inches (US Letter size). The normal font size is 12pt.

As with other standard \LaTeX{} document classes, different paper sizes and font sizes can be specified as class options. For example:
\begin{lstlisting}
	\documentclass[11pt,a4paper]{turabian-researchpaper}
\end{lstlisting}

\marginnote{draft}%
The standard \texttt{draft} mode is also available as an option. As part of this mode, text indicating the work is draft is also placed in the header (refer to subsection~\ref{subsec:draft_indicator}).


\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 also has an additional binding offset of 0.5 inches on the left, effectively creating a left margin of 1\nicefrac{1}{2} inches.}
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. Headers and footers are typset with the \texttt{fancyhdr} package (refer to section~\ref{sec:page_styles}).

\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.

\underline{Important Note}: Using the \texttt{emptymargins} option, however, reduces the height of the text (\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---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."\footnote{Kate L. Turabian, \emph{A Manual for Writers of Research Papers, Theses, and Dissertations: Chicago Style for Students and Researchers}, 8th ed. (University of Chicago Press, 2013), 404.} For ragged right formatting without hyphenations throughout the work, use the \texttt{raggedright} formatting option.


\subsection{Adjustments to \texttt{biblatex-chicago} Formatting}

\marginnote{noadjustbib}%
Reformatting support for \texttt{biblatex-chicago} can be disabled using the \texttt{nodajustbib} formatting option. This affects adjustments to the formatting of footnotes and endnotes, as well as changes to both the headings and spacing in the bibliography.

\newpage
\subsection{Using Endnotes with Research Papers}

\marginnote{endnotesonly}%
For research papers, endnotes can be used instead of footnotes. The \texttt{endnotesonly} option is only available for the \texttt{turabian-researchpaper} document class.\footnote{%
	Cite keys must not contain an underscore character, ``\texttt{\_}". Refer to section~\ref{sec:bugs}.}


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

\subsection{Page Identifier}
\label{subsec:page_identifier}

\marginnote{\textbackslash setpageidentifier}%
Optional text (a page identifier) can be placed in the header.\footnote{%
	Turabian, 374.}
This text is specified using the \texttt{\textbackslash setpageidentifier} command in the preamble of the \LaTeX{} source file.

\begin{lstlisting}
	\setpageidentifier[<horizontal space length>]{<Text>}
\end{lstlisting}

The default horizontal space, before the page number, is 3ex. This command applies to pages that use either the default \texttt{fancy} page style or the \texttt{headings} page style (refer to section~\ref{sec:page_styles}).


\subsection{Draft Indicator}
\label{subsec:draft_indicator}

\marginnote{\textbackslash setdraftindicator}%
When the \texttt{draft} option has been specified, text indicating the draft status is placed on pages throughout document. This text can be changed in the preamble of the \LaTeX{} source file when using the \texttt{\textbackslash setdraftindicator} command:

\begin{lstlisting}
	\setdraftindicator{<Text>}
\end{lstlisting}

Default text example:

\hspace{0.5in}Draft (\today)

Text indicating the draft status of the document is only found on pages that use either the default \texttt{fancy} page style or the \texttt{headings} page style (refer to section~\ref{sec:page_styles}).


\newpage
\subsection{Title Page}

\marginnote{\textbackslash maketitle}%
To create a title page, you can use the standard \texttt{\textbackslash maketitle} command along with \texttt{\textbackslash title}, \texttt{\textbackslash author}, and \texttt{\textbackslash date}.\footnote{%
	By default, a separate title page is created with the \texttt{\textbackslash maketitle} command. This default behaviour can be disabled when a \texttt{notitlepage} option is specified when loading \texttt{turabian-formatting} as a package. This option, however, is not available for either the \texttt{turabian-researchpaper} or \texttt{turabian-thesis} document classes.}

Both \texttt{formatting-turabian} and \texttt{turabian-researchpaper}, by default, produce a title page intended for research papers. Page numbering begins immediately following the title page.

The following optional commands are also available for use with the title page (each of which are self-evident): \texttt{\textbackslash subtitle}, \texttt{\textbackslash course}, and \texttt{\textbackslash institution}.


\marginnote{\textbackslash setwordcount}%
The optional \texttt{\textbackslash setwordcount} command inserts text at the bottom right of the title page---text intended for an optional word count sometimes required in the submission of research papers.

\marginnote{\textbackslash mytitlepage}%
To implement a custom title page, renew the optional \texttt{\textbackslash mytitlepage} command with your text written with \LaTeX{}. This can include reference to another \texttt{.tex} file. For example:

\begin{lstlisting}
	\renewcommand{\mytitlepage}{%
		Custom title page content
	}
\end{lstlisting}


\subsubsection{Thesis/Dissertation Title Page}
\label{subsubsec:td_titlepage}
The \texttt{turabian-thesis} document class provides a title page intended for a thesis or dissertation. In addition to the commands noted above, this document class provides commands that can be placed in the header. This includes: \texttt{\textbackslash faculty}, \texttt{\textbackslash mydegree}, \texttt{\textbackslash department}, and \texttt{\textbackslash location}.

Unlike research papers, the title page of a thesis or dissertation is included in the front matter, as page i (although the page number is not placed on the page itself).\footnote{Turabian, 376.}


\subsection{Captions and Table Footnotes}

Captions, for both figures and tables, are implemented using (and can be altered through) the \texttt{caption} package.

A table, Turabian describes, can also have 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."\footnote{Turabian, 366.}

\marginnote{\textbackslash tablesource}%
The optional \texttt{\textbackslash tablesource} command creates a source line to cite the source material of the table.\footnote{Ibid., 360--361.}

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

For each table, both \texttt{\textbackslash tablesource} and \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
		\tablesource{\emph{Source:} Citation for the table.}
		\tablenote{Note related to the table.}
		\tablenote{Another note.}
		...
	\end{table}
\end{lstlisting}


\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.\footnote{Turabian, 375.}

\marginnote{\textbackslash frontmatter}%
The front matter is declared with the \texttt{\textbackslash frontmatter} command. Page headers and footers are empty using the \texttt{empty} page style (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.\footnote{Turabian, 373--374, 376, 380.}

\marginnote{\textbackslash tableofcontents}%
The \texttt{\textbackslash tableofcontents} command is used to place the table of contents in the front matter. With the use of this command, page numbering appears on pages with the table of contents and subsequent pages of the front matter. Page numbers use roman numerals and are placed in centre of the footer using the \texttt{plain} page style (refer to section~\ref{sec:page_styles}).\footnote{Ibid., 373--374.}

\marginnote{\textbackslash mainmatter}%
The main matter (or text of the paper) begins with the \texttt{\textbackslash mainmatter} command. Page numbering restarts with arabic numerals, beginning 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, instead using the \texttt{plain} page style).\footnote{Ibid.}

\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.\footnote{Ibid.}



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

Headers and footers are typset (and can be adjusted) using the page styles produced by the \texttt{fancyhdr} package. The following are used with both \texttt{\textbackslash pagestyle} and \texttt{\textbackslash thispagestyle} commands.

\textbf{\texttt{fancy}}: The default page style places a page number in the right-hand corner of the header. A page identifier and/or draft indicator can also be added to the header (refer to subsections~\ref{subsec:page_identifier} and~\ref{subsec:draft_indicator}).

\textbf{\texttt{empty}}: An empty page style with no headers or footers. Neither a page identifier nor draft indicator is placed in either the 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}). Neither a page identifier nor draft indicator is placed in either the header or footer.

\textbf{\texttt{headings}}: Places a page number in the right corner of the header (the default style is identical to \texttt{fancy}). And as with \texttt{fancy}, a page identifier and/or draft indicator can also be added to the header.



\section{Required 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{url}, \texttt{footmisc}, \texttt{fancyhdr}, \texttt{titlesec}, \texttt{quoting}, \texttt{flafter}, and \texttt{caption}.



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

\marginnote{\rmfamily{2014/12/27}}%
Improved documentation as well as adjustments to both subsection titles and title page formatting for both research papers and theses/dissertations.

\marginnote{\rmfamily{2014/12/10}}%
Update to formatting and documentation based on the 8th edition of Turabian's \emph{A Manual for Writers of Research Papers, Theses, and Dissertations}.



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

\marginnote{\rmfamily{2014/12/07}}%
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.

\marginnote{\rmfamily{2014/12/07}}%
The \texttt{endnotesonly} option generates an error if a cite key contains an underscore character, ``\texttt{\_}", when used with the \texttt{biblatex-chicago} package.



\newpage

\section{Sample Code}
\label{sec:sample_code}

\subsection*{Sample 1: A Research Paper with \LaTeX{}}
Creating a research paper using \LaTeX{} and the \texttt{turabian-researchpaper} document class.

\LaTeX{} code:

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

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

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

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

	\begin{document}
		\maketitle
		...
		\printbibliography	
	\end{document}
\end{lstlisting}

\newpage
\subsection*{Sample 2: A Research Paper with \XeLaTeX}
Creating a research paper using \XeLaTeX{} and the \texttt{turabian-researchpaper} document class.

\XeLaTeX{} code:

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

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

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

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

	\begin{document}
		\maketitle
		...
		\printbibliography	
	\end{document}
\end{lstlisting}

\newpage
\subsection*{Sample 3: A Research Paper with \XeLaTeX{}}
An alternative way to create a research paper using \XeLaTeX{}, the \texttt{article} document class, and the \texttt{turabian-formatting} package.

The \texttt{emptymargins} formatting option, from the \texttt{turabian-formatting} package, is specified (refer to subsection~\ref{subsec:pagelayout_emptymargins}).

The main font, using the \texttt{fontspec} package, is set to Times New Roman.

\XeLaTeX{} code:

\begin{lstlisting}
	\documentclass[12pt]{article}

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

	\usepackage[emptymargins]{turabian-formatting}

	\setmainfont{Times New Roman}

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

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

	\begin{document}
		\maketitle
		...
		\printbibliography	
	\end{document}
\end{lstlisting}


\end{document}