From fe69d26208d4c6d160b2c279e1ed27b6805e2a39 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Fri, 20 Mar 2020 21:27:47 +0000
Subject: turabian-formatting (20mar20)

git-svn-id: svn://tug.org/texlive/trunk@54436 c570f23f-e606-0410-a88d-b1316a301751
---
 .../turabian-formatting/turabian-formatting.sty    | 171 ++++++++++++---------
 1 file changed, 99 insertions(+), 72 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/turabian-formatting/turabian-formatting.sty')

diff --git a/Master/texmf-dist/tex/latex/turabian-formatting/turabian-formatting.sty b/Master/texmf-dist/tex/latex/turabian-formatting/turabian-formatting.sty
index fad71334e83..b2e56dccda7 100644
--- a/Master/texmf-dist/tex/latex/turabian-formatting/turabian-formatting.sty
+++ b/Master/texmf-dist/tex/latex/turabian-formatting/turabian-formatting.sty
@@ -4,7 +4,7 @@
 % and Dissertations," 9th edition.
 %
 % ==============================
-% Copyright 2013-2018 Omar Abdool
+% Copyright 2013-2020 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
@@ -27,7 +27,7 @@
 
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{turabian-formatting}[2018/08/01 Turabian Formatting]
+\ProvidesPackage{turabian-formatting}[2020/03/19 Turabian Formatting]
 
 
 % Package options: flags and variables
@@ -74,13 +74,12 @@
 
 \setlength\footskip{0.5in}
 
-% Text spacing is double spaced
+% Text spacing is double-spaced
 \RequirePackage{setspace}
 \setstretch{2}
 
 
-% Preserve normalsize and footnotesize single spacing baselineskip values
-
+% Preserve normalsize and footnotesize single-spacing baselineskip values
 \newlength\tf@singlelineskip
 \newlength\tf@fnsinglelineskip
 
@@ -143,13 +142,12 @@
 
 % Footnotes: readjust footnote rule size and placement
 \renewcommand{\footnoterule}{%
-	\vspace*{-3pt}
-	\hrule width 2in height 0.4pt
-	\vspace*{-4pt}}
+	\kern-3\p@
+	\hrule \@width 2in height 0.4\p@
+	\kern-4\p@}
 
