diff options
author | Karl Berry <karl@freefriends.org> | 2019-05-03 22:31:18 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-05-03 22:31:18 +0000 |
commit | 498041140bb5ef80636052ba6cec50fc5291f0a0 (patch) | |
tree | 732ab54c0adbf240e3935ae7ccab5b49817bb643 /Master/texmf-dist/source | |
parent | 14849b2636be5c6ff3c2800ef9e5428ce3a83722 (diff) |
mlacls (3may19)
git-svn-id: svn://tug.org/texlive/trunk@50974 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/mlacls/mla.dtx | 567 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/mlacls/mla.ins | 53 |
2 files changed, 620 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/mlacls/mla.dtx b/Master/texmf-dist/source/latex/mlacls/mla.dtx new file mode 100644 index 00000000000..76ac4506b90 --- /dev/null +++ b/Master/texmf-dist/source/latex/mlacls/mla.dtx @@ -0,0 +1,567 @@ +% \iffalse meta-comment +% +% Copyright 2019 Seth Price. +% +% This file may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either +% version 1.3 of this license or 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. +% +% \fi + +% \iffalse +% +% \section{Identification} +% +% For the \textsf{driver} code: +% +%<*driver> +\ProvidesFile{mla.dtx} +%</driver> +% +% The \Dclass{mla} class has only been tested with \LaTeXe , +% so we will make sure it doesn't get included in something else: +% \begin{macrocode} +%<mla>\NeedsTeXFormat{LaTeX2e} +% \end{macrocode} +% +% Announce the class name and its version: +% \begin{macrocode} +%<mla>\ProvidesClass{mla} +%<*mla> + [2019/05/02 v0.2 MLA Paper Class] +%</mla> +% \end{macrocode} +% +% \subsection{Documentation driver} +% +% The following is a boilerplate documentation driver for \TeX{}. +% In short, it produces the documentation you're currently reading. +% +% \begin{macrocode} +%<*driver> +\documentclass{ltxdoc} +\AtBeginDocument{\RecordChanges\CodelineIndex\EnableCrossrefs} +\AtEndDocument{\PrintIndex} + +% These bits are some common shorthand I picked up +\newcommand*{\Dfile}[1]{\texttt{#1}} +\newcommand*{\Dopt}[1]{\textsf{\small #1}} +\newcommand*{\Dctr}[1]{\textsl{\small #1}} +\newcommand*{\Dclass}[1]{\textsf{#1}} +\newcommand*{\Dpkg}[1]{\textsf{#1}} +\newcommand*{\Denv}[1]{\textsf{#1}} + +% Needed for the appendix +\usepackage{verbatim} + +% I just want section headers in my PDF +\usepackage[hidelinks]{hyperref} + +% Manually specify PDF metadata +\hypersetup{ + pdfinfo={ + Title=The MLA class, + Author=Seth Price, + Creator=LaTeX + } +} + +\GetFileInfo{mla.dtx} + +\begin{document} +\DocInput{mla.dtx} +\end{document} +%</driver> +% \end{macrocode} +% \fi +% +% \CheckSum{0} +% +% \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 +% 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 +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% \title{The \Dclass{mla} class\thanks{This document corresponds to +% \Dclass{mla}~\fileversion, dated \filedate.}} +% \author{Seth Price \\ \texttt{ssterling@firemail.cc}} +% \date{\filedate} +% +% \maketitle +% +% \begin{abstract} +% Whilst the \TeX\ family of programs is widely used in the sciences +% and academia overall, there seems to be a lack of support for +% the humanities, which commonly adhere to MLA format for +% student papers and reports. +% +% Though there \emph{are} MLA-style packages available, +% none met the expectations of the author (who was mostly +% just nit-picky about elegance in code). +% So \textit{voil\`a}, there now exists a proper \Dfile{mla.cls}: +% a simple, straightforward class for composing papers +% almost perfectly adherent to the MLA style guide. +% \end{abstract} +% +% \tableofcontents +% +% \StopEventually{} ^^A +% +% \section{Initial code} +% \label{sec:initial_code} +% +% The \Dclass{mla} class is based off the \Dclass{article} class, +% so common macros such as \cs{textit} or \cs{figure} are +% useable as expected. +% Not to say we won't be re-defining a lot of macros, though. +% \begin{macrocode} +\LoadClass[letterpaper,12pt]{article} +% \end{macrocode} +% +% \begin{macro}{\mladate} +% MLA requires use of \textit{day month year} dates, not \TeX's +% standard \textit{month, day year}. +% Here we'll define our own \cs{mladate} to give correct output. +% \begin{macrocode} +\newcommand{\mladate}{% + \the\day\ + \ifcase\the\month + \or January + \or February + \or March + \or April + \or May + \or June + \or July + \or September + \or October + \or November + \or December + \fi + \the\year +} +% \end{macrocode} +% \end{macro} +% +% \section{Options} +% \label{sec:options} +% +% Some instructors will still require usage of the seventh edition of MLA. +% MLA 8e is the default for this class, but either can be explicitly specified +% with the \Dopt{mla8} or \Dopt{mla7} options. +% All this actually does is change the edition specified to the +% \Dclass{biblatex} package when loaded in in +% section~\ref{sec:loading_packages}. +% +% \begin{macrocode} +\DeclareOption{mla7}{% + \def\blopts{style=mla,noremoteinfo=false,showmedium=true} +} +\DeclareOption{mla8}{% + \def\blopts{style=mla-new,noremoteinfo=false,showmedium=false} +} +% \end{macrocode} +% +% \subsection{Processing} +% \label{sec:processing} +% +% The default is to use the eighth edition of MLA. +% Just in case something changes, however, it's wise to explicitly +% specify \Dopt{mla8} in \cs{documentclass}. +% +% \begin{macrocode} +\ExecuteOptions{mla8} +\ProcessOptions\relax +% \end{macrocode} +% +% \section{Loading packages} +% \label{sec:loading_packages} +% +% The \Dclass{mla} class requires the following packages to work: +% +% \begin{macrocode} +\RequirePackage{enotez} +\RequirePackage{fancyhdr} +\RequirePackage{fullpage} +\RequirePackage{indentfirst} +\RequirePackage{ragged2e} +\RequirePackage{times} +\RequirePackage{titlesec} +\RequirePackage{xstring} +% \end{macrocode} +% +% And after all that, we finally load \Dpkg{biblatex} for the bibliography. +% The other packages here are prerequisites for \Dpkg{biblatex-mla}. +% \begin{macrocode} +\RequirePackage[american]{babel} +\RequirePackage{csquotes} +\RequirePackage{hanging} +\RequirePackage[hidelinks,pdfusetitle]{hyperref} +\RequirePackage[\blopts,backend=biber]{biblatex} +% \end{macrocode} +% +% \section{Document Layout} +% \label{sec:document_layout} +% +% Now for the difficult part. +% A lot of professors are \emph{really} strict when it comes to laying out +% the paper right, so we can't take any chances here. +% +% \subsection{Font} +% \label{sec:font} +% +% The \Dpkg{times} package was already loaded in +% section~\ref{sec:loading_packages}, and the font size was set to +% 12pt when loading the \Dclass{article} class in +% section~\ref{sec:initial_code}. +% This should be metric-compatible with the infamous Times New Roman, +% the \textit{de facto} standard of the MLA format. +% +% \subsection{Line spacing and breaking} +% \label{sec:line_breaking} +% +% The MLA prescribes perfect double-spacing, but \LaTeX\ does it +% a little \emph{too} perfect, putting one less line of text on the +% paper than expected from the ``industry standard'', Microsoft Word. +% We'll compensate by setting the line spacing to \textit{just enough}. +% \begin{macrocode} +\linespread{1.99} +% \end{macrocode} +% +% To further adhere to the MLA style guide, we'll forego all hyphenation +% and allow weird line breaks and uncanny whitespace. +% \begin{macrocode} +\hyphenpenalty 10000 +\pretolerance 10000 +% \end{macrocode} +% +% \subsection{Paragraphing} +% \label{sec:paragraphing} +% +% MLA prescribes half-inch indents on the first line of each paragraph +% with no spaces in between. +% (Some professors will request you separate sections of lengthy papers, +% however; just put a paragraph in between the two consisting of ``\cs{par}''.) +% \begin{macrocode} +\setlength{\parindent}{0.5in} +\setlength{\RaggedRightParindent}{\parindent} +\setlength{\parskip}{0em} +\setlength{\topsep}{0em} +% \end{macrocode} +% +% MLA also cares more about consistent page count than beautiful typesetting. +% So, we'll accept our fate and allow orphans and widows for the sake of +% uniform line count. +% \begin{macrocode} +\widowpenalty 0 +\clubpenalty 0 +\interlinepenalty 0 +% \end{macrocode} +% +% We also want flush-left ragged lines. +% (This is acheived with the \Dpkg{ragged2e} package.) +% \begin{macrocode} +\RaggedRight +% \end{macrocode} +% +% \begin{environment}{noindent} +% The \Denv{noindent} environment works a little wonky when working with +% the \Dpkg{ragged2e} package, so we'll re-define it. +% \begin{macrocode} +\renewenvironment{noindent}{% + \edef\tmpind{\parindent} + \setlength{\parindent}{0pt} +}{% + \setlength{\parindent}{\tmpind} + \undef{\tmpind} +} +% \end{macrocode} +% +% \end{environment} +% +% \subsection{Page layout} +% \label{sec:page_layout} +% +% The MLA uses standard ``letter-size'' paper, and that's almost +% all we have in America anyway. +% The paper size was already set to letter when loading the +% \Dclass{article} class in section~\ref{sec:initial_code}. +% +% Furthermore, +% the MLA prescribes uniform one-inch margins on said letter-size paper. +% This is taken care of with the \Dpkg{fullpage} package loaded in +% section~\ref{sec:loading_packages}. The \cs{textheight} and \cs{textwidth} +% definitions are here just for good measure. +% \begin{macrocode} +\setlength{\textheight}{9in} +\setlength{\textwidth}{6.5in} +% \end{macrocode} +% +% \subsection{Running head} +% \label{sec:running_head} +% +% The running head in MLA style is simply the author's surname +% followed by the page number, right-aligned. +% This is managed using the \Dpkg{fancyhdr} and \Dpkg{xstring} packages. +% +% \begin{macrocode} +\fancypagestyle{norule}{% + \renewcommand{\headrulewidth}{0pt} + \renewcommand{\footrulewidth}{0pt} +} +\fancyhf{} +\pagestyle{headings} +\pagestyle{norule} +\fancyhead[RO]{{\StrBehind{\@author}{ }[\last]\last} \thepage} +% \end{macrocode} +% +% I have to fully admit I don't know what the following code +% actually does, but I tweaked around the variables to get it all +% in the right place. +% +% \begin{macrocode} +\setlength{\headheight}{18pt} +\setlength{\headsep}{12pt} +\setlength{\voffset}{-34pt} +% \end{macrocode} +% +% \section{Document Markup} +% \label{sec:document_markup} +% +% \subsection{The header} +% \label{sec:the_header} +% +% \begin{macro}{\title} +% \begin{macro}{\author} +% \begin{macro}{\date} +% The \cs{title}, \cs{author} and +% \cs{date} macros are already defined in \Dfile{latex.dtx}. +% Their definitions are shown here for reference. +% \begin{macrocode} +% \newcommand*{\title}[1]{\gdef\@title{#1}} +% \newcommand*{\author}[1]{\gdef\@author{#1}} +% \newcommand*{\date}[1]{\gdef\@date{#1}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% The following, however, are unique to the \Dclass{mla} class. +% +% \begin{macro}{\professor} +% The name of whoever assigned the paper, i.e. ``Dr Marjorie Stewart''. +% \begin{macrocode} +\newcommand*{\professor}[1]{\gdef\@professor{#1}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\course} +% The course for which this paper was assigned, i.e. ``ENGL 101-02''. +% \begin{macrocode} +\newcommand*{\course}[1]{\gdef\@course{#1}} +% \end{macrocode} +% \end{macro} +% +% We make sure the internal macros used to store the above information +% are empty, lest something weird happen. \cs{date}, however, +% is generally set to the current date. +% \begin{macrocode} +\title{} +\author{} +\professor{} +\course{} +\date{\today} +% \end{macrocode} +% +% \begin{macro}{\makemlaheader} +% This command prints out the standard five-line MLA header, +% including the centered title. +% (Note the use of \cs{mladate}; see section \ref{sec:initial_code}.) +% \begin{macrocode} +\newcommand{\makemlaheader}{% + \begin{noindent} + \@author \\ + \@professor \\ + \@course \\ + \mladate \\ + \begin{center}\@title\end{center} + \end{noindent} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\maketitle} +% And we'll just re-define \cs{maketitle} to execute \cs{makemlaheader}. +% \begin{macrocode} +\renewcommand{\maketitle}{\makemlaheader} +% \end{macrocode} +% \end{macro} +% +% \subsection{Sectioning} +% \label{sec:sectioning} +% +% \begin{macro}{\section} +% \begin{macro}{\subsection} +% \begin{macro}{\subsubsection} +% Customary section headers are rather straightforward and only consist of +% the section number in Arabic numerals, a space and the section name, +% flush left. +% However, for the sake of clarity, we'll put ours in small-caps. +% +% \begin{macrocode} +\renewcommand{\thesection}{\@arabic\c@section} +\renewcommand{\thesubsection}{\thesection.\@arabic\c@subsection} +\renewcommand{\thesubsubsection}{\thesubsection.\@arabic\c@subsubsection} +% \end{macrocode} +% +% Un-fancifying the section headers is acheived using the +% \Dpkg{titlesec} package. +% +% \begin{macrocode} +\titleformat*{\section}{\normalsize\sc} +\titleformat*{\subsection}{\normalsize\sc} +\titleformat*{\subsubsection}{\normalsize\sc} +\titlespacing*{\section}{0pt}{0pt}{0pt} +\titlespacing*{\subsection}{0pt}{0pt}{0pt} +\titlespacing*{\subsubsection}{0pt}{0pt}{0pt} +\titlelabel{\thetitle. } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \TeX\ generally doesn't indent the first paragraph after a +% section header. +% Since this violates MLA style, we'll simply rely on the +% \Dpkg{indentfirst} package as loaded in +% section~\ref{sec:loading_packages}. +% +% \subsection{Block quotation} +% \label{sec:block_quotation} +% +% \begin{environment}{blockquote} +% MLA dictates block quotes be set flush $0.5$in from the left margin. +% We'll re-define the \Denv{blockquote} environment for this purpose. +% The following looks like a complete hack\ldots because it is, honestly. +% +% \begin{macrocode} +\renewenvironment{blockquote}{% + \list{}{\leftmargin 0.5in} + \item[] + \setlength{\parindent}{0.5in} + \vspace{-\topsep} +}{% + \endlist + \vspace{-\topsep} +} +% \end{macrocode} +% \end{environment} +% +% \subsection{Paper sections} +% +% \subsubsection{Paper} +% +% \begin{environment}{paper} +% The main content; the body. +% Most everything you write will be in here. +% \begin{macrocode} +\newenvironment{paper}{% + \makemlaheader +}{% + \newpage +} +% \end{macrocode} +% \end{environment} +% +% \subsubsection{Endnotes} +% \label{sec:endnotes} +% +% \begin{environment}{notes} +% If you have any endnotes, they can be put in the +% \Denv{notes} environment. +% \begin{macrocode} +\newenvironment{notes}{% + \begin{noindent} + \pdfbookmark[0]{Notes}{notes} + \begin{center}Notes\end{center} + \end{noindent} + \vspace{-16pt} % XXX to counter unexplained space +}{% + \newpage +} +% \end{macrocode} +% \end{environment} +% +% The MLA doesn't prescribe a strict set of rules for endnotes, +% so the following is just to clean it up and make it consistent. +% We're assuming the required \Dpkg{enotez} package is used; +% refer to its documetation for an explanation of the following. +% \begin{macrocode} +\setenotez{list-name={}} +\DeclareInstance{enotez-list}{mla}{list}{% + heading = {}, + format = \normalsize\normalfont, + list-type = description +} +% \end{macrocode} +% +% \subsubsection{Bibliography} +% \label{sec:bibliography} +% +% \begin{environment}{workscited} +% This environment creates the bibliography, starting on +% the next counted page number. +% \begin{macrocode} +\newenvironment{workscited}{% + \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} +% +% MLA prescribes a half-inch hanging indent on all +% bibliography entries. +% This is acheived by setting the \cs{bibhang} macro +% defined in the \Dpkg{biblatex} package. +% \begin{macrocode} +\setlength{\bibhang}{\parindent} +% \end{macrocode} +% +% \appendix +% \section{Example usage} +% \label{sec:example_usage} +% +% Following is a basic \LaTeXe\ document using \Dfile{mla.cls} +% and its corresponding bibliography. +% +% \subsection{\texttt{example.tex}} +% +% \verbatiminput{example.tex} +% +% \subsection{\texttt{example.bib}} +% +% \verbatiminput{example.bib} +% +% \Finale +\endinput diff --git a/Master/texmf-dist/source/latex/mlacls/mla.ins b/Master/texmf-dist/source/latex/mlacls/mla.ins new file mode 100644 index 00000000000..8afb5099c34 --- /dev/null +++ b/Master/texmf-dist/source/latex/mlacls/mla.ins @@ -0,0 +1,53 @@ +%% vim: set ft=tex: +%% +%% Copyright 2019 Seth Price. +%% +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or 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. +%% + +\input docstrip.tex + +%\usedir{tex/latex/mla} + +\preamble + +This is a generated file. + +Copyright 2019 Seth Price + +This file may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either +version 1.3 of this license or 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. + +\endpreamble + +\generate{\file{mla.cls}{\from{mla.dtx}{mla}}} + +\obeyspaces +\Msg{****************************************************} +\Msg{* *} +\Msg{* To finish installation, move the file `mla.cls` *} +\Msg{* into a directory searchable by LaTeX. *} +\Msg{* *} +\Msg{* To produce documentation, run the file `mla.dtx' *} +\Msg{* through LaTeX. *} +\Msg{* *} +\Msg{* Happy TeXing! *} +\Msg{* *} +\Msg{****************************************************} + +\endbatchfile |