From: Tim Pope Date: Mon, 17 Nov 2003 08:05:16 +0000 (+0000) Subject: Major work on natbib implementation X-Git-Url: http://git.tpope.net/?p=latex-mlastyle.git;a=commitdiff_plain;h=6d6c34513e7937543b3b2dc0165c581e227d745c Major work on natbib implementation --- diff --git a/Makefile b/Makefile index ab16ecb..c6fa6c7 100644 --- a/Makefile +++ b/Makefile @@ -18,8 +18,6 @@ FAKEROOT=`[ -x /usr/bin/fakeroot ] && echo /usr/bin/fakeroot` %.bbl: %.bib $(BIBTEX) $*.aux - $(MAKEINDEX) -s gglo.ist -o $*.gls $*.glo - $(MAKEINDEX) -s gind.ist -o $*.ind $*.idx %.bib: %.dtx $(LATEX) $< @@ -30,6 +28,9 @@ FAKEROOT=`[ -x /usr/bin/fakeroot ] && echo /usr/bin/fakeroot` %.dvi: %.sty %.dtx %.bbl $(LATEX) $*.dtx $(LATEX) $*.dtx + $(MAKEINDEX) -s gglo.ist -o $*.gls $*.glo + $(MAKEINDEX) -s gind.ist -o $*.ind $*.idx + $(LATEX) $*.dtx %.ps: %.dvi $(DVIPS) -o $@ $< diff --git a/mlastyle.dtx b/mlastyle.dtx index 252e96a..906ed67 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,13 +623,16 @@ 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{macro}{\mlastyle@i} +% This is the standard MLA format indent. % \begin{macrocode} \newdimen\mlastyle@i \mlastyle@i=.5in % \end{macrocode} @@ -859,6 +871,7 @@ 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} @@ -867,6 +880,7 @@ Schlegl", {\gdef\refname{Works Cited}} {\gdef\bibname{Works Cited}}} % \end{macrocode} +%\end{macro} % \begin{macro}{\cite} % \begin{macro}{\citealt} % ^^A\begin{macro}{\citepage} @@ -998,11 +1012,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