-% Footnotes: make command to set footnote punctuation
-\newcommand{\tf@setfnpunct}[1]{\def\tf@thefnpunct{#1\,\,}}
-\tf@setfnpunct{.}
+% Footnotes: set default footnote punctuation
+\def\tf@thefnpunct{.\,\,}
 
 % Footnotes: renew command for typesetting footnotes
 \renewcommand{\@makefntext}[1]{%
@@ -163,8 +161,8 @@
 \def\ps@headings{%
 	\let\@oddfoot\@empty
 	\let\@evenfoot\@empty
-	\def\@evenhead{\thepage\hfil\slshape\leftmark}
-	\def\@oddhead{{\slshape\rightmark}\hfil\thepage}
+	\def\@evenhead{\thepage}
+	\def\@oddhead{\hfil\thepage}
 	\let\@mkboth\@gobbletwo
 	\let\markboth\@mkboth
 	\let\chaptermark\@gobble
@@ -192,8 +190,10 @@
 % Set top section command name to "section" (default)
 \def\tf@topsecname{section}
 
-% Set adjustment for baselineskip after \section and \section* headings
-\def\tf@adjaftersec{\dimexpr \baselineskip -\tf@singlelineskip -\p@ \relax}
+% Redefine \@afterheading to adjust for baselineskip after headings
+\def\tf@adjaftersec{\dimexpr \baselineskip -\tf@singlelineskip \relax}
+\let\tf@tempafterheading\@afterheading
+\def\@afterheading{\vskip -\tf@adjaftersec\relax \tf@tempafterheading}
 
 % Headings formatting: \section, \subsection, and \subsubsection
 \setcounter{secnumdepth}{0}
@@ -201,47 +201,96 @@
 \renewcommand{\section}{%
 	\@startsection{section}{1}%
 		{\z@}%
-		{-\tf@singlelineskip}%
+		{2\tf@singlelineskip}%
 		{\tf@singlelineskip}%
-		{\normalfont\bfseries\normalsize\singlespacing\centering}}
+		{\normalfont\bfseries\normalsize\centering}}
 
 \renewcommand{\subsection}{%
 	\@startsection{subsection}{2}%
 		{\z@}%
-		{-\tf@singlelineskip}%
+		{2\tf@singlelineskip}%
 		{\tf@singlelineskip}%
-		{\normalfont\mdseries\normalsize\singlespacing\centering}}
+		{\normalfont\mdseries\normalsize\centering}}
 
 \renewcommand{\subsubsection}{%
 	\@startsection{subsubsection}{3}%
 		{\z@}%
-		{-\tf@singlelineskip}%
+		{2\tf@singlelineskip}%
 		{\tf@singlelineskip}%
-		{\normalfont\bfseries\normalsize\singlespacing\raggedright}}
+		{\normalfont\bfseries\normalsize\raggedright}}
 
-% Headings formatting: following paragraphs start with an indent
-\def\tf@afterindent{\@afterindenttrue}
+% Sections: section heading formatting
+\def\tf@makesectionhead#1#2#3#4#5{%
+	\vskip -\tf@singlelineskip\relax
+	\begingroup
+		\singlespacing
+		#4{%
+			\@hangfrom{\hskip #3\relax\@svsec}%
+			\interlinepenalty \@M #5\@@par}%
+	\endgroup}
+
+% Sections: formatting of TOC \addcontentsline
+\def\tf@tocline#1#2{\protect{\csname the#1\endcsname\quad}}
+
+% Sections: redefine \@sect to use \tf@makesectionhead and \tf@tocline
+\def\@sect#1#2#3#4#5#6[#7]#8{%
+	\ifnum #2>\c@secnumdepth
+		\let\@svsec\@empty
+	\else
+		\refstepcounter{#1}%
+		\protected@edef\@svsec{\@seccntformat{#1}\relax}%
+	\fi
+	\@tempskipa #5\relax
+	\ifdim \@tempskipa>\z@
+		\tf@makesectionhead{#1}{#2}{#3}{#6}{#8}
+		\csname #1mark\endcsname{#7}%
+		\addcontentsline{toc}{#1}{%
+			\ifnum #2>\c@secnumdepth \else \tf@tocline{#1}{#2} \fi #7}%
+	\else
+		\def\@svsechd{%
+			#6{\hskip #3\relax \@svsec #8}%
+			\csname #1mark\endcsname{#7}%
+			\addcontentsline{toc}{#1}{%
+				\ifnum #2>\c@secnumdepth \else \tf@tocline{#1}{#2} \fi #7}}%
+	\fi
+	\@xsect{#5}}
+
+% Sections: redefine \@ssect
+\def\@ssect#1#2#3#4#5{%
+	\@tempskipa #3\relax
+	\ifdim \@tempskipa>\z@
+		\vskip -\tf@singlelineskip\relax
+		\begingroup
+			\singlespacing
+			#4{%
+				\@hangfrom{\hskip #1}%
+				\interlinepenalty \@M #5\@@par}%
+		\endgroup
+	\else
+		\def\@svsechd{#4{\hskip #1\relax #5}}%
+	\fi
+	\@xsect{#3}}
 
 
-% Table of Contents: renew formatting
+% Table of Contents: set adjustment for baselineskip after toc heading
+\def\tf@adjaftersectoc{%
+	\vspace{\dimexpr \baselineskip -3\tf@singlelineskip \relax}}
 
-\def\tf@tocpagestyle{\@empty}
+% Table of Contents: \@starttoc formatting hook
+\def\tf@starttocformat{\singlespacing}
 
 \renewcommand{\tableofcontents}{%
-	\tf@tocpagestyle
 	\expandafter\csname \tf@topsecname\endcsname*{\contentsname}%
-	\@mkboth{\contentsname}{\contentsname}%
+	\@mkboth{}{}%
 	\if@optraggedright
 		\let\tf@tocrmarg\@tocrmarg
 		\def\@tocrmarg{\tf@tocrmarg plus1fil}
 	\fi
-	{	\vspace{\dimexpr -3\tf@singlelineskip +1\baselineskip \relax}%
-		\singlespacing
-		\@starttoc{toc}}}%
+	\tf@adjaftersectoc
+	{\tf@starttocformat\@starttoc{toc}}}%
 
 
 % List of Figures and List of Tables: adjust titles
-
 \renewcommand{\listfigurename}{Figures}
 \renewcommand{\listtablename}{Tables}
 
@@ -262,20 +311,18 @@
 % List of Figures
 \renewcommand{\listoffigures}{%
 	\expandafter\csname \tf@topsecname\endcsname*{\listfigurename}%
-	\@mkboth{\listfigurename}{\listfigurename}%
+	\@mkboth{}{}%
 	\addcontentsline{toc}{\tf@topsecname}{\listfigurename}%
-	{	\vspace{\dimexpr -3\tf@singlelineskip +1\baselineskip \relax}%
-		\singlespacing
-		\@starttoc{lof}}}
+	\tf@adjaftersectoc
+	{\tf@starttocformat\@starttoc{lof}}}
 
 % List of Tables
 \renewcommand{\listoftables}{%
 	\expandafter\csname \tf@topsecname\endcsname*{\listtablename}%
-	\@mkboth{\listtablename}{\listtablename}%
+	\@mkboth{}{}%
 	\addcontentsline{toc}{\tf@topsecname}{\listtablename}%
-	{	\vspace{\dimexpr -3\tf@singlelineskip +1\baselineskip \relax}%
-		\singlespacing
-		\@starttoc{lot}}}
+	\tf@adjaftersectoc
+	{\tf@starttocformat\@starttoc{lot}}}
 
 % List of Illustrations
 \newcommand{\listillustrationname}{Illustrations}
@@ -283,10 +330,10 @@
 
 \newcommand{\listofillustrations}{%
 	\expandafter\csname \tf@topsecname\endcsname*{\listillustrationname}%
-	\@mkboth{\listillustrationname}{\listillustrationname}%
+	\@mkboth{}{}%
 	\addcontentsline{toc}{\tf@topsecname}{\listillustrationname}%
-	{	\vspace{\dimexpr -3\tf@singlelineskip +1\baselineskip \relax}%
-		\singlespacing
+	\tf@adjaftersectoc
+	{	\tf@starttocformat
 		{\tf@illustrsection Figures}\par\nopagebreak
 		\@starttoc{lof}
 		\vspace{\tf@singlelineskip}
@@ -295,7 +342,6 @@
 
 
 % Figures and Tables: float positioning
-
 \setlength\textfloatsep{%
 	\dimexpr 2\tf@singlelineskip +\p@ \relax minus 1\tf@singlelineskip}
 \setlength\floatsep{%
@@ -307,7 +353,6 @@
 \def\fps@figure{!htb}
 
 % Figures and Tables: caption formatting
-
 \setlength\abovecaptionskip{\z@}
 \setlength\belowcaptionskip{\z@}
 
@@ -317,7 +362,6 @@
 	\small#1. #2\par
 	\vskip\belowcaptionskip}
 
-
 % Lists: enumerate and itemize formatting
 \setlength\leftmargini{1.5\parindent}
 \setlength\leftmargin{\leftmargini}
@@ -391,7 +435,6 @@
 
 
 % thebibliography environment: formatting (adjust \@openbib@code hook default)
-
 \setlength\bibindent{\parindent}
 
 \renewcommand\@openbib@code{%
@@ -422,52 +465,36 @@
 					\DefineBibliographyStrings{english}{%
 						references = {Bibliography}}
 				\fi
-				\renewcommand{\bibsetup}{%
-					\addcontentsline{toc}{\tf@topsecname}{\bibname}
-					\vspace{\dimexpr -2\tf@singlelineskip +1\baselineskip \relax}%
-					\singlespacing%
-					\def\tf@adjaftersec{\dimexpr \tf@singlelineskip -\p@ \relax}}
-				\renewcommand{\bibitemsep}{1\baselineskip}
+				\renewcommand{\bibitemsep}{\tf@singlelineskip}
 				\renewcommand{\bibhang}{0.5in}
+				\renewcommand{\bibsetup}{%
+					\vskip \tf@adjaftersec\relax
+					\vskip -\tf@singlelineskip\relax
+					\singlespacing}%
 			}{}}
 \fi
 
 
 % Endnotes: support and formatting
-
 \if@endnotesformat
 
-	\RequirePackage{endnotes, xparse}
+	\RequirePackage{endnotes}
 
 	% Changes footnote marker type and formatting
-	\tf@setfnpunct{}
+	\def\tf@thefnpunct{\,\,}
 	\renewcommand*{\thefootnote}{\fnsymbol{footnote}}
 
 	\PassOptionsToPackage{notetype=endonly}{biblatex-chicago}
 	
-	\AtEndPreamble{%
-		% Make endnotes use of "_" not a special character when in text mode
-		\appto{\enoteheading}{%
-			\catcode`_=12
-			\begingroup\lccode`~=`_
-			\lowercase{\endgroup\let~}\sb
-			\mathcode`_="8000}
-
-		% Create \jobname.ent if not already defined to avoid missing file error
-		\preto{\theendnotes}{%
-			\IfFileExists{./\jobname.ent}%
-				{}%
-				{%
-					\immediate\openout\@enotes=\jobname.ent\relax
-					\immediate\write\@enotes{}%
-				}}}
+	% Create \jobname.ent to avoid missing file error
+	\@openenotes
 
 	% Set default endnotes formatting
 	\renewcommand{\enotesize}{\normalsize}
 	\renewcommand{\enoteformat}{%
+		\singlespacing
 		\if@optraggedright \raggedright \fi
 		\setlength\parindent{\footnotemargin}
-		\vspace{\tf@singlelineskip}
 		\theenmark.\,\,}
 
 \else
-- 
cgit v1.2.3

