From ed254354293979dbcd210a012d742be68956efc9 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Sun, 11 Aug 2019 21:08:57 +0000
Subject: mlacls

git-svn-id: svn://tug.org/texlive/trunk@51865 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/source/latex/mlacls/mla.dtx | 283 ++++++++++++++++++++------
 1 file changed, 218 insertions(+), 65 deletions(-)

(limited to 'Master/texmf-dist/source/latex/mlacls/mla.dtx')

diff --git a/Master/texmf-dist/source/latex/mlacls/mla.dtx b/Master/texmf-dist/source/latex/mlacls/mla.dtx
index 272a53d9f4a..ba5c6784ab5 100644
--- a/Master/texmf-dist/source/latex/mlacls/mla.dtx
+++ b/Master/texmf-dist/source/latex/mlacls/mla.dtx
@@ -27,7 +27,7 @@
 %<mla>\NeedsTeXFormat{LaTeX2e}
 %<mla>\ProvidesClass{mla}
 %<*mla>
-    [2019/05/18 v0.4.1 MLA Paper Class]
+    [2019/05/29 v0.6 MLA Paper Class]
 %</mla>
 
 %<*driver>
@@ -46,16 +46,6 @@
 %% Needed for the appendix
 \usepackage{verbatim}
 
-%% Fancy PDF
-\usepackage[hidelinks]{hyperref}
-\hypersetup{
-    pdfinfo={
-        Title=The MLA class,
-        Author=Seth Price,
-        Creator=LaTeX
-    }
-}
-
 %% A couple things are cited in the docs
 \usepackage{filecontents}
 \begin{filecontents}{mla.bib}
@@ -99,6 +89,7 @@
 \DeclareAcronym{OWL}{short=OWL,long=Purdue Online Writing Lab}
 \DeclareAcronym{PDF}{short=PDF,long=Portable Document Format}
 \DeclareAcronym{LPPL}{short=LPPL,long=\LaTeX\ Project Public License}
+\DeclareAcronym{SE}{short=SE,long=Stack Exchange}
 
 %% For a few different things
 %%\usepackage{semantic-markup}
@@ -111,16 +102,28 @@
 %% Reset footnotes per page
 \usepackage[perpage]{footmisc}
 
+%% Keep footnotes from breaking across pages
+\interfootnotelinepenalty=10000
+
 %% Technical info
 \def\myemail{ssterling@firemail.cc}
 
 %% For the sake of consistency, I guess
-\GlossaryPrologue{\pdfbookmark[0]{Change history}{ch}
-	\section*{Change history}}
+\GlossaryPrologue{\section{Change history}}
 
 %% Everything just looks better, in my opinion
 \usepackage{microtype}
 
+%% Fancy PDF
+\usepackage[hidelinks]{hyperref}
+\hypersetup{
+    pdfinfo={
+        Title=The MLA class,
+        Author=Seth Price,
+        Creator=LaTeX
+    }
+}
+
 %% Comment this if you don't want to produce a changelog
 \AtEndDocument{\PrintChanges}
 
@@ -134,7 +137,7 @@
 %
 % \fi
 %
-% \CheckSum{231}
+% \CheckSum{291}
 %
 % \CharacterTable
 %  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -232,6 +235,23 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{\MLA@seven}
+% \begin{macro}{\MLA@eight}
+% \begin{macro}{\MLA@eightalt}
+% \begin{macro}{\MLA@microtype}
+% The following are true/false switches to toggle certain features.
+%
+%    \begin{macrocode}
+\newif\ifMLA@seven
+\newif\ifMLA@eight
+\newif\ifMLA@eightalt
+\newif\ifMLA@microtype
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
 % \section{Options}
 % \label{sec:options}
 %
@@ -245,9 +265,13 @@
 %
 % \changes{v0.3}{2019/05/06}{Improved options parsing to avoid
 %	contradiction and undefined behavior}
