Debian Codegraph @

texmf-dist/source/latex/mlacls/mla.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright 2019 Seth M. Price.
4 %
5 % This file may be distributed and/or modified under the
6 % conditions of the LaTeX Project Public License, either
7 % version 1.3 of this license or any later version.
8 % The latest version of this license is in:
9 %
10 % https://www.latex-project.org/lppl/lppl-1-3c/
11 %
12 % and version 1.3c or later is part of all distributions
13 % of LaTeX version 2008/05/04 or later.
14 %
15 % \fi
16 %
17 % \iffalse
18 %
19 % \section*{Documentation driver}
20 % \addcontentsline{toc}{section}{Documentation driver}
21 %
22 % \begin{macrocode}
23 %<*driver>
24 \ProvidesFile{mla.dtx}
25 %</driver>
26
27 %<mla>\NeedsTeXFormat{LaTeX2e}
28 %<mla>\ProvidesClass{mla}
29 %<*mla>
30 [2024/09/13 v1.1 MLA Paper Class]
31 %</mla>
32
33 %<*driver>
34 \documentclass{ltxdoc}
35 \AtBeginDocument{\RecordChanges\CodelineIndex\EnableCrossrefs}
36
37 %% These bits are some common shorthand I picked up:
38 \newcommand*{\Dfile}[1]{\texttt{#1}}
39 \newcommand*{\Dopt}[1]{\textsf{\small #1}}
40 \newcommand*{\Dctr}[1]{\textsl{\small #1}}
41 \newcommand*{\Dlst}[1]{\texttt{#1}}
42 \newcommand*{\Denv}[1]{\texttt{#1}}
43 \newcommand*{\Dcls}[1]{\textsf{#1}}
44 \newcommand*{\Dpkg}[1]{\textsf{#1}}
45
46 %% Needed for the appendix
47 \usepackage{verbatim}
48
49 %% A couple things are cited in the docs
50 \begin{filecontents}{mla.bib}
51 @book{mlahb,
52 author = {{Modern Language Association of America}},
53 shortauthor = {{Modern Language Association}},
54 title = {The {MLA} Handbook for Writers of Research Papers},
55 shorttitle = {Handbook},
56 edition = {8},
57 year = {2016},
58 publisher = {{Modern Language Association of America}},
59 howpublished = {Print},
60 isbn = {9781603292627}
61 }
62 @online{owlmla,
63 title = {{MLA} General Format},
64 journaltitle = {{P}urdue Online Writing Lab},
65 institution = {Purdue University},
66 howpublished = {Web},
67 urldate = {2019-05-06},
68 url = {https://owl.purdue.edu/owl/research_and_citation/mla_style/mla_formatting_and_style_guide/mla_general_format.html}
69 }
70 @online{owlendnotes,
71 title = {{MLA} Endnotes and Footnotes},
72 journaltitle = {{P}urdue Online Writing Lab},
73 institution = {Purdue University},
74 howpublished = {Web},
75 urldate = {2019-05-06},
76 url = {https://owl.purdue.edu/owl/research_and_citation/mla_style/mla_formatting_and_style_guide/mla_endnotes_and_footnotes.html}
77 }
78 \end{filecontents}
79 \usepackage[backend=biber]{biblatex}
80 \addbibresource{mla.bib}
81
82 %% Just thought it'd be cool to use `acro'
83 %% (though v3.6 seems to have broken everything)
84 \ExplSyntaxOn
85 \prop_new:N \l__acro_foreign_format_prop
86 \ExplSyntaxOff
87 \usepackage{acro2}
88 \DeclareAcronym{US}{short=US,long=United States}
89 \DeclareAcronym{MLA}{short=MLA,long=Modern Language Association}
90 \DeclareAcronym{CTAN}{short=CTAN,
91 long=Comprehensive \TeX\ Archive Network}
92 \DeclareAcronym{OWL}{short=OWL,long=Purdue Online Writing Lab}
93 \DeclareAcronym{PDF}{short=PDF,long=Portable Document Format}
94 \DeclareAcronym{LPPL}{short=LPPL,long=\LaTeX\ Project Public License}
95 \DeclareAcronym{SE}{short=SE,long=Stack Exchange}
96
97 %% For a few different things
98 \usepackage{semantic-markup}
99
100 %% Reset footnotes per page
101 \usepackage[perpage]{footmisc}
102
103 %% Keep footnotes from breaking across pages
104 \interfootnotelinepenalty=10000
105
106 %% Technical info
107 \def\myemail{[email protected]}
108
109 %% For the sake of consistency, I guess
110 \GlossaryPrologue{\section{Change history}}
111
112 %% Everything just looks better, in my opinion
113 \usepackage{microtype}
114
115 %% Fancy PDF
116 \usepackage[numbered]{hypdoc}
117 \hypersetup{
118 hidelinks,
119 pdfinfo={
120 Title=The MLA class,
121 Author=Seth M. Price,
122 Creator=LaTeX
123 }
124 }
125
126 %% Comment this if you don't want to produce a changelog
127 \AtEndDocument{\PrintChanges}
128
129 \GetFileInfo{mla.dtx}
130
131 \begin{document}
132 \DocInput{mla.dtx}
133 \end{document}
134 %</driver>
135 % \end{macrocode}
136 %
137 % \fi
138 %
139 % \CheckSum{430}
140 %
141 % \CharacterTable
142 % {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
143 % Lower-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
144 % Digits \0\1\2\3\4\5\6\7\8\9
145 % Exclamation \! Double quote \" Hash (number) \#
146 % Dollar \$ Percent \% Ampersand \&
147 % Acute accent \' Left paren \( Right paren \)
148 % Asterisk \* Plus \+ Comma \,
149 % Minus \- Point \. Solidus \/
150 % Colon \: Semicolon \; Less than \<
151 % Equals \= Greater than \> Question mark \?
152 % Commercial at \@ Left bracket \[ Backslash \\
153 % Right bracket \] Circumflex \^ Underscore \_
154 % Grave accent \` Left brace \{ Vertical bar \|
155 % Right brace \} Tilde \~}
156 %
157 % \title{The \Dcls{mla} class\thanks{This document corresponds to
158 % \Dcls{mla}~\fileversion, dated \filedate.}}
159 % \author{Seth M.\ Price \\ \href{mailto:\myemail}{\texttt{\myemail}}}
160 % \date{\today}
161 %
162 % \maketitle
163 %
164 % \begin{abstract}
165 % In the \acl{US}, secondary and undergraduate students
166 % are generally expected to adhere to the format prescribed by
167 % the \ac{MLA} for typewritten essays, research papers and writings.
168 % Sadly, the tool of choice is usually Microsoft Word,
169 % even amongst those fluent with \TeX .
170 %
171 % Though there \emph{are} some templates and tools to aid in
172 % writing in the \ac{MLA} format using \LaTeX ,
173 % none fully met the expectations of the author.
174 % So \foreign{voil\`a}, there now exists an \Dfile{mla.cls} proper:
175 % a simple, straightforward class for composing papers
176 % almost perfectly adherent to the
177 % \ac{MLA} style guide\footfullcite{mlahb}.
178 % \end{abstract}
179 %
180 % \section*{Licensing}
181 % \label{sec:licensing}
182 %
183 % The files contained in this package
184 % may be distributed and/or modified under the
185 % conditions of the \ac{LPPL}, either
186 % version 1.3 of this license or any later version.
187 % The latest version of this license is in
188 % \url{https://www.latex-project.org/lppl/lppl-1-3c/},
189 % and version 1.3c or later is part of all distributions
190 % of \LaTeX\ version 2008/05/04 or later.
191 %
192 % \microtypesetup{protrusion=false}
193 % \tableofcontents
194 % \microtypesetup{protrusion=true}
195 %
196 % \StopEventually{} ^^A
197 %
198 % \section{Initial code}
199 % \label{sec:initial_code}
200 %
201 % The \Dcls{mla} class uses the \Dcls{article} class as its base.
202 % Thanks to this, macros such as \cs{textit} or \cs{textsuperscript}
203 % work as expected and won't have to be re-defined.
204 % \begin{macrocode}
205 \LoadClass[letterpaper,12pt]{article}
206 % \end{macrocode}
207 %
208 % \begin{macro}{\mladate}
209 % The \citetitle{mlahb} requires use of the \term{day month year}
210 % date format, not \TeX 's standard \term{month day, year}.
211 % The macro \cs{mladate} will format \cs{today} accordingly
212 % to be used as the default value for \cs{date}
213 % (see section~\ref{sec:the_header}).
214 %
215 % \changes{v0.2}{2019/05/02}{Added macro}
216 % \changes{v0.7}{2019/08/30}{Added August to month list}
217 % \begin{macrocode}
218 \newcommand{\mladate}{%
219 \the\day\
220 \ifcase\the\month
221 \or January
222 \or February
223 \or March
224 \or April
225 \or May
226 \or June
227 \or July
228 \or August
229 \or September
230 \or October
231 \or November
232 \or December
233 \fi
234 \the\year
235 }
236 % \end{macrocode}
237 % \end{macro}
238 %
239 % \begin{macro}{\MLA@seven}
240 % \begin{macro}{\MLA@eight}
241 % \begin{macro}{\MLA@eightalt}
242 % \begin{macro}{\MLA@figures}
243 % \begin{macro}{\MLA@notes}
244 % \begin{macro}{\MLA@microtype}
245 % \begin{macro}{\MLA@paperheader}
246 % \begin{macro}{\MLA@pageheader}
247 % \begin{macro}{\MLA@plainheadings}
248 % \begin{macro}{\MLA@fullpage}
249 % \begin{macro}{\MLA@times}
250 % The following are true/false switches to toggle certain features.
251 %
252 % \begin{macrocode}
253 \newif\ifMLA@seven
254 \newif\ifMLA@eight
255 \newif\ifMLA@eightalt
256 \newif\ifMLA@figures
257 \newif\ifMLA@notes
258 \newif\ifMLA@microtype
259 \newif\ifMLA@paperheader
260 \newif\ifMLA@pageheader
261 \newif\ifMLA@plainheadings
262 \newif\ifMLA@fullpage
263 \newif\ifMLA@times
264 % \end{macrocode}
265 % \end{macro}
266 % \end{macro}
267 % \end{macro}
268 % \end{macro}
269 % \end{macro}
270 % \end{macro}
271 % \end{macro}
272 % \end{macro}
273 % \end{macro}
274 % \end{macro}
275 % \end{macro}
276 %
277 % \section{Options}
278 % \label{sec:options}
279 %
280 % Some teachers and professors might still require using
281 % the seventh edition of the \citetitle{mlahb},
282 % while others will likely use the eighth edition.
283 % Which edition to implement can be explicitly specified
284 % with the \Dopt{mla7} and \Dopt{mla8} class options.
285 % The only difference this makes within the \Dcls{mla} class itself
286 % is the citation format used by \Dpkg{biblatex}.
287 %
288 % \changes{v0.3}{2019/05/06}{Improved options parsing to avoid
289 % contradiction and undefined behavior}
290 % \changes{v0.5}{2019/05/21}{Changed options parser to use
291 % toggle-switch commands in the style of default \LaTeX\ classes}
292 % \changes{v0.7}{2019/05/30}{Changed options parser to use
293 % \cs{ifMLA@\ldots} toggle format seen in other classes}
294 % \begin{macrocode}
295 \DeclareOption{mla7}{\MLA@seventrue\MLA@eightfalse\MLA@eightaltfalse}
296 \DeclareOption{mla8}{\MLA@sevenfalse\MLA@eighttrue\MLA@eightaltfalse}
297 % \end{macrocode}
298 %
299 % \changes{v0.3}{2019/05/07}{Added \Dopt{mla8alt} option}
300 % Some versions of \Dpkg{biblatex-mla} might not recognize
301 % the \Dopt{style=mla-new} option for the eighth edition.
302 % In this case, one can specify \Dopt{mla8alt}
303 % to the \Dcls{mla} class.
304 % \begin{macrocode}
305 \DeclareOption{mla8alt}{\MLA@sevenfalse\MLA@eightfalse\MLA@eightalttrue}
306 % \end{macrocode}
307 %
308 % For those who do not plan on using figures and/or endnotes,
309 % some time (and dependency disk space) might be saved by using the
310 % \Dopt{nofigures} and/or \Dopt{nonotes} options, as they are enabled
311 % by default.
312 % \begin{macrocode}
313 \MLA@figurestrue
314 \MLA@notestrue
315 \DeclareOption{nofigures}{\MLA@figuresfalse}
316 \DeclareOption{nonotes}{\MLA@notesfalse}
317 % \end{macrocode}
318 %
319 % The \Dpkg{microtype} package can be optionally included
320 % with the \Dopt{microtype} option to offset the pain of using
321 % the Times typeface.
322 % \begin{macrocode}
323 \DeclareOption{microtype}{\MLA@microtypetrue}
324 % \end{macrocode}
325 %
326 % \changes{v0.9}{2020/10/05}{Added \Dopt{nopaperheader},
327 % \Dopt{nopageheader} and \Dopt{noheaders} options to enable
328 % omission of paper headers, page headers or both paper
329 % and page headers respectively}
330 % For rare cases in which the paper and page headers are omitted
331 % or must be custom, the options \Dopt{nopaperheader} and
332 % \Dopt{nopageheader} may be used respectively, or
333 % \Dopt{noheaders} to omit both.
334 % \begin{macrocode}
335 \MLA@paperheadertrue
336 \MLA@pageheadertrue
337 \DeclareOption{nopaperheader}{\MLA@paperheaderfalse}
338 \DeclareOption{nopageheader}{\MLA@pageheaderfalse}
339 \DeclareOption{noheaders}{\MLA@paperheaderfalse\MLA@pageheaderfalse}
340 % \end{macrocode}
341 %
342 % \changes{v0.9}{2020/10/05}{Added \Dopt{plainheadings} option to
343 % forego small-caps and auto-numbering in section headings}
344 % For professors and/or writers who desire to format the section
345 % headings manually and individually (and forego \cs{titleformat\{\}},
346 % the \Dopt{plainheadings} option may be used.
347 % \begin{macrocode}
348 \MLA@plainheadingsfalse
349 \DeclareOption{plainheadings}{\MLA@plainheadingstrue}
350 % \end{macrocode}
351 %
352 % \changes{v0.9}{2020/11/07}{Added \Dopt{fullpage} option to explicitly
353 % allow widows and orphans}
354 % Another edge case is in which a professor may require strict 24-line
355 % papers, i.\,e.\ explicitly allowing orphans and widows, enabled using
356 % the \Dopt{fullpage} option\footnote{In versions of \Dcls{mlacls}
357 % prior to v0.9, disallowing widows and orphans was default behavior.}.
358 % \begin{macrocode}
359 \MLA@fullpagefalse
360 \DeclareOption{fullpage}{\MLA@fullpagetrue}
361 % \end{macrocode}
362 %
363 % \changes{v1.1}{2024/02/04}{Added \Dopt{notimes} option to not set Times New
364 % Roman as the font}
365 % For professors that do not require Times New Roman as the font, the
366 % \Dopt{notimes} option may be used to keep the default font. This allows
367 % maintaining \LaTeX{}'s default font if desired.
368 % \begin{macrocode}
369 \MLA@timestrue
370 \DeclareOption{notimes}{\MLA@timesfalse}
371 % \end{macrocode}
372 %
373 % \subsection{Processing}
374 % \label{sec:processing}
375 %
376 % A friendly warning will be provided when an unknown option
377 % is provided.
378 %
379 % \begin{macrocode}
380 \DeclareOption*{%
381 \ClassWarning{mla}{Unknown option `\CurrentOption'; ignoring}
382 }
383 % \end{macrocode}
384 %
385 % By default, the eighth edition of the \citetitle{mlahb} is used.
386 % To future-proof your documents for upcoming editions, however,
387 % it may be wise to explicitly specify \Dopt{mla8}.
388 %
389 % \begin{macrocode}
390 \ExecuteOptions{mla8}
391 \ProcessOptions\relax
392 % \end{macrocode}
393 %
394 % \section{Loading packages}
395 % \label{sec:loading_packages}
396 %
397 % The \Dcls{mla} class requires the following packages\footnote{All
398 % of the required packages are available for download
399 % on the \ac{CTAN} if unavailable on your system:
400 % \url{https://www.ctan.org/}.}:
401 %
402 % \changes{v0.3}{2019/05/07}{Replaced obsolete \Dpkg{times} package
403 % with \Dpkg{newtxtext}}
404 % \changes{v0.4}{2019/05/11}{Added \Dpkg{microtype} package}
405 % \changes{v0.4}{2019/05/12}{Added \Dpkg{enumitem} package}
406 % \changes{v0.6}{2019/05/29}{Added \Dpkg{caption} package}
407 % \changes{v0.6}{2019/05/29}{Added \Dpkg{graphicx} package}
408 % \changes{v0.6}{2019/05/29}{Added \Dpkg{float} package}
409 % \changes{v0.7}{2019/06/01}{Changed \Dpkg{microtype} package
410 % to only load through \Dopt{microtype} class option}
411 % \changes{v0.9}{2020/08/20}{Added \Dopt{nofigures} and \Dopt{nonotes}
412 % options to prevent loading unused dependencies}
413 % \begin{macrocode}
414 \RequirePackage{enumitem}
415 \RequirePackage{fancyhdr}
416 \RequirePackage{fullpage}
417 \RequirePackage{ragged2e}
418 \RequirePackage{titlesec}
419 \RequirePackage{xstring}
420 % \end{macrocode}
421 %
422 % The following consists of prerequisites for \Dpkg{biblatex-mla}:
423 %
424 % \changes{v0.2}{2019/05/02}{Hid hyperlink boxes in \acs{PDF} output}
425 % \changes{v0.2}{2019/05/02}{Added support for \acs{PDF} metadata}
426 % \begin{macrocode}
427 \RequirePackage[american]{babel}
428 \RequirePackage{csquotes}
429 \RequirePackage{hanging}
430 % \end{macrocode}
431 %
432 % And finally, \Dpkg{biblatex}.
433 % The \Dcls{mla} class options dictate what options are passed to
434 % \Dpkg{biblatex}, hence the \term{if-then} clauses.
435 %
436 % \changes{v1.0}{2021/09/14}{Fixed bug which caused class to fail
437 % with \ac{MLA} 8 citations}
438 % \begin{macrocode}
439 \ifMLA@seven
440 \RequirePackage[style=mla7,noremoteinfo=false,
441 backend=biber]{biblatex}
442 \fi
443 \ifMLA@eight
444 \RequirePackage[style=mla-new,noremoteinfo=false,
445 backend=biber]{biblatex}
446 \fi
447 \ifMLA@eightalt
448 \RequirePackage[style=mla,noremoteinfo=false,
449 backend=biber]{biblatex}
450 \fi
451 % \end{macrocode}
452 %
453 % The \Dpkg{caption}, \Dpkg{float} and \Dpkg{graphicx} packages
454 % are loaded by default, but can be disabled using the
455 % \Dopt{nofigures} option.
456 %
457 % \begin{macrocode}
458 \ifMLA@figures
459 \RequirePackage{caption}
460 \RequirePackage{float}
461 \RequirePackage{graphicx}
462 \fi
463 % \end{macrocode}
464 %
465 % Likewise, the \Dpkg{enotez} package can be disabled with
466 % \Dopt{nonotes}.
467 %
468 % \begin{macrocode}
469 \ifMLA@notes
470 \RequirePackage{enotez}
471 \fi
472 % \end{macrocode}
473 %
474 % And the \Dpkg{newtxtext} package can be disabled with \Dopt{notimes}.
475 %
476 % \begin{macrocode}
477 \ifMLA@times
478 \RequirePackage{newtxtext}
479 \fi
480 % \end{macrocode}
481 %
482 % The \Dpkg{microtype} package is loaded if the \Dopt{microtype}
483 % option is specified.
484 %
485 % \begin{macrocode}
486 \ifMLA@microtype
487 \RequirePackage{microtype}
488 \fi
489 % \end{macrocode}
490 %
491 % For some reason, common practice is to load \Dpkg{hyperref} last
492 % of all packages.
493 %
494 % \begin{macrocode}
495 \RequirePackage{hyperref}
496 \hypersetup{hidelinks,pdfusetitle}
497 % \end{macrocode}
498 %
499 % \section{Document layout}
500 % \label{sec:document_layout}
501 %
502 % \subsection{Font}
503 % \label{sec:font}
504 %
505 % The font size was set to 12pt when loading the \Dcls{article} class
506 % in section~\ref{sec:initial_code}.
507 % Unless the option \Dopt{notimes} was specified,
508 % the \Dpkg{newtxtext} package will have been loaded in
509 % section~\ref{sec:loading_packages},
510 % which should be metric-compatible with the infamous Times New Roman,
511 % the \foreign{de facto} standard of the
512 % \ac{MLA} format\footnote{According to the popular, oft-referenced
513 % \ac{OWL}: \citeurl{owlmla}.}.
514 %
515 % \subsubsection{Microtype}
516 % \label{sec:microtype}
517 %
518 % The \Dpkg{microtype} package (if loaded as in
519 % section~\ref{sec:loading_packages})
520 % will marginally offset the burden of using Times
521 % by correcting its ugly kerning and tracking.
522 % The vague \Dopt{activate=false} below simply disables
523 % protrusion, maintaining original line and page breaks.
524 %
525 % \changes{v0.4}{2019/05/12}{Disabled \Dpkg{microtype} protrusion}
526 % \begin{macrocode}
527 \ifMLA@microtype
528 \microtypesetup{activate=false}
529 \fi
530 % \end{macrocode}
531 %
532 % \subsection{Line breaking and spacing}
533 % \label{sec:line_breaking}
534 %
535 % The \citetitle{mlahb} prescribes exact double-spacing,
536 % the definition of which varies between typesetters.
537 % With these parameters exact, \LaTeX\ produces 23 lines of text
538 % whereas the \soCalled{industry standard}
539 % Microsoft Word\footnote{Microsoft Word 97 through 2016,
540 % and likely following versions as well.} produces 24.
541 % To compensate, line spacing is set to \emph{just enough}:
542 %
543 % \changes{v0.4}{2019/05/08}{Changed \cs{linespacing} to
544 % print 24 lines per page}
545 % \begin{macrocode}
546 \linespread{1.905}
547 % \end{macrocode}
548 %
549 % Though not explicitly denounced in the \citetitle{mlahb},
550 % most \ac{MLA}-style papers don't hyphenate or adjust spacing
551 % for pretty typesetting.
552 %
553 % \begin{macrocode}
554 \hyphenpenalty=10000
555 \pretolerance=10000
556 % \end{macrocode}
557 %
558 % \subsection{Paragraphing}
559 % \label{sec:paragraphing}
560 %
561 % The \citetitle{mlahb} specifies half-inch first-line indentation
562 % for every paragraph and no extra spacing in between.
563 %
564 % \changes{v0.6}{2019-05-29}{Explicitly set \cs{partopset} to 0pt}
565 % \begin{macrocode}
566 \setlength{\parindent}{0.5in}
567 \setlength{\RaggedRightParindent}{\parindent}
568 \setlength{\parskip}{0em}
569 \setlength{\topsep}{0em}
570 \setlength{\partopsep}{0em}
571 % \end{macrocode}
572 %
573 % \TeX\ does not indent the first paragraph after headings by default.
574 % Thankfully, the fix for this is simple.
575 %
576 % \changes{v0.7}{2019/05/31}{Copied code from \Dpkg{indentfirst}
577 % to reduce dependency count}
578 % \begin{macrocode}
579 \let\@afterindentfalse\@afterindenttrue
580 \@afterindenttrue
581 % \end{macrocode}
582 %
583 % Orphans and widows are explicitly banned\footnote{According to the
584 % \ac{MLA} itself: \url{https://style.mla.org/orphaned-words/}}.
585 % For the odd case in which papers must be consistently 24 lines
586 % (i.\,e.\ explicitly allowing orphans and widows), the
587 % \Dopt{fullpage} option may be used (see section~\ref{sec:options}).
588 %
589 % \begin{macrocode}
590 \ifMLA@fullpage
591 \widowpenalty=0
592 \clubpenalty=0
593 \interlinepenalty=0
594 \else
595 \widowpenalty=10000
596 \clubpenalty=10000
597 \fi
598 % \end{macrocode}
599 %
600 % As a heinous crime against the art of typesetting,
601 % the \citetitle{mlahb} advises flush-left/ragged-right alignment.
602 % (This is acheived with the \Dpkg{ragged2e} package.)
603 %
604 % \begin{macrocode}
605 \RaggedRight
606 % \end{macrocode}
607 %
608 % \begin{environment}{noindent}
609 % The \Denv{noindent} environment doesn't work as expected
610 % in conjunction with \Dpkg{ragged2e}, hence the re-definition.
611 %
612 % \begin{macrocode}
613 \renewenvironment{noindent}{%
614 \edef\tmpind{\parindent}
615 \setlength{\parindent}{0pt}
616 }{%
617 \setlength{\parindent}{\tmpind}
618 \undef{\tmpind}
619 }
620 % \end{macrocode}
621 % \end{environment}
622 %
623 % \subsection{Page layout}
624 % \label{sec:page_layout}
625 %
626 % With few exceptions, the \ac{US} uses \soCalled{letter-size} paper.
627 % The paper size was already set when loading the \Dcls{article} class
628 % in section~\ref{sec:initial_code}.
629 %
630 % Furthermore, the \citetitle{mlahb} dictates uniform one-inch margins
631 % on said paper.
632 % This was already set by the \Dpkg{fullpage} package as loaded
633 % in section~\ref{sec:loading_packages}.
634 % The \cs{textheight} and \cs{textwidth} definitions are here
635 % just for good measure.
636 %
637 % \begin{macrocode}
638 \setlength{\textheight}{9in}
639 \setlength{\textwidth}{6.5in}
640 % \end{macrocode}
641 %
642 % \subsection{Running head}
643 % \label{sec:running_head}
644 %
645 % The running head in \ac{MLA} style is simply the author's surname
646 % (if defined) followed by the current page number, right-aligned,
647 % unless specified otherwise using the \Dopt{nopageheader} option
648 % (see section~\ref{sec:options}).
649 % This is managed using the \Dpkg{fancyhdr} and \Dpkg{xstring} packages.
650 %
651 % \begin{macrocode}
652 \fancypagestyle{norule}{%
653 \renewcommand{\headrulewidth}{0pt}
654 \renewcommand{\footrulewidth}{0pt}
655 }
656 \fancyhf{}
657 \pagestyle{headings}
658 \pagestyle{norule}
659 \ifMLA@pageheader
660 \ifx\@author\@empty
661 \fancyhead[RO]{\thepage}
662 \else
663 \fancyhead[RO]{{\StrBehind{\@author}{ }[\last]\last} \thepage}
664 \fi
665 \fi
666 % \end{macrocode}
667 %
668 % The following code is largely a hack to align the header
669 % in the middle of the one-inch margin above the body text.
670 %
671 % \begin{macrocode}
672 \setlength{\headheight}{18pt}
673 \setlength{\headsep}{12pt}
674 \setlength{\voffset}{-34pt}
675 % \end{macrocode}
676 %
677 % \section{Document markup}
678 % \label{sec:document_markup}
679 %
680 % \subsection{The header}
681 % \label{sec:the_header}
682 %
683 % \begin{macro}{\title}
684 % \begin{macro}{\author}
685 % \begin{macro}{\date}
686 % The \cs{title}, \cs{author} and \cs{date} macros work as expected.
687 % However, if your surname contains a space, you must contain the
688 % surname in braces as such:
689 % {\small |\author{Ludwig {van Beethoven}}|}.
690 % This keeps the full surname in the running head (see
691 % section~\ref{sec:running_head}).
692 % \end{macro}
693 % \end{macro}
694 % \end{macro}
695 %
696 % The following header commands are unique to the \Dcls{mla} class.
697 %
698 % \begin{macro}{\professor}
699 % The instructor who assigned the paper, i.e.
700 % \mentioned{Dr.\ Marjorie Stewart}.
701 %
702 % \begin{macrocode}
703 \newcommand*{\professor}[1]{\gdef\@professor{#1}}
704 % \end{macrocode}
705 % \end{macro}
706 %
707 % \begin{macro}{\course}
708 % The course for which this paper was assigned, i.e.
709 % \mentioned{ENGL 101-02}.
710 %
711 % \begin{macrocode}
712 \newcommand*{\course}[1]{\gdef\@course{#1}}
713 % \end{macrocode}
714 % \end{macro}
715 %
716 % To prevent undefined behavior, the internal macros used
717 % to store the above information are set empty, except for \cs{date}.
718 % (Note the use of \cs{mladate}; see section~\ref{sec:initial_code}.)
719 %
720 % \begin{macrocode}
721 \title{}
722 \author{}
723 \professor{}
724 \course{}
725 \date{\mladate}
726 % \end{macrocode}
727 %
728 % \begin{macro}{\makemlaheader}
729 % This command finally prints out the standard four-line
730 % \ac{MLA} header, as well as the title.
731 %
732 % \changes{v0.2}{2019/05/02}{Changed date format to
733 % \term{day month year}}
734 % \changes{v0.4.1}{2019/05/15}{Changed date format back to whatever
735 % is inside \cs{@date}}
736 % \changes{v0.9}{2020/10/05}{Changed to ignore (not print) undefined
737 % header macros}
738 % \changes{v0.9}{2020/10/05}{Fix weird bug where paragraph immediately
739 % after \cs{begin\{paper\}} (with no newline) is not indented}
740 % \begin{macrocode}
741 \newcommand{\makemlaheader}{%
742 \begin{noindent}
743 \ifx\@author\@empty\else\@author\\\fi
744 \ifx\@professor\@empty\else\@professor\\\fi
745 \ifx\@course\@empty\else\@course\\\fi
746 \ifx\@date\@empty\else\@date\\\fi
747 \ifx\@title\@empty\else\begin{center}\@title\end{center}\fi
748 \end{noindent}
749 % for some reason, this blank line is necessary
750 }
751 % \end{macrocode}
752 % \end{macro}
753 %
754 % For simplicity's sake, \cs{maketitle} is directly aliased
755 % to \cs{makemlaheader}.
756 %
757 % \begin{macrocode}
758 \renewcommand{\maketitle}{\makemlaheader}
759 % \end{macrocode}
760 %
761 % Finally, the header will print at the beginning of every document
762 % unless specified otherwise using the \Dopt{nopaperheader} option
763 % (see section~\ref{sec:options}).
764 %
765 % \changes{v0.5}{2019/05/18}{Moved header-printing process to
766 % \cs{AtBeginDocument}}
767 % \begin{macrocode}
768 \ifMLA@paperheader
769 \AtBeginDocument{\maketitle}
770 \fi
771 % \end{macrocode}
772 %
773 % \subsection{Sectioning}
774 % \label{sec:sectioning}
775 %
776 % \changes{v0.7}{2019/08/30}{Replaced regular space after dot
777 % in section headings with \cs{enspace}}
778 % \changes{v0.8}{2020/08/16}{Removed extraneous spacing and newlines
779 % in section headings}
780 % \begin{macro}{\section}
781 % \changes{v0.2}{2019/05/02}{Changed heading to small-caps}
782 % \begin{macro}{\subsection}
783 % \changes{v0.2}{2019/04/27}{Properly formatted}
784 % \changes{v0.2}{2019/05/02}{Changed heading to small-caps}
785 % \begin{macro}{\subsubsection}
786 % \changes{v0.2}{2019/04/27}{Properly formatted}
787 % \changes{v0.2}{2019/05/02}{Changed heading to small-caps}
788 % Section headings are neither defined nor discouraged
789 % in the \citetitle{mlahb}, though commonly used in longer papers.
790 % Customary section headings are rather straightforward,
791 % consisting of the section number in Arabic numerals, a space,
792 % and the section name with no special decoration\footnote{According to
793 % the popular, oft-referenced \ac{OWL}: \citeurl{owlmla}.}.
794 %
795 % However, for the sake of clarity, the section headings in this class
796 % will be set in small-caps by default.
797 % Plain, unnumbered and entirely unformatted section headings can
798 % be acheived using the \Dopt{plainheadings} option
799 % (see section~\ref{sec:options}).
800 % For custom headings other than these, refer to the
801 % \Dpkg{fancyhdr} package documentation.
802 %
803 % \begin{macrocode}
804 \renewcommand{\thesection}{\@arabic\c@section}
805 \renewcommand{\thesubsection}{\thesection.\@arabic\c@subsection}
806 \renewcommand{\thesubsubsection}{\thesubsection.\@arabic\c@subsubsection}
807 % \end{macrocode}
808 %
809 % Un-fancifying the headings is acheived using
810 % the \Dpkg{titlesec} package.
811 %
812 % \begin{macrocode}
813 \ifMLA@plainheadings
814 \titleformat{\section}[block]{\normalsize}{}{0pt}{}[]
815 \titleformat{\subsection}[block]{\normalsize}{}{0pt}{}[]
816 \titleformat{\subsubsection}[block]{\normalsize}{}{0pt}{}[]
817 \else
818 \titleformat{\section}[block]{\normalsize\sc}{\thetitle.\enspace}{0pt}{}[]
819 \titleformat{\subsection}[block]{\normalsize\sc}{\thetitle.\enspace}{0pt}{}[]
820 \titleformat{\subsubsection}[block]{\normalsize\sc}{\thetitle.\enspace}{0pt}{}[]
821 \fi
822 \titlespacing*{\section}{0pt}{0pt}{0pt}
823 \titlespacing*{\subsection}{0pt}{0pt}{0pt}
824 \titlespacing*{\subsubsection}{0pt}{0pt}{0pt}
825 \titlelabel{}
826 \patchcmd{\ttl@select}{\strut}{}{}{}
827 \patchcmd{\ttlh@hang}{\strut}{}{}{}
828 \patchcmd{\ttlh@hang}{\strut}{}{}{}
829 % \end{macrocode}
830 % \end{macro}
831 % \end{macro}
832 % \end{macro}
833 %
834 % \subsection{Lists}
835 % \label{sec:lists}
836 %
837 % \begin{environment}{itemize}
838 % \changes{v0.4}{2019/05/12}{Added list type}
839 % \begin{environment}{enumerate}
840 % \changes{v0.4}{2019/05/12}{Added list type}
841 % To the user, \Dlst{itemize} and \Dlst{enumerate} lists
842 % will function exactly as expected.
843 % However, the formatting of the lists must be modified as to
844 % preserve double-spacing and adhere to
845 % common practice\footnote{According to the \ac{MLA} itself:
846 % \url{https://style.mla.org/vertical-lists-in-mla-style/}.};
847 % these changes are acheived using the \Dpkg{enumitem} package.
848 %
849 % \begin{macrocode}
850 \setlist[itemize]{%
851 parsep=0pt,
852 itemsep=0pt,
853 topsep=0pt,
854 leftmargin=\parindent
855 }
856 \setlist[enumerate]{%
857 parsep=0pt,
858 itemsep=0pt,
859 topsep=0pt,
860 leftmargin=\parindent
861 }
862 % \end{macrocode}
863 % \end{environment}
864 % \end{environment}
865 %
866 % \changes{v1.1}{2024/09/12}{Modify footnotes to be more in-style}
867 % \subsection{Footnotes}
868 % \label{sec:footnotes}
869 %
870 % Footnotes are styled similarly to endnotes (see section \ref{sec:endnotes}),
871 % but in smaller text, and glued to the bottom of the page.
872 %
873 % \begin{macrocode}
874 \addtolength{\skip\footins}{1pc}
875 \renewcommand{\footnoterule}{%
876 \vfill
877 \kern -3pt\hrule width 0.4\columnwidth
878 \vskip 6pt
879 }
880 \renewcommand{\@makefnmark}{\@thefnmark}
881 \renewcommand{\@makefntext}[1]{%
882 \leftskip 0.5in
883 \parindent -0.5in
884 \@makefnmark.~#1
885 }
886 % \end{macrocode}
887 %
888 % \subsection{Block quotation}
889 % \label{sec:block_quoatation}
890 %
891 % \begin{environment}{blockquote}
892 % The \citetitle{mlahb} dictates blockquotes be set flush a half-inch
893 % from the left margin with no extra space on the right.
894 % The existing \Denv{blockquote} environment is re-defined
895 % for this purpose.
896 %
897 % \changes{v0.2}{2019/04/28}{Countered unexplained vertical space
898 % after environment}
899 % \begin{macrocode}
900 \renewenvironment{blockquote}{%
901 \list{}{\leftmargin 0.5in}
902 \item[]
903 \setlength{\parindent}{0.5in}
904 \vspace{-\topsep}
905 }{%
906 \endlist
907 \vspace{-\topsep}
908 }
909 % \end{macrocode}
910 % \end{environment}
911 %
912 % \subsection{Figures and tables}
913 % \label{sec:figures}
914 %
915 % The \citetitle{mlahb} doesn't specify much of anything about
916 % the actual formatting of figures or tables or their captions,
917 % so the following is mostly based on the package author's
918 % personal preference and observations.
919 %
920 % \begin{environment}{figure}
921 % \changes{v0.6}{2019/05/29}{Properly formatted}
922 % \begin{environment}{table}
923 % \changes{v0.6}{2019/05/29}{Properly formatted}
924 %
925 % Centered figures with margins the equivalent of one line of text
926 % seems customary and logical.
927 %
928 % \begin{macrocode}
929 \ifMLA@figures
930 \setlength{\floatsep}{\baselineskip}
931 \setlength{\intextsep}{\baselineskip}
932 \setlength{\textfloatsep}{\baselineskip}
933 \g@addto@macro\@floatboxreset\centering
934 \fi
935 % \end{macrocode}
936 %
937 % Thanks to a bug inherited from the \Dpkg{here} package
938 % which has remained unfixed since 1987\footnote{See the \cs{par}
939 % on p.\ 11, line 249 of \Dfile{ltfloat.dtx} from the \LaTeX\ kernel.},
940 % there is not only extra space after the figure but the inability to
941 % insert a figure within a paragraph.
942 % Miraculously, there is a fix for this\footnote{See David Carlisle's
943 % answer on \TeX\ \acs{SE}:
944 % \url{https://tex.stackexchange.com/a/310793}}.
945 %
946 % \begin{macrocode}
947 \ifMLA@figures
948 \renewcommand{\float@endH}{%
949 \vspace{-12pt}
950 \@endfloatbox\vskip\intextsep
951 \if@flstyle\setbox\@currbox\float@makebox\columnwidth\fi
952 \box\@currbox\vskip\intextsep\relax\@doendpe
953 }
954 \fi
955 % \end{macrocode}
956 %
957 % \end{environment}
958 % \end{environment}
959 %
960 % \begin{environment}{caption}
961 % \changes{v0.6}{2019/05/29}{Properly formatted}
962 %
963 % Un-fancifying the caption is acheived using the
964 % \Dpkg{caption} package.
965 %
966 % \begin{macrocode}
967 \ifMLA@figures
968 \captionsetup{%
969 font={normalfont},
970 labelformat=simple,
971 labelsep=period,
972 position=bottom,
973 aboveskip=6pt,
974 belowskip=-10pt
975 }
976 \fi
977 % \end{macrocode}
978 %
979 % In the author's personal experience, most \ac{MLA}-style papers
980 % use \mentioned{Fig.} and not \mentioned{Figure}.
981 %
982 % \begin{macrocode}
983 \ifMLA@figures
984 \captionsetup[figure]{name=Fig.}
985 \fi
986 % \end{macrocode}
987 %
988 % \end{environment}
989 %
990 % \subsection{Paper sections}
991 % \label{sec:paper_sections}
992 %
993 % \subsubsection{Paper}
994 % \label{sec:paper_env}
995 %
996 % \begin{environment}{paper}
997 % The main content; the body.
998 % This environment exists only for a logical division and does
999 % nothing special.
1000 %
1001 % \changes{v0.5}{2019/05/18}{Removed \cs{newpage}}
1002 % \begin{macrocode}
1003 \newenvironment{paper}{}{}
1004 % \end{macrocode}
1005 % \end{environment}
1006 %
1007 % \subsubsection{Endnotes}
1008 % \label{sec:endnotes}
1009 %
1010 % \begin{environment}{notes}
1011 % Endnotes can be typeset manually or with the supported
1012 % \Dpkg{enotez} package\footnote{Refer to the \Dpkg{enotez}
1013 % documentation for instructions.}.
1014 %
1015 % \changes{v0.2}{2019/04/28}{Added environment}
1016 % \changes{v0.2}{2019/04/28}{Countered unexplained vertical space
1017 % after heading}
1018 % \changes{v0.4}{2019/05/12}{Changed endnotes list type to
1019 % custom \Dlst{mlaendnotes} list}
1020 % \changes{v0.4}{2019/05/12}{Changed default endnotes format
1021 % to \Dlst{mla}}
1022 % \changes{v0.4}{2019/05/12}{Removed extra \cs{vspace}}
1023 % \changes{v0.5}{2019/05/18}{Moved \cs{newpage} to beginning of environment}
1024 % \begin{macrocode}
1025 \newenvironment{notes}{%
1026 \newpage
1027 \begin{noindent}
1028 \pdfbookmark[0]{Notes}{notes}
1029 \begin{center}Notes\end{center}
1030 \end{noindent}
1031 }{}
1032 % \end{macrocode}
1033 % \end{environment}
1034 %
1035 % To correctly format endnotes per common practice\footnote{According
1036 % to the popular, oft-referenced \ac{OWL}: \citeurl{owlendnotes}.},
1037 % a custom \Dlst{mlanotes} list type will be created.
1038 % This is acheived with the \Dpkg{enumitem} package.
1039 %
1040 % \begin{macrocode}
1041 \ifMLA@notes
1042 \newlist{mlanotes}{description}{1}
1043 \setlist[mlanotes]{%
1044 parsep=0pt,
1045 itemsep=0pt,
1046 topsep=0pt,
1047 leftmargin=\parindent
1048 }
1049 \fi
1050 % \end{macrocode}
1051 %
1052 % The following initializes the \Dpkg{enotez} package to use
1053 % the \Dlst{mlanotes} list format.
1054 %
1055 % \begin{macrocode}
1056 \ifMLA@notes
1057 \DeclareInstance{enotez-list}{mla}{list}{%
1058 heading = {},
1059 format = \normalsize\normalfont,
1060 list-type = mlanotes
1061 }
1062 \setenotez{list-name={},list-style=mla,backref}
1063 \fi
1064 % \end{macrocode}
1065 %
1066 % See section \ref{sec:footnotes} for footnotes.
1067 %
1068 % \subsubsection{Bibliography}
1069 % \label{sec:bibliography}
1070 %
1071 % \begin{environment}{workscited}
1072 % The bibliography can be typeset manually or with the supported
1073 % \Dpkg{biblatex} package\footnote{Refer to the \Dpkg{biblatex}
1074 % documentation for instructions.}.
1075 %
1076 % \changes{v0.2}{2019/04/28}{Countered unexplained vertical space
1077 % after heading}
1078 % \changes{v0.5}{2019/05/18}{Moved \cs{newpage} to beginning of environment}
1079 % \changes{v0.7}{2019/08/30}{Changed correction spacing from 16pt to 10pt}
1080 % \begin{macrocode}
1081 \newenvironment{workscited}{%
1082 \newpage
1083 \begin{noindent}
1084 \pdfbookmark[0]{Works Cited}{workscited}
1085 \begin{center}Works Cited\end{center}
1086 \end{noindent}
1087 \vspace{-10pt} % XXX to counter unexplained space
1088 }{}
1089 % \end{macrocode}
1090 % \end{environment}
1091 %
1092 % The \citetitle{mlahb} prescribes a half-inch hanging indent
1093 % on all bibliography entries.
1094 % This is achieved by setting the \cs{bibhang} length
1095 % defined by the \Dpkg{biblatex} package.
1096 %
1097 % \begin{macrocode}
1098 \setlength{\bibhang}{\parindent}
1099 % \end{macrocode}
1100 %
1101 % \appendix
1102 % \section{Example usage}
1103 % \label{sec:example_usage}
1104 %
1105 % Following is a basic \LaTeX\ document using the \Dcls{mla} class.
1106 % The document is composed of a text file, \Dfile{mla-example.tex},
1107 % and a \Dpkg{biblatex} bibliography file, \Dfile{mla-example.bib}.
1108 %
1109 % \subsection{\Dfile{mla-example.tex}}
1110 % \label{sec:mla-example.tex}
1111 %
1112 % \verbatiminput{mla-example.tex}
1113 %
1114 % \subsection{\Dfile{mla-example.bib}}
1115 % \label{sec:mla-example.bib}
1116 %
1117 % \verbatiminput{mla-example.bib}
1118 %
1119 % \Finale
1120 \endinput