Fixed nested underlining
[latex-mlastyle.git] / mlastyle.dtx
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 2003 by Tim Pope <latex@rebelongto.us>
4 % ----------------------------------------------------
5
6 % This file may be distributed and/or modified under the
7 % conditions of the LaTeX Project Public License, either version 1.2
8 % of this license or (at your option) any later version.
9 % The latest version of this license is in:
10 %
11 %    http://www.latex-project.org/lppl.txt
12 %
13 % and version 1.2 or later is part of all distributions of LaTeX 
14 % version 1999/12/01 or later.
15 %
16 % \fi
17 %
18 % \iffalse
19 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
20 %<package>\ProvidesPackage{mlastyle}
21 %<package>   [2003/11/09 v0.9 MLA format and documentation style]
22 %
23 %<*driver>
24 \documentclass[draft]{ltxdoc}
25 \iftrue
26   \usepackage[compat]{mlastyle}
27   \addtolength{\headsep}{-5pt}
28   %\addtolength{\headheight}{-12pt}
29   \addtolength{\topmargin}{-17pt}
30   \addtolength{\textheight}{22pt}
31   \IfFileExists{ulem.sty}{\usepackage[normalem]{ulem}}{\let\uline\emph}
32 \else
33   \usepackage[mla]{mlastyle}
34   \addtolength{\marginparwidth}{1in}
35   \addtolength{\textwidth}{-1in}
36   \addtolength{\headwidth}{-1in}
37 \fi
38 \IfFileExists{times.sty}%
39 {\newcommand{\examp}[2][]{{\let\emph\uline\fontfamily{ptm}\selectfont##2}##1}}%
40 {\newcommand{\examp}[2][]{``##2##1''}}
41
42 \EnableCrossrefs
43 \CodelineIndex
44 \RecordChanges
45 %\OnlyDescription
46 \begin{document}
47   \DocInput{mlastyle.dtx}
48 \end{document}
49 %</driver>
50 % \fi
51 %
52 % \CheckSum{0}
53 %
54 % \CharacterTable
55 %  {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
56 %   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
57 %   Digits        \0\1\2\3\4\5\6\7\8\9
58 %   Exclamation   \!     Double quote  \"     Hash (number) \#
59 %   Dollar        \$     Percent       \%     Ampersand     \&
60 %   Acute accent  \'     Left paren    \(     Right paren   \)
61 %   Asterisk      \*     Plus          \+     Comma         \,
62 %   Minus         \-     Point         \.     Solidus       \/
63 %   Colon         \:     Semicolon     \;     Less than     \<
64 %   Equals        \=     Greater than  \>     Question mark \?
65 %   Commercial at \@     Left bracket  \[     Backslash     \\
66 %   Right bracket \]     Circumflex    \^     Underscore    \_
67 %   Grave accent  \`     Left brace    \{     Vertical bar  \|
68 %   Right brace   \}     Tilde         \~}
69 %
70 %
71 % \changes{v0.9}{2003/11/09}{Converted to \texttt{dtx} file}
72 % \changes{v0.8}{2003/10/15}{Initial version}
73 %
74 % \GetFileInfo{mlastyle.sty}
75 %
76 % \DoNotIndex{\ }
77 % \DoNotIndex{\.}
78 % \DoNotIndex{\@afterindentfalse}
79 % \DoNotIndex{\@afterindenttrue}
80 % \DoNotIndex{\@arabic}
81 % \DoNotIndex{\@author}
82 % \DoNotIndex{\@auxout}
83 % \DoNotIndex{\@citea}
84 % \DoNotIndex{\@citeb}
85 % \DoNotIndex{\@date}
86 % \DoNotIndex{\@empty}
87 % \DoNotIndex{\@firstofone}
88 % \DoNotIndex{\@for}
89 % \DoNotIndex{\@ifundefined}
90 % \DoNotIndex{\@latex@warning}
91 % \DoNotIndex{\@listI}
92 % \DoNotIndex{\@listi}
93 % \DoNotIndex{\@listii}
94 % \DoNotIndex{\@listiii}
95 % \DoNotIndex{\@listiv}
96 % \DoNotIndex{\@listv}
97 % \DoNotIndex{\@listvi}
98 % \DoNotIndex{\@startsection}
99 % \DoNotIndex{\@tempswafalse}
100 % \DoNotIndex{\@title}
101 % \DoNotIndex{\@undefined}
102 % \DoNotIndex{\DeclareOption}
103 % \DoNotIndex{\ExecuteOptions}
104 % \DoNotIndex{\G@refundefinedtrue}
105 % \DoNotIndex{\ProcessOptions}
106 % \DoNotIndex{\RequirePackage}
107 % \DoNotIndex{\addtolength}
108 % \DoNotIndex{\advance}
109 % \DoNotIndex{\baselineskip}
110 % \DoNotIndex{\begin}
111 % \DoNotIndex{\bfseries}
112 % \DoNotIndex{\c@enumiv}
113 % \DoNotIndex{\catcode}
114 % \DoNotIndex{\centering}
115 % \DoNotIndex{\centerline}
116 % \DoNotIndex{\chapter}
117 % \DoNotIndex{\citation}
118 % \DoNotIndex{\clearpage}
119 % \DoNotIndex{\csname}
120 % \DoNotIndex{\day}
121 % \DoNotIndex{\def}
122 % \DoNotIndex{\do}
123 % \DoNotIndex{\edef}
124 % \DoNotIndex{\else}
125 % \DoNotIndex{\end}
126 % \DoNotIndex{\endcsname}
127 % \DoNotIndex{\endlist}
128 % \DoNotIndex{\exhyphenpenalty}
129 % \DoNotIndex{\expandafter}
130 % \DoNotIndex{\f@baselineskip}
131 % \DoNotIndex{\fancyhf}
132 % \DoNotIndex{\fancypagestyle}
133 % \DoNotIndex{\fi}
134 % \DoNotIndex{\futurelet}
135 % \DoNotIndex{\gdef}
136 % \DoNotIndex{\hangindent}
137 % \DoNotIndex{\headrulewidth}
138 % \DoNotIndex{\if@filesw}
139 % \DoNotIndex{\if@tempswa}
140 % \DoNotIndex{\ifcase}
141 % \DoNotIndex{\ifmlastyle@bibstyle}
142 % \DoNotIndex{\ifmlastyle@format}
143 % \DoNotIndex{\ifmlastyle@papersize}
144 % \DoNotIndex{\ifmlastyle@style}
145 % \DoNotIndex{\ifmlastyle@times}
146 % \DoNotIndex{\ifmlastyle@underline}
147 % \DoNotIndex{\ifx}
148 % \DoNotIndex{\immediate}
149 % \DoNotIndex{\item}
150 % \DoNotIndex{\itemindent}
151 % \DoNotIndex{\itemsep}
152 % \DoNotIndex{\labelsep}
153 % \DoNotIndex{\labelwidth}
154 % \DoNotIndex{\leavevmode}
155 % \DoNotIndex{\leftmargin}
156 % \DoNotIndex{\leftmargini,\leftmarginii,\leftmarginiii}
157 % \DoNotIndex{\leftmarginiv,\leftmarginv,\leftmarginvi}
158 % \DoNotIndex{\let}
159 % \DoNotIndex{\linespread}
160 % \DoNotIndex{\list}
161 % \DoNotIndex{\listparindent}
162 % \DoNotIndex{\makeenmark}
163 % \DoNotIndex{\mbox}
164 % \DoNotIndex{\mlastyle@bibstylefalse}
165 % \DoNotIndex{\mlastyle@bibstyletrue}
166 % \DoNotIndex{\mlastyle@cite}
167 % \DoNotIndex{\mlastyle@course}
168 % \DoNotIndex{\mlastyle@formatfalse}
169 % \DoNotIndex{\mlastyle@formattrue}
170 % \DoNotIndex{\mlastyle@instructor}
171 % \DoNotIndex{\mlastyle@intbib}
172 % \DoNotIndex{\mlastyle@papersizefalse}
173 % \DoNotIndex{\mlastyle@papersizetrue}
174 % \DoNotIndex{\mlastyle@qspread}
175 % \DoNotIndex{\mlastyle@sl@sh}
176 % \DoNotIndex{\mlastyle@slash}
177 % \DoNotIndex{\mlastyle@slashnext}
178 % \DoNotIndex{\mlastyle@slashx}
179 % \DoNotIndex{\mlastyle@stylefalse}
180 % \DoNotIndex{\mlastyle@styletrue}
181 % \DoNotIndex{\mlastyle@surname}
182 % \DoNotIndex{\mlastyle@timesfalse}
183 % \DoNotIndex{\mlastyle@timestrue}
184 % \DoNotIndex{\mlastyle@underlinefalse}
185 % \DoNotIndex{\mlastyle@underlinetrue}
186 % \DoNotIndex{\month}
187 % \DoNotIndex{\newblock}
188 % \DoNotIndex{\newcommand}
189 % \DoNotIndex{\newenvironment}
190 % \DoNotIndex{\newif}
191 % \DoNotIndex{\newpage}
192 % \DoNotIndex{\noindent}
193 % \DoNotIndex{\normalsize}
194 % \DoNotIndex{\notesname}
195 % \DoNotIndex{\number}
196 % \DoNotIndex{\or}
197 % \DoNotIndex{\p@}
198 % \DoNotIndex{\pagestyle}
199 % \DoNotIndex{\par}
200 % \DoNotIndex{\parindent}
201 % \DoNotIndex{\parsep}
202 % \DoNotIndex{\penalty}
203 % \DoNotIndex{\relax}
204 % \DoNotIndex{\renewcommand}
205 % \DoNotIndex{\renewenvironment}
206 % \DoNotIndex{\reset@font}
207 % \DoNotIndex{\rhead}
208 % \DoNotIndex{\selectfont}
209 % \DoNotIndex{\setlength}
210 % \DoNotIndex{\settowidth}
211 % \DoNotIndex{\sfcode}
212 % \DoNotIndex{\skip}
213 % \DoNotIndex{\sloppy}
214 % \DoNotIndex{\space}
215 % \DoNotIndex{\string}
216 % \DoNotIndex{\sw@llow}
217 % \DoNotIndex{\the}
218 % \DoNotIndex{\thebibliography}
219 % \DoNotIndex{\thepage}
220 % \DoNotIndex{\topsep}
221 % \DoNotIndex{\usecounter}
222 % \DoNotIndex{\vskip}
223 % \DoNotIndex{\write}
224 % \DoNotIndex{\year}
225 % \DoNotIndex{\z@}
226 % \DoNotIndex{\evensidemargin}
227 % \DoNotIndex{\headheight}
228 % \DoNotIndex{\headsep}
229 % \DoNotIndex{\hoffset}
230 % \DoNotIndex{\marginparwidth}
231 % \DoNotIndex{\oddsidemargin}
232 % \DoNotIndex{\raggedbottom}
233 % \DoNotIndex{\raggedright}
234 % \DoNotIndex{\textheight}
235 % \DoNotIndex{\textwidth}
236 % \DoNotIndex{\topmargin}
237 % \DoNotIndex{\voffset}
238 % \DoNotIndex{\paperheight}
239 % \DoNotIndex{\paperwidth}
240 % \DoNotIndex{\pdfpageheight}
241 % \DoNotIndex{\pdfpagewidth}
242 % \DoNotIndex{\special}
243 %
244 % \hyphenation{pre-am-ble wide-spread}
245 %
246 % \newcommand{\Lopt}[1]{\textsf {#1}}
247 % \newcommand{\file}[1]{\texttt {#1}}
248 % \newcommand{\package}[1]{\textsf {#1}}
249 % ^^A\newcommand{\Lcount}[1]{\textsl {\small#1}}
250 % ^^A\newcommand{\pstyle}[1]{\textsl {#1}}
251 %
252 % \newcommand{\OptionIndex}[1]{\index{#1\actualchar\Lopt{#1} (option)\encapchar usage}\index{options:\levelchar\Lopt{#1}}}
253 %
254 % \title{The \package{mlastyle} package\thanks{This document
255 %   corresponds to \package{mlastyle}~\fileversion, dated \filedate.}}
256 % \author{Tim Pope \\ \texttt{latex@rebelongto.us}}
257 % \surname{Pope}
258 %
259 % \maketitle
260 % \tableofcontents
261 %
262 % \section{Introduction}
263 %
264 % MLA style, consisting of a set of documentation conventions, has
265 % gained widespread acceptance in the humanities.  \LaTeX{} is a
266 % document preparation system enjoying popularity in the scientific field.
267 % It should come as no surprise that complete, up-to-date implementations
268 % of MLA style for \LaTeX{} are in short supply.  The \LaTeX{} package
269 % \package{mlastyle} aims to fill this void.
270 %
271 % \section{Usage}
272 %
273 % A sample document follows.
274 % \begin{verbatim}
275 %\documentclass[12pt]{article}
276 %\usepackage{mlastyle}
277 %
278 %\author{John Doe}
279 %\instructor{Professor Smith}
280 %\course{English 101}
281 %\date{1~Jan.\ 1970}
282 %\title{The Inherent Sadism of Compulsory English Classes}
283 %
284 %\begin{document}
285 %\maketitle
286 %'Nuff said.
287 %\end{document}\end{verbatim}
288 % \subsection{Initialization Macros}
289 % The \index{heading|usage}mandatory heading is generated with
290 % \DescribeMacro{\maketitle}|\maketitle|.  Use the standard macros
291 % |\author|, |\title|, and |\date| to specify the relevant information.
292 % To define the instructor and name of the course, use the aptly named
293 % \DescribeMacro{\instructor}|\instructor|\marg{instructor} and
294 % \DescribeMacro{\course}|\course|\marg{course} macros.
295 %
296 % The last name for use in the header\index{header|usage} is derived from
297 % |\author|.  If this does not produce the desired result, use
298 % \DescribeMacro{\surname}|\surname|\marg{last name} to override it.
299 %
300 % MLA style recommends the DD~Mon.~YYYY format for specifying dates;
301 % \DescribeMacro{\today}|\today| has been conveniently redefined to this.
302 % However, other formats can be used as long as done so consistently
303 % throughout the document.  Also note that the date in the
304 % heading\index{heading|usage} should be the due date of the assignment;
305 % students who finish assignments early would be wise to call
306 % |\date|\marg{due date}.
307 %
308 % \subsection{Environments}
309 % Three environments have been modified from standard \LaTeX to better
310 % suit MLA format.  To typeset \index{poetry|usage}poetry and
311 % \index{drama|usage}drama, use the \DescribeEnv{verse}|verse|
312 % environment.  Quotations\index{quotations|usage} of a single paragraph
313 % or less always use the \DescribeEnv{quote}|quote| environment.  For
314 % longer passages, use the \DescribeEnv{quotation}|quotation| environment
315 % if the beginning of the passage marks the beginning of a paragraph.
316 % Otherwise, use the |quote| environment.
317 %
318 % Be sure to follow MLA guidelines when using these environments.  Short
319 % quotes should be enclosed in quotation marks and included directly in
320 % the text.
321 %
322 % \subsection{Modes of Operation}
323 % The \package{mlastyle} package has four basic modes of operations,
324 % selected with one of four mutually exclusive options.  The
325 % \OptionIndex{format}\Lopt{format}
326 % option tells \package{mlastyle} to use MLA format (i.e., 1 inch margins,
327 % double-spaced, etc.).  The \OptionIndex{style}\Lopt{style} option tells
328 % \package{mlastyle} to use MLA style (i.e., the format of parenthetical
329 % documentation, etc).  Each of these options
330 % disables the other; to use both MLA format and MLA style, specify the
331 % \OptionIndex{mla}\Lopt{mla} option, or nothing at all.
332 %
333 % To disable both MLA style and MLA format, use the
334 % \OptionIndex{compat}\Lopt{compat} option.  This differs from omitting
335 % the package entirely in that certain macros are still defined (e.g.,
336 % |\instructor|).  Also, citations are handled a bit differently than in
337 % standard \LaTeX{} (see section~\ref{sec:documentation}).
338 %
339 % In addition to the above, several other options modify the behavior of
340 % \package{mlastyle}.
341 %
342 % \subsubsection{Italics vs.\ Underlining} \index{underlining|usage}
343 % \index{italics|usage}
344 % MLA format dictates that emphasis should be indicated by underlining the
345 % text.  Thus, the \package{ulem} package, which underlines all emphasized
346 % text, is loaded by default in \Lopt{mla} and \Lopt{format} modes.  To
347 % disable this, use the \OptionIndex{italics}\Lopt{italics} option.
348 % Conversely, if underlining is desired in \Lopt{style} or \Lopt{compat}
349 % mode, the \OptionIndex{underline}\Lopt{underline} option can be used.
350 %
351 % \subsubsection{Fonts}
352 % By default, \package{mlastyle} uses \TeX's standard Computer Modern
353 % font.  Some profess\-ors\penalty500---particularly those
354 % concerned with document length---require assignments to be set in
355 % \examp[.]{Times New Roman}  This can be achieved with the
356 % \OptionIndex{times}\Lopt{times} option, which simply loads the
357 % \package{times} package.  This opposite of this option is
358 % \OptionIndex{cm}\Lopt{cm}, which reverts to Computer Modern.
359 %
360 % \index{works cited|usage}
361 % \subsection{Documenting Sources} \label{sec:documentation}
362 %
363 % The \package{mlastyle} package reimplements the
364 % \DescribeEnv{thebibliography}|thebibliography| environment to generate
365 % the list of works cited in MLA style.  Instruction in the basic use of
366 % \LaTeX's bibliography features is beyond the scope of this document;
367 % however, the following example, which should be included just before
368 % |\end{document}|, might prove to be a useful starting point:
369 %\begin{verbatim}
370 %\begin{thebibliography}{}
371 %
372 %\bibitem[Lamport]{latex}
373 %Lamport, Leslie.
374 %\newblock {\em \LaTeX: A Document Preparation System}.
375 %\newblock 2nd.~ed.
376 %\newblock Reading: Addison-Wesley, 1994.
377 %
378 %\end{thebibliography}\end{verbatim}
379 %
380 % In this example, |Lamport| is the author's last name (for use in
381 % citations) and |latex| is the marker used to reference it (see
382 % section~\ref{sec:parenthetical}).
383 %
384 % For information on automatically generating the list of works cited with
385 % \BibTeX, see section~\ref{sec:bibtex}.
386 %
387 % \subsubsection{Parenthetical Documentation} \label{sec:parenthetical}
388 % A simple citation can by achieved with a call to
389 % \DescribeMacro{\cite}|\cite|\oarg{pages}\marg{marker}, where
390 % marker refers to the key given to either
391 % \index{BibTeX=\BibTeX|usage}\BibTeX{} or the |\bibitem| macro (|latex|
392 % in the above example).
393 % Omit \oarg{pages} if the source has no page numbers.
394 % Multiple sources can be cited using the syntax
395 % |\cite|\oarg{pages}|{|\meta{marker
396 % 1}\texttt{,}\penalty\exhyphenpenalty\meta{marker 2}\ldots|}|; however, page
397 % numbers can currently be specified only for the last referenced source.
398 % To work around this limitation, use |\citeN|, explained below.
399 %
400 % Three additional citation commands are provided, all of which take the
401 % same arguments as |\cite|.  To omit the author information from the
402 % citation, use \DescribeMacro{\citepage}|\citepage|.  Indirect
403 % citations---those of the format \examp{(qtd. in Brown 6)}---can be
404 % created with \DescribeMacro{\citeindirect}|\citeindirect|.  Finally, the
405 % parentheses are omitted by \DescribeMacro{\citeN}|\citeN|.  This was
406 % intended for use in cross references, but it can also help in citing
407 % multiple works.  The result of
408 % |(\citeN[42]{knuth}|\texttt{; }|\citeN[69]{lamport})|
409 % would be something like \examp[.]{(Knuth 42; Lamport 69)}
410 %
411 % \subsubsection{Using {\rm \BibTeX}} \label{sec:bibtex}
412 % Coupled with \index{BibTeX=\BibTeX|usage}\BibTeX,
413 % \package{mlastyle} provides a experimental implementation of MLA
414 % documentation style.  Put\SpecialUsageIndex{\bibliographystyle}
415 % |\bibliographystyle{mlastyle}| in the document preamble to load the
416 % bibliography style.  Alternatively, the
417 % \OptionIndex{bibstyle}\Lopt{bibstyle} option can handle this
418 % automatically, loading a bibliography style of |mlastyle| in \Lopt{mla}
419 % and \Lopt{style} modes and a bibliography style of |plain| in
420 % \Lopt{format} and \Lopt{compat} modes.
421 %
422 % Use of \BibTeX{} is also beyond the scope of this document; instead,
423 % another example is provided.  To use it, substitute
424 % |\bibliography|\marg{filename} for the |thebibliography| environment.
425 % Then create \meta{filename}\file{.bib} with the contents below.
426 % Generating the document entails running \file{latex} on the \file{.tex}
427 % file, \file{bibtex} on the resulting \file{.aux} file, then \file{latex}
428 % twice more.
429 %\begin{verbatim}
430 %@BOOK{latex,
431 %  AUTHOR = "Leslie Lamport",
432 %  TITLE = "\LaTeX: A Document Preparation System",
433 %  KEY = "\LaTeX",
434 %  EDITION = "Second",
435 %  ADDRESS = "Reading",
436 %  PUBLISHER = "Addison-Wesley",
437 %  YEAR = "1994"}\end{verbatim}
438 % In \package{mlastyle}, The |KEY| field serves the additional purpose of
439 % specifying an abbreviated title.  This is unnecessary in the above
440 % example.  If an additional book by Leslie Lamport was included, however,
441 % the |KEY| field would allow |\cite{lamport}| to yield \examp{(Lamport,
442 % \emph{\LaTeX\/})} instead of \examp[.]{(Lamport, \emph{\LaTeX: A Document
443 % Preparation System\/})}
444 %
445 % \StopEventually{\PrintChanges\PrintIndex}
446 %
447 % \section{Implementation}
448 %    \begin{macrocode}
449 %<*package>
450 %    \end{macrocode}
451 %
452 % \subsection{Options}
453 % \begin{macro}{\ifmlastyle@*}
454 % \begin{macro}{\mlastyle@*true}
455 % \begin{macro}{\mlastyle@*false}
456 % Most options are implemented by modifying a |\newif| declared for that
457 % purpose.
458 %    \begin{macrocode}
459 \newif\ifmlastyle@bibstyle
460 \DeclareOption{bibstyle}{\mlastyle@bibstyletrue}
461 \DeclareOption{nobibstyle}{\mlastyle@bibstylefalse}
462 \newif\ifmlastyle@papersize
463 \DeclareOption{papersize}{\mlastyle@papersizetrue}
464 \DeclareOption{nopapersize}{\mlastyle@papersizefalse}
465 \newif\ifmlastyle@underline
466 \DeclareOption{underline}{\mlastyle@underlinetrue}
467 \DeclareOption{italics}{\mlastyle@underlinefalse}
468 \newif\ifmlastyle@times
469 \DeclareOption{times}{\mlastyle@timestrue}
470 \DeclareOption{cm}{\mlastyle@timesfalse}
471 \newif\ifmlastyle@style
472 \DeclareOption{compat}{\mlastyle@stylefalse
473         \mlastyle@formatfalse
474         \mlastyle@underlinefalse}
475 \DeclareOption{mla}{\mlastyle@styletrue
476         \mlastyle@formattrue
477         \mlastyle@underlinetrue}
478 \newif\ifmlastyle@format
479 \DeclareOption{format}{\mlastyle@stylefalse
480         \mlastyle@formattrue
481         \mlastyle@underlinetrue}
482 \DeclareOption{style}{\mlastyle@styletrue
483         \mlastyle@formatfalse
484         \mlastyle@underlinefalse}
485 \DeclareOption{singlespacequotes}{
486   \def\mlastyle@qspread{\linespread{1}\selectfont\vskip\baselineskip}}
487 \DeclareOption{doublespacequotes}{\let\mlastyle@qspread\relax}
488 \ExecuteOptions{nobibstyle,nopapersize,mla,cm,doublespacequotes}
489 \ProcessOptions
490 %    \end{macrocode}
491 % \end{macro}
492 % \end{macro}
493 % \end{macro}
494 % If the \Lopt{papersize} option is set, add the appropriate
495 % \textsc{PostScript} special, or adjust |\pdfpagewidth| and
496 % |\pdfpageheight| if pdf\LaTeX{} is in use.
497 %    \begin{macrocode}
498 \ifmlastyle@papersize
499   \ifx\@undefined\pdfpagewidth
500     \special{papersize=\the\paperwidth,\the\paperheight}
501   \else
502     \setlength{\pdfpagewidth}{\paperwidth}
503     \setlength{\pdfpageheight}{\paperheight}
504   \fi
505 \fi % \ifmlastyle@papersize
506 %    \end{macrocode}
507 % If the \Lopt{bibstyle} option is set, specify the bibliography style.
508 %    \begin{macrocode}
509 \ifmlastyle@bibstyle
510   \ifmlastyle@style
511     \bibliographystyle{mlastyle}
512   \else
513     \bibliographystyle{plain}
514   \fi
515 \fi % \ifmlastyle@bibstyle
516 %    \end{macrocode}
517 % \begin{macro}{\UL@onin}
518 % Load the \package{ulem} package if the \Lopt{underline} option is set.
519 % By default, \package{ulem} does multiple underlining for nested
520 % emphasis.  This is changed to MLA-style behavior with the redefinition
521 % of |\UL@onin|.
522 %    \begin{macrocode}
523 \ifmlastyle@underline
524   \RequirePackage{ulem}
525   \def\UL@onin#1{\egroup\UL@stop#1\UL@start}
526 \fi % \ifmlastyle@underline
527 %    \end{macrocode}
528 % \end{macro}
529 % Load the \package{times} package if the \Lopt{times} option is set.
530 %    \begin{macrocode}
531 \ifmlastyle@times
532   \RequirePackage{times}
533 \fi % \ifmlastyle@times
534 %    \end{macrocode}
535 % \subsection{Macros}
536 % \begin{macro}{\instructor}
537 % Define the instructor, along with an obsolete synonym.
538 %    \begin{macrocode}
539 \def\instructor#1{\gdef\mlastyle@instructor{#1}}
540 \let\professor\instructor
541 %    \end{macrocode}
542 % \end{macro}
543 % \begin{macro}{\course}
544 % Define the course, along with an obsolete synonym.
545 %    \begin{macrocode}
546 \def\course#1{\gdef\mlastyle@course{#1}}
547 \let\classname\course
548 %    \end{macrocode}
549 % \end{macro}
550 % \begin{macro}{\surname}
551 % Define the surname, along with an obsolete synonym.
552 %    \begin{macrocode}
553 \def\surname#1{\gdef\mlastyle@surname{#1}}
554 \def\mlastyle@surname{\def\sw@llow##1 {}\expandafter\sw@llow\@author}
555 \let\lastname\surname
556 %    \end{macrocode}
557 % \end{macro}
558 % \subsection{Formatting}
559 % Formatting is done if the \Lopt{mla} or \Lopt{format} option is set.
560 %    \begin{macrocode}
561 \ifmlastyle@format
562 %    \end{macrocode}
563 % \subsubsection{Macros}
564 % \begin{macro}{\maketitle}
565 % |\maketitle| generates a heading in MLA format.
566 %    \begin{macrocode}
567   \renewcommand{\maketitle}{\begin{flushleft}
568     \@author\par
569     \@ifundefined{mlastyle@instructor}{}{\mlastyle@instructor}\par
570     \@ifundefined{mlastyle@course}{}{\mlastyle@course}\par
571     \@date\end{flushleft}
572     \begin{center}\@title\end{center}\par
573   }
574 %    \end{macrocode}
575 % \end{macro}
576 % \begin{macro}{\today}
577 % |\today| is redefined to DD~Mon.~YYYY format.
578 %    \begin{macrocode}
579 \def\today{\number\day~\ifcase\month\or
580   Jan.\or Feb.\or Mar.\or Apr.\or May\or June\or July\or 
581   Aug.\or Sept.\or Oct.\or Nov.\or Dec.\fi\ \number\year}
582 %    \end{macrocode}
583 % \end{macro}
584 % \begin{macro}{\slash}
585 % No penalty for |\slash|, and plain /'s permit line breaks if necessary.
586 % ^^A\let\mlastyle@sl@sh=/
587 %    \begin{macrocode}
588   \def\slash{/\penalty\z@}
589   \def\mlastyle@slash{/\futurelet\mlastyle@slashnext\mlastyle@slashx}
590   \def\mlastyle@slashx{\ifx\mlastyle@slashnext/\else
591     \penalty\exhyphenpenalty\fi}
592 %    \end{macrocode}
593 % \end{macro}
594 % \begin{macro}{\section}
595 % \begin{macro}{\subsection}
596 % Sections are formatted by centering the section name and beginning a new
597 % page.  Subsections simply center the section name.
598 %    \begin{macrocode}
599   \renewcommand{\section}{\clearpage\@startsection{section}{1}{\z@
600     }{0pt}{1sp}{\centering}}
601   \renewcommand{\subsection}{\@startsection{subsection}{2}{\z@
602     }{0pt}{1sp}{\centering}}
603   \renewcommand{\subsubsection}{\@startsection{subsubsection}{3}{\z@
604     }{0pt}{1sp}{\centering}}
605 %    \end{macrocode}
606 % ^^A\let\mlastyle@vfont\verbatim@font
607 % ^^A\def\verbatim@font{\mlastyle@qspread\mlastyle@vfont}
608 % \end{macro}
609 % \end{macro}
610 % \subsubsection{Environments}
611 % ^^A%\newenvironment{blocks}{\begin{quote} \linespread{1} \selectfont}{\end{quote} \linespread{2} \small \selectfont}
612 % ^^A%\newenvironment{blockm}{\begin{quotation} \linespread{1} \selectfont}{\end{quotation} \linespread{2} \selectfont}
613 % \begin{environment}{verse}
614 % Indented 1 inch, with an additional .25 inch hanging indent.
615 %    \begin{macrocode}
616   \renewenvironment{verse}{\list{}{\mlastyle@qspread
617     \advance\leftmargin.75in\itemindent-.25in
618     \listparindent\itemindent}\item\relax}{\endlist}
619 %    \end{macrocode}
620 % \end{environment}
621 % \begin{environment}{quotation}
622 % Indented 1 inch, with a paragraph indent of an additional .25 inches.
623 %    \begin{macrocode}
624   \renewenvironment{quotation}{\list{}{\mlastyle@qspread
625     \advance\leftmargin.5in\itemindent.25in
626     \listparindent\itemindent}\item\relax}{\endlist}
627 %    \end{macrocode}
628 % \end{environment}
629 % \begin{environment}{quote}
630 % Identical to the |quotation| environment, except the first paragraph is not
631 % indented.
632 %    \begin{macrocode}
633   \renewenvironment{quote}{\list{}{\mlastyle@qspread
634     \advance\leftmargin.5in
635     \listparindent.25in}\item\relax}{\endlist}
636 %    \end{macrocode}
637 % \end{environment}
638 % \begin{environment}{workscited}
639 % Works cited environment, for compatibility with \package{mla-paper}.
640 %    \begin{macrocode}
641   \newenvironment{workscited}%
642     {\newpage{\centerline{Works Cited}}}{\newpage}
643   \newcommand{\bibent}{\noindent \hangindent .5in}
644 %    \end{macrocode}
645 % \end{environment}
646 % \subsubsection{Margins}
647 % Top and bottom margins are 1 inch each.  The header is flush with the
648 % right margin at .5 inches from the top of the page.
649 % ^^A\addtolength{\headheight}{-1pt}
650 % ^^A\setlength{\headheight}{1.4\headheight}% kludge
651 %    \begin{macrocode}
652   \addtolength{\voffset}{-0.5in}
653   \setlength{\textheight}{\paperheight}
654   \addtolength{\textheight}{-2in}
655   \setlength{\topmargin}{0in}
656   \setlength\headheight\f@baselineskip
657   \setlength{\headsep}{0.5in}
658   \addtolength{\headsep}{-\headheight}
659   \setlength{\footskip}{0.25in}
660   \raggedbottom
661 %    \end{macrocode}
662 % Left and right margins in MLA format are each 1 inch wide.
663 %    \begin{macrocode}
664   \addtolength{\hoffset}{-0.5in}
665   \setlength{\textwidth}{\paperwidth}
666   \addtolength{\textwidth}{-2in}
667   \setlength{\oddsidemargin}{0.5in}
668   \setlength{\evensidemargin}{0.5in}
669   \setlength{\marginparwidth}{0.5in}
670 %    \end{macrocode}
671 % \subsubsection{Paragraphs}
672 % Paragraphs should be left justified, with the first line indented .5
673 % inches.
674 %    \begin{macrocode}
675   \raggedright
676   \setlength{\parindent}{.5in}
677 %    \end{macrocode}
678 % MLA format specifies that all paragraphs should be indented, even those
679 % beginning a new section.  This snippet from \package{indentfirst} changes
680 % \LaTeX{} to meet that requirement.
681 %    \begin{macrocode}
682   \let\@afterindentfalse\@afterindenttrue
683   \@afterindenttrue
684 %    \end{macrocode}
685 % Double space {\em everywhere}.
686 % ^^A\RequirePackage{doublespace}
687 %    \begin{macrocode}
688   \linespread{2.0}
689   \leftmargini\parindent
690   \def\@listi{\leftmargin\leftmargini
691   \parsep\z@\itemsep\z@\topsep -3\p@\relax}
692   \let\@listI\@listi
693   \@listi
694   \def\@listii{\leftmargin\leftmarginii
695   \parsep\z@\itemsep\z@\topsep -3\p@\relax}
696   \def\@listiii{\leftmargin\leftmarginiii
697   \parsep\z@\itemsep\z@\topsep -3\p@\relax}
698   \def\@listiv{\leftmargin\leftmarginiv
699   \parsep\z@\itemsep\z@\topsep -3\p@\relax}
700   \def\@listv{\leftmargin\leftmarginv
701   \parsep\z@\itemsep\z@\topsep -3\p@\relax}
702   \def\@listvi{\leftmargin\leftmarginvi
703   \parsep\z@\itemsep\z@\topsep -3\p@\relax}
704 %    \end{macrocode}
705 % \subsubsection{Header}
706 % The last name and page number appear on every page, including the first.
707 %    \begin{macrocode}
708   \RequirePackage{fancyhdr}
709   \fancypagestyle{plain}{\fancyhf{}}
710   \fancypagestyle{mlastyle}{
711     \fancyhf{}
712     \rhead{\mlastyle@surname{} \thepage}
713     \renewcommand{\headrulewidth}{0pt}
714     \renewcommand{\footrulewidth}{0pt}}
715   \pagestyle{mlastyle}
716 %    \end{macrocode}
717 % \subsubsection{Notes}
718 % Footnotes should be indented .5 inches; however .56 inches is used
719 % in a crude attempt to compensate for
720 % the alignment provided by the \package{footmisc} package.  Endnotes are
721 % preferred in MLA style anyway, so this should not be a problem in most
722 % circumstances.
723 %    \begin{macrocode}
724   \RequirePackage[ragged,norule]{footmisc}
725   \def\footnotelayout{\linespread{1}\footnotesize\raggedright{} }
726   \footnotemargin .56in
727   \skip\footins=2\baselineskip
728   \footnotesep 1.2\footnotesep
729   \addtolength\footnotesep{\baselineskip}
730   \def\footnotesize{\normalsize}
731 %    \end{macrocode}
732 % ^^A\let\footnoterule\relax
733 % Endnotes are supported, but only if the \package{endnotes} package is
734 % loaded {\em before\/} this package.
735 %    \begin{macrocode}
736   \ifx\@undefined\endnote\else
737     \def\enoteheading{\newpage\section*{\notesname}}
738     \def\enoteformat{\leavevmode\makeenmark{} }
739     \def\enotesize{\normalsize}
740   \fi
741 %    \end{macrocode}
742 % \subsubsection{Bibliography}
743 % \begin{environment}{thebibliography}
744 % The definition of |\thebibliography| varies depending on the document
745 % class.
746 %    \begin{macrocode}
747   \@ifundefined{chapter}
748 %    \end{macrocode}
749 % Article class.
750 %    \begin{macrocode}
751   { \def\thebibliography#1{\newpage\section*{\refname}
752       \list{\@biblabel{\@arabic\c@enumiv}}%
753       {\settowidth\labelwidth{\@biblabel{#1}}}
754       \leftmargin\labelwidth
755       \advance\leftmargin\labelsep
756       \itemindent-\leftmargin
757       \def\newblock{}
758       \usecounter{enumiv}
759       \sloppy%\sfcode`\.=1000\relax
760       \catcode`/=13\let/=\mlastyle@slash}}
761 %    \end{macrocode}
762 % Report/book class.
763 %    \begin{macrocode}
764   { \def\thebibliography#1{\chapter*{\bibname}
765       \list{\@biblabel{\@arabic\c@enumiv}}%
766       {\settowidth\labelwidth{\@biblabel{#1}}}
767       \leftmargin\labelwidth
768       \advance\leftmargin\labelsep
769       \itemindent-\leftmargin
770       \def\newblock{}
771       \usecounter{enumiv}
772       \sloppy%\sfcode`\.=1000\relax
773       \catcode`/=13\let/=\mlastyle@slash}}
774 %    \end{macrocode}
775 % \end{environment}
776 %    \begin{macrocode}
777 \fi % \ifmlastyle@format
778 %    \end{macrocode}
779 % \subsection{Style}
780 % \begin{macro}{\cite}
781 % \begin{macro}{\citeN}
782 % ^^A\begin{macro}{\citepage}
783 % ^^A\begin{macro}{\citequote}
784 % The following macros, combined with \file{mlastyle.bst}, provide
785 % for a bibliography in MLA style.  Note that the definition of |\cite|,
786 % |\citeN|, etc.\ vary depending on the options passed to
787 % \package{mlastyle}.
788 %
789 % \begin{macro}{\mlastyle@intcite}
790 % The original |\cite| is stored
791 % in |\mlastyle@intcite|.
792 %    \begin{macrocode}
793 \let\mlastyle@intcite\cite
794 %    \end{macrocode}
795 % \end{macro}
796 % \begin{macro}{\mlastyle@relax}
797 % This macro does nothing.  Depending on the options, either |\citeC| or
798 % |\citeM| and its ilk will utilize it.
799 %    \begin{macrocode}
800 \newcommand{\mlastyle@relax}[2][]{}
801 %    \end{macrocode}
802 % \end{macro}
803 % \subsubsection{MLA Style}
804 % \begin{macro}{\citeM}
805 % If the \Lopt{mla} or \Lopt{style} options are used, the following is
806 % executed.
807 %    \begin{macrocode}
808 \ifmlastyle@style
809   \def\@cite#1#2{(#1\if@tempswa{} #2\fi)}
810   \def\cite{\def\@cite##1##2{(##1\if@tempswa{}
811     ##2\fi)}\mlastyle@intcite}
812   \def\citeN{\def\@cite##1##2{##1\if@tempswa{}
813     ##2\fi}\mlastyle@intcite}
814   \def\citeM{\def\@cite##1##2{ (##1\if@tempswa{}
815     ##2\fi)}\mlastyle@intcite}
816   \def\citepage{\def\@cite##1##2{\if@tempswa(##2)\fi}\mlastyle@intcite}
817   \def\citepageM{\def\@cite##1##2{\if@tempswa{}
818     (##2)\fi}\mlastyle@intcite}
819   \def\citeindirect{\def\@cite##1##2%
820   {(qtd. in ##1\if@tempswa{} ##2\fi)}\mlastyle@intcite}
821   \def\citeindirectM{\def\@cite##1##2%
822   { (qtd. in ##1\if@tempswa{} ##2\fi)}\mlastyle@intcite}
823   \let\citeC\mlastyle@relax
824 %    \end{macrocode}
825 % \end{macro}
826 % \iffalse
827 % Place commas in-between citations in the same |\citeyear|, |\citeyearNP|,
828 % |\citeN|, or |\shortciteN| command.
829 % Use something like |\citeN{ref1,ref2,ref3}| and |\citeN{ref4}| for a list.
830 %
831 % \@citedata and \@citedatax:
832 %  \def\@citedata{%
833 %    \@ifnextchar [{\@tempswatrue\@citedatax}%
834 %                {\@tempswafalse\@citedatax[]}%
835 %  }
836 %  \def\@citedatax[#1]#2{%
837 %  \let\@citea\@empty
838 %  \if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi%
839 %    \def\@citea{}\@cite{\@for\@citeb:=#2\do%
840 %      {\@citea\def\@citea{; }\@ifundefined% by Young
841 %        {b@\@citeb}{{\bf ?}%
842 %        \@warning{Citation `\@citeb' on page \thepage \space undefined}}%
843 %  {\csname b@\@citeb\endcsname}}}{#1}}%
844 % \fi
845 % \begin{macro}{\@citex}
846 % This is the original |\@citex| from \LaTeX{} modified to use semicolons.
847 %    \begin{macrocode}
848 \def\@citex[#1]#2{%
849   \let\@citea\@empty
850   \@cite{\@for\@citeb:=#2\do
851     {\@citea\def\@citea{;\penalty-1\ }%
852      \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
853      \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
854      \@ifundefined{b@\@citeb}{\mbox{\reset@font\bfseries ?}%
855        \G@refundefinedtrue
856        \@latex@warning
857          {Citation `\@citeb' on page \thepage \space undefined}}%
858        {{\csname b@\@citeb\endcsname}}}}{#1}}
859 %    \end{macrocode}
860 % \end{macro}
861 % \begin{macro}{\@biblabel}
862 % No labels in the bibliography.
863 %    \begin{macrocode}
864   \def\@biblabel#1{#1}
865   \labelsep\z@
866   \let\mlastyle@intbib\thebibliography
867   \def\thebibliography#1{\mlastyle@intbib{#1}
868     \itemindent-\leftmargin\def\@biblabel##1{}}
869 %    \end{macrocode}
870 % \end{macro}
871 % Title either the bibliography or the references ``Works Cited,''
872 % depending on the document class.
873 %    \begin{macrocode}
874   \@ifundefined{chapter}
875   {\renewcommand\refname{Works Cited}}
876   {\renewcommand\bibname{Works Cited}}
877 %    \end{macrocode}
878 %
879 % ^^A% Define the command \workscited{bib}{style}{nocite}
880 % ^^A%\newcommand{\workscited}[3]{%
881 % ^^A%  \ifx\chapter\@undefined%
882 % ^^A%    \addcontentsline{toc}{chapter}{\bfseries\bibname}% report style
883 % ^^A%  \else
884 % ^^A%    \addcontentsline{toc}{section}{\bfseries\refname}% article style
885 % ^^A%  \fi
886 % ^^A%  \bibliography{#1}\bibliographystyle{#2}\nocite{#3}}
887 % ^^A% \fi
888 % ^^A\newcommand{\annote}[1]{\begin{list}{}{%
889 % ^^A                \setlength{\labelwidth}{0pt}
890 % ^^A                \addtolength{\leftmargin}{\parindent}
891 % ^^A                \setlength{\labelsep}{0pt}}%
892 % ^^A                \item #1 \end{list}}
893 % \subsubsection{Plain Style}
894 % \begin{macro}{\citeC}
895 % This next block is used if the \Lopt{compat} or \Lopt{format} option is
896 % set.
897 %    \begin{macrocode}
898 \else
899   \newcommand{\mlastyle@cite}[2][]{\@tempswafalse\@citex[]{#2}}
900   \let\cite\mlastyle@cite
901   \let\citepage\mlastyle@cite
902   \let\citeindirect\mlastyle@cite
903   \newcommand{\citeC}[2][]{ \@tempswafalse\@citex[]{#2}}
904   \let\citeM\mlastyle@relax
905   \let\citepageM\mlastyle@relax
906   \let\citeindirectM\mlastyle@relax
907 \fi
908 %    \end{macrocode}
909 % \end{macro}
910 %
911 % ^^A\end{macro}
912 % ^^A\end{macro}
913 % \end{macro}
914 % \end{macro}
915 %    \begin{macrocode}
916 %</package>
917 %    \end{macrocode}
918 %
919 % \Finale
920 \endinput
921 % vim:tw=74