+% \changes{v0.5}{2019/05/21}{Changed options parser to use
+%	toggle-switch commands in the style of default \LaTeX\ classes}
+% \changes{v0.7}{2019/05/30}{Changed options parser to use
+%	\cs{ifMLA@\ldots} toggle format seen in other classes}
 %    \begin{macrocode}
-\DeclareOption{mla7}{\def\@optMlaSeven}
-\DeclareOption{mla8}{\def\@optMlaEight}
+\DeclareOption{mla7}{\MLA@seventrue\MLA@eightfalse\MLA@eightaltfalse}
+\DeclareOption{mla8}{\MLA@sevenfalse\MLA@eighttrue\MLA@eightaltfalse}
 %    \end{macrocode}
 %
 % \changes{v0.3}{2019/05/07}{Added \Dopt{mla8alt} option}
@@ -256,7 +280,14 @@
 % In this case, one can specify \Dopt{mla8alt}
 % to the \Dcls{mla} class.
 %    \begin{macrocode}
-\DeclareOption{mla8alt}{\def\@optMlaEightAlt}
+\DeclareOption{mla8alt}{\MLA@sevenfalse\MLA@eightfalse\MLA@eightalttrue}
+%    \end{macrocode}
+%
+% The \Dpkg{microtype} package can be optionally included
+% with the \Dopt{microtype} option to offset the pain of using
+% the Times typeface.
+%    \begin{macrocode}
+\DeclareOption{microtype}{\MLA@microtypetrue}
 %    \end{macrocode}
 %
 % \subsection{Processing}
@@ -292,14 +323,20 @@
 %	with \Dpkg{newtxtext}}
 % \changes{v0.4}{2019/05/11}{Added \Dpkg{microtype} package}
 % \changes{v0.4}{2019/05/12}{Added \Dpkg{enumitem} package}
+% \changes{v0.6}{2019/05/29}{Added \Dpkg{caption} package}
+% \changes{v0.6}{2019/05/29}{Added \Dpkg{graphicx} package}
+% \changes{v0.6}{2019/05/29}{Added \Dpkg{float} package}
+% \changes{v0.7}{2019/06/01}{Changed \Dpkg{microtype} package
+%	to only load through \Dopt{microtype} class option}
 %    \begin{macrocode}
+\RequirePackage{caption}
 \RequirePackage{enotez}
 \RequirePackage{enumitem}
 \RequirePackage{fancyhdr}
+\RequirePackage{float}
 \RequirePackage{fullpage}
-\RequirePackage{indentfirst}
+\RequirePackage{graphicx}
 \RequirePackage{ragged2e}
-\RequirePackage{microtype}
 \RequirePackage{newtxtext}
 \RequirePackage{titlesec}
 \RequirePackage{xstring}
@@ -313,28 +350,42 @@
 \RequirePackage[american]{babel}
 \RequirePackage{csquotes}
 \RequirePackage{hanging}
-\RequirePackage[hidelinks,pdfusetitle]{hyperref}
 %    \end{macrocode}
 %
 % And finally, \Dpkg{biblatex}.
 % The \Dcls{mla} class options dictate what options are passed to
 % \Dpkg{biblatex}, hence the \term{if-then} clauses.
-% Due to the nature of the code, earlier editions specified
-% will override later versions (this will later be fixed).
 %
 %    \begin{macrocode}
-\ifdefined\@optMlaSeven
+\ifMLA@seven
     \RequirePackage[style=mla,noremoteinfo=false,showmedium=true,
                     backend=biber]{biblatex}
-\else
-    \ifdefined\@optMlaEightAlt
-        \RequirePackage[style=mla,noremoteinfo=false,
-                        showmedium=false,backend=biber]{biblatex}
-    \else\ifdefined\@optMlaEight
-        \RequirePackage[style=mla-new,noremoteinfo=false,
-                        showmedium=false,backend=biber]{biblatex}
-    \fi\fi
 \fi
