X-Git-Url: http://git.tpope.net/?p=latex-mlastyle.git;a=blobdiff_plain;f=mlastyle.dtx;h=7033be8b0ee6686b7709c27bb15416c90055c73d;hp=252e96ac7a64a5f3777130c1f79d20a37501be74;hb=4bc6748190e5ece5a05f969febf7f3ec2468c337;hpb=83bae224ee37b9f4c40f596dac6a9bb3ba962a5c diff --git a/mlastyle.dtx b/mlastyle.dtx index 252e96a..7033be8 100644 --- a/mlastyle.dtx +++ b/mlastyle.dtx @@ -69,8 +69,14 @@ Schlegl", \addtolength{\textwidth}{-1in} \addtolength{\headwidth}{-1in} \else + \IfFileExists{natbib.sty}{ + \usepackage{natbib} + \citeindextrue + \bibpunct{[}{]}{,}{n}{}{,}%{ + \bibliographystyle{plainnat}} + {\bibliographystyle{plain}} + \IfFileExists{url.sty}{\usepackage{url}}{} \usepackage[compat]{mlastyle} - \bibliographystyle{plain} %\addtolength{\headsep}{-5pt} %\addtolength{\headheight}{-12pt} %\addtolength{\topmargin}{-17pt} @@ -81,6 +87,8 @@ Schlegl", {\newcommand{\examp}[2][]{{\let\emph\uline\fontfamily{ptm}\selectfont##2}##1}}% {\newcommand{\examp}[2][]{``##2##1''}} +{\makeatletter\gdef\NAT@MLA#1{#1}\gdef\NAT@idxtxt +{\expandafter\NAT@MLA\NAT@name\ \NAT@open\NAT@num\NAT@close}} \EnableCrossrefs \CodelineIndex \RecordChanges @@ -151,6 +159,7 @@ Schlegl", % \DoNotIndex{\addtolength} % \DoNotIndex{\advance} % \DoNotIndex{\baselineskip} +% \DoNotIndex{\bibpreamble,\bibpunct,\bibsep} % \DoNotIndex{\begin} % \DoNotIndex{\bfseries} % \DoNotIndex{\c@enumiv} @@ -208,6 +217,7 @@ Schlegl", % \DoNotIndex{\listparindent} % \DoNotIndex{\makeenmark} % \DoNotIndex{\mbox} +% \DoNotIndex{\ml@} % \DoNotIndex{\mlastyle@bibstylefalse} % \DoNotIndex{\mlastyle@bibstyletrue} % \DoNotIndex{\mlastyle@cite} @@ -261,7 +271,6 @@ Schlegl", % \DoNotIndex{\sloppy} % \DoNotIndex{\space} % \DoNotIndex{\string} -% \DoNotIndex{\sw@llow} % \DoNotIndex{\the} % \DoNotIndex{\thebibliography} % \DoNotIndex{\thepage} @@ -614,20 +623,22 @@ Schlegl", % Define the surname, along with an obsolete synonym. % \begin{macrocode} \def\surname#1{\gdef\mlastyle@surname{#1}} -\def\mlastyle@surname{\def\sw@llow##1 {}\expandafter\sw@llow\@author} +\def\mlastyle@surname{\def\ml@##1 ##2,##3@@{##2}% + \expandafter\ml@\@author, ,@@} \let\lastname\surname % \end{macrocode} % \end{macro} % \subsection{Formatting} % Formatting is done if the \Lopt{mla} or \Lopt{format} option is set. +% \begin{macrocode} +\ifmlastyle@format +% \end{macrocode} % \begin{macro}{\mlastyle@i} +% This is the standard MLA format indent. % \begin{macrocode} \newdimen\mlastyle@i \mlastyle@i=.5in % \end{macrocode} % \end{macro} -% \begin{macrocode} -\ifmlastyle@format -% \end{macrocode} % \subsubsection{Macros} % \begin{macro}{\maketitle} % |\maketitle| generates a heading in MLA format. @@ -815,6 +826,9 @@ Schlegl", % The definition of |\thebibliography| varies depending on the document % class. % \begin{macrocode} +\ifx\@undefined\url + \def\url#1{{\catcode`/=13\let/=\mlastyle@slash#1}} +\fi \ifx\@undefined\citet \@ifundefined{chapter} % \end{macrocode} @@ -828,7 +842,6 @@ Schlegl", \itemindent-\leftmargin \def\newblock{} \usecounter{enumiv} - %\catcode`/=13\global\let/=\mlastyle@slash \sloppy%\sfcode`\.=\@m }} % \end{macrocode} @@ -842,7 +855,6 @@ Schlegl", \itemindent-\leftmargin \def\newblock{} \usecounter{enumiv} - %\catcode`/=13\let/=\mlastyle@slash \sloppy%\sfcode`\.=\@m }} % \end{macrocode} @@ -859,14 +871,18 @@ Schlegl", \fi % \ifmlastyle@format % \end{macrocode} % \subsection{Style} +% \begin{macro}{\bibstyle@mlastyle} % This first block is the beginnings of an implementation for % \package{natbib}. % \begin{macrocode} -\newcommand{\bibstyle@mlastyle}{\bibpunct[ ]{(}{)}{;}{a}{,}{;} +\newcommand{\bibstyle@mlastyle}% +{\bibpunct[ ]{(}{)}{;}{a}{\mlastyle@comma}{,} +\gdef\mlastyle@comma{\ifx\NAT@date\space\def\NAT@date{\unskip}\else,\fi} \@ifundefined{chapter} {\gdef\refname{Works Cited}} {\gdef\bibname{Works Cited}}} % \end{macrocode} +%\end{macro} % \begin{macro}{\cite} % \begin{macro}{\citealt} % ^^A\begin{macro}{\citepage} @@ -970,7 +986,7 @@ Schlegl", {\renewcommand\bibname{Works Cited}} \else \let\cite\citep - \newcommand\citepage[2][]{\citetext{#2}} + \newcommand\citepage[2][]{\citeyearpar[\unskip #1]{#2}} \newcommand\citepageM[2][]{ \citetext{#2}} \newcommand\citeindirect[2][]{\citep[#1][qtd. in]{#2}} \newcommand\citeindirectM[2][]{ \citep[#1][qtd. in]{#2}} @@ -998,11 +1014,16 @@ Schlegl", % set. % \begin{macrocode} \else - \newcommand{\mlastyle@cite}[2][]{\@tempswafalse\@citex[]{#2}} + \ifx\@undefined\citet + \newcommand{\mlastyle@cite}[2][]{\@tempswafalse\@citex[]{#2}} + \newcommand{\citeC}[2][]{~\@tempswafalse\@citex[]{#2}} + \else + \newcommand{\mlastyle@cite}[2][]{\citep[]{#2}} + \def\citeC{ \citep} + \fi \let\cite\mlastyle@cite \let\citepage\mlastyle@cite \let\citeindirect\mlastyle@cite - \newcommand{\citeC}[2][]{~\@tempswafalse\@citex[]{#2}} \let\citeM\mlastyle@relax \let\citepageM\mlastyle@relax \let\citeindirectM\mlastyle@relax