+\ifMLA@eight
+    \RequirePackage[style=mla-new,noremoteinfo=false,
+                    showmedium=false,backend=biber]{biblatex}
+\fi
+\ifMLA@eightalt
+    \RequirePackage[style=mla,noremoteinfo=false,
+                    showmedium=false,backend=biber]{biblatex}
+\fi
+%    \end{macrocode}
+%
+% The \Dpkg{microtype} package is loaded if the \Dopt{microtype}
+% option is specified.
+% 
+%    \begin{macrocode}
+\ifMLA@microtype
+    \RequirePackage{microtype}
+\fi
+%    \end{macrocode}
+%
+% For some reason, common practice is to load \Dpkg{hyperref} last
+% of all packages.
+%
+%    \begin{macrocode}
+\RequirePackage{hyperref}
+\hypersetup{hidelinks,pdfusetitle}
 %    \end{macrocode}
 %
 % \section{Document layout}
@@ -355,7 +406,7 @@
 % \subsubsection{Microtype}
 % \label{sec:microtype}
 %
-% The \Dpkg{microtype} package (as loaded in
+% The \Dpkg{microtype} package (if loaded as in
 % section~\ref{sec:loading_packages})
 % will marginally offset the burden of using Times
 % by correcting its ugly kerning and tracking.
@@ -364,7 +415,9 @@
 %
 % \changes{v0.4}{2019/05/12}{Disabled \Dpkg{microtype} protrusion}
 %    \begin{macrocode}
-\microtypesetup{activate=false}
+\ifMLA@microtype
+    \microtypesetup{activate=false}
+\fi
 %    \end{macrocode}
 %
 % \subsection{Line breaking and spacing}
@@ -379,7 +432,7 @@
 % To compensate, line spacing is set to \emph{just enough}:
 %
 % \changes{v0.4}{2019/05/08}{Changed \cs{linespacing} to
-%	prints 24 lines per page}
+%	print 24 lines per page}
 %    \begin{macrocode}
 \linespread{1.905}
 %    \end{macrocode}
@@ -389,30 +442,55 @@
 % for pretty typesetting.
 %
 %    \begin{macrocode}
-\hyphenpenalty 10000
-\pretolerance 10000
+\hyphenpenalty=10000
+\pretolerance=10000
 %    \end{macrocode}
 %
 % \subsection{Paragraphing}
 % \label{sec:paragraphing}
 %
 % The \citetitle{mlahb} specifies half-inch first-line indentation
-% for each paragraph and no extra spacing in between.
+% for every paragraph and no extra spacing in between.
+%
+% \begin{macro}{\MLA@indent}
+% \changes{v0.7}{2019/06/05}{Added macro}
+% In case the indent should be changed, several other macros relying
+% on it might be broken.
+% Using an internal like \cs{MLA@indent} prevents this.
+%
+%    \begin{macrocode}
+\newlength{\MLA@indent}
+\setlength{\MLA@indent}{0.5in}
+%    \end{macrocode}
+% \end{macro}
 %
+%
+% \changes{v0.6}{2019-05-29}{Explicitly set \cs{partopset} to 0pt}
 %    \begin{macrocode}
-\setlength{\parindent}{0.5in}
-\setlength{\RaggedRightParindent}{\parindent}
+\setlength{\parindent}{\MLA@indent}
+\setlength{\RaggedRightParindent}{\MLA@indent}
 \setlength{\parskip}{0em}
 \setlength{\topsep}{0em}
+\setlength{\partopsep}{0em}
+%    \end{macrocode}
+%
+% \TeX\ does not indent the first paragraph after headings by default.
+% Thankfully, the fix for this is simple.
+%
+% \changes{v0.7}{2019/05/31}{Copied code from \Dpkg{indentfirst}
+%	to reduce dependency count}
+%    \begin{macrocode}
+\let\@afterindentfalse\@afterindenttrue
+\@afterindenttrue
 %    \end{macrocode}
 %
 % And, for the sake of consistent 24-line papers,
 % orphans and widows are explicitly allowed.
 %
 %    \begin{macrocode}
-\widowpenalty 0
-\clubpenalty 0
-\interlinepenalty 0
+\widowpenalty=0
+\clubpenalty=0
+\interlinepenalty=0
 %    \end{macrocode}
 %
 % For a final heinous crime against typesetting,
@@ -563,6 +641,14 @@
 \renewcommand{\maketitle}{\makemlaheader}
 %    \end{macrocode}
 %
+% Finally, the header will print at the beginning of every document.
+%
+% \changes{v0.5}{2019/05/18}{Moved header-printing process to
+%	\cs{AtBeginDocument}}
+%    \begin{macrocode}
+\AtBeginDocument{\maketitle}
+%    \end{macrocode}
+%
 % \subsection{Sectioning}
 % \label{sec:sectioning}
 %
@@ -606,11 +692,6 @@
 % \end{macro}
 % \end{macro}
 %
-% Under default configuration, \TeX\ doesn't indent the
-% first paragraph after a section heading, violating \ac{MLA} style.
-% The solution \Dpkg{indentfirst} package was already loaded
-% in section~\ref{sec:loading_packages}.
-%
 % \subsection{Lists}
 % \label{sec:lists}
 %
@@ -618,6 +699,7 @@
 % \changes{v0.4}{2019/05/12}{Added list type}
 % \begin{environment}{enumerate}
 % \changes{v0.4}{2019/05/12}{Added list type}
+% \changes{v0.7}{2019/06/05}{Changed length to use \cs{MLA@indent}}
 % To the user, \Dlst{itemize} and \Dlst{enumerate} lists
 % will function exactly as expected.
 % However, the formatting of the lists must be modified as to
@@ -631,13 +713,13 @@
     parsep=0pt,
     itemsep=0pt,
     topsep=0pt,
-    leftmargin=\parindent
+    leftmargin=\MLA@indent
 }
 \setlist[enumerate]{%
     parsep=0pt,
     itemsep=0pt,
     topsep=0pt,
-    leftmargin=\parindent
+    leftmargin=\MLA@indent
 }
 %    \end{macrocode}
 % \end{environment}
@@ -654,11 +736,12 @@
 %
 % \changes{v0.2}{2019/04/28}{Countered unexplained vertical space
 %	after environment}
+% \changes{v0.7}{2019/06/05}{Changed length to use \cs{MLA@indent}}
 %    \begin{macrocode}
 \renewenvironment{blockquote}{%
-    \list{}{\leftmargin 0.5in}
+    \list{}{\leftmargin \MLA@indent}
     \item[]
-    \setlength{\parindent}{0.5in}
+    \setlength{\parindent}{\MLA@indent}
     \vspace{-\topsep}
 }{%
     \endlist
@@ -667,6 +750,76 @@
 %    \end{macrocode}
 % \end{environment}
 %
+% \subsection{Figures and tables}
+% \label{sec:figures}
+%
+% The \citetitle{mlahb} doesn't specify much of anything about
+% the actual formatting of figures or tables or their captions,
+% so the following is mostly based on the package author's
+% personal preference and observations.
+%
+% \begin{environment}{figure}
+% \changes{v0.6}{2019/05/29}{Properly formatted}
+% \begin{environment}{table}
+% \changes{v0.6}{2019/05/29}{Properly formatted}
+%
+% Centered figures with margins the equivalent of one line of text
+% seems customary and logical.
+%
+%    \begin{macrocode}
+\setlength{\floatsep}{\baselineskip}
+\setlength{\intextsep}{\baselineskip}
+\setlength{\textfloatsep}{\baselineskip}
+\g@addto@macro\@floatboxreset\centering
+%    \end{macrocode}
+%
+% Thanks to a bug inherited from the \Dpkg{here} package
+% which has remained unfixed since 1987\footnote{See the \cs{par}
+% on p. 11, line 249 of \Dfile{ltfloat.dtx} from the \LaTeX\ kernel.},
+% there is not only extra space after the figure but the inability to
+% insert a figure within a paragraph.
+% Miraculously, there is a fix for this\footnote{See David Carlisle's
+% answer on \TeX\ \acs{SE}:
+% \url{https://tex.stackexchange.com/a/310793}}.
+%
+%    \begin{macrocode}
+\renewcommand{\float@endH}{%
+    \vspace{-12pt}
+    \@endfloatbox\vskip\intextsep
+    \if@flstyle\setbox\@currbox\float@makebox\columnwidth\fi
+    \box\@currbox\vskip\intextsep\relax\@doendpe
+}
+%    \end{macrocode}
+%
+% \end{environment}
+% \end{environment}
+% 
+% \begin{environment}{caption}
+% \changes{v0.6}{2019/05/29}{Properly formatted}
+%
+% Un-fancifying the caption is acheived using the
+% \Dpkg{caption} package.
+%
+%    \begin{macrocode}
+\captionsetup{%
+    font={normalfont},
+    labelformat=simple,
+    labelsep=period,
+    position=bottom,
+    aboveskip=6pt,
+    belowskip=-10pt
+}
+%    \end{macrocode}
+%
+% In the author's personal experience, most \ac{MLA}-style papers
+% use \mentioned{Fig.} and not \mentioned{Figure}.
+%
+%    \begin{macrocode}
+\captionsetup[figure]{name=Fig.}
+%    \end{macrocode}
+%
+% \end{environment}
+%
 % \subsection{Paper sections}
 % \label{sec:paper_sections}
 %
@@ -675,14 +828,12 @@
 %
 % \begin{environment}{paper}
 % The main content; the body.
-% This environment produces the \ac{MLA} header at the top.
+% This environment exists only for a logical division and does
+% nothing special.
 %
+% \changes{v0.5}{2019/05/18}{Removed \cs{newpage}}
 %    \begin{macrocode}
-\newenvironment{paper}{%
-    \makemlaheader
-}{%
-    \newpage
-}
+\newenvironment{paper}{}{}
 %    \end{macrocode}
 % \end{environment}
 %
@@ -702,15 +853,16 @@
 % \changes{v0.4}{2019/05/12}{Changed default endnotes format
 %	to \Dlst{mla}}
 % \changes{v0.4}{2019/05/12}{Removed extra \cs{vspace}}
+% \changes{v0.5}{2019/05/18}{Moved \cs{newpage} to beginning of environment}
+% \changes{v0.7}{2019/06/05}{Changed length to use \cs{MLA@indent}}
 %    \begin{macrocode}
 \newenvironment{notes}{%
+    \newpage
     \begin{noindent}
         \pdfbookmark[0]{Notes}{notes}
         \begin{center}Notes\end{center}
     \end{noindent}
-}{%
-    \newpage
-}
+}{}
 %    \end{macrocode}
 % \end{environment}
 %
@@ -725,7 +877,7 @@
     parsep=0pt,
     itemsep=0pt,
     topsep=0pt,
-    leftmargin=\parindent
+    leftmargin=\MLA@indent
 }
 %    \end{macrocode}
 %
@@ -751,16 +903,17 @@
 %
 % \changes{v0.2}{2019/04/28}{Countered unexplained vertical space
 %	after heading}
+% \changes{v0.5}{2019/05/18}{Moved \cs{newpage} to beginning of environment}
+% \changes{v0.7}{2019/06/05}{Changed length to use \cs{MLA@indent}}
 %    \begin{macrocode}
 \newenvironment{workscited}{%
+    \newpage
     \begin{noindent}
         \pdfbookmark[0]{Works Cited}{workscited}
         \begin{center}Works Cited\end{center}
     \end{noindent}
     \vspace{-16pt} % XXX to counter unexplained space
-}{%
-    \newpage
-}
+}{}
 %    \end{macrocode}
 % \end{environment}
 %
@@ -770,7 +923,7 @@
 % defined by the \Dpkg{biblatex} package.
 %
 %    \begin{macrocode}
-\setlength{\bibhang}{\parindent}
+\setlength{\bibhang}{\MLA@indent}
 %    \end{macrocode}
 %
 % \appendix
-- 
cgit v1.2.3

