Began work on \citeadd and \citeflush
[latex-mlastyle.git] / mlastyle.dtx
index b6236d33267bbb4f681899d152c791a2e1a2a3be..6aead1c72050814050113c37526bdc91bb2c28c3 100644 (file)
@@ -262,10 +262,10 @@ Schlegl",
 % \DoNotIndex{\parindent}
 % \DoNotIndex{\parsep}
 % \DoNotIndex{\penalty}
+% \DoNotIndex{\protected@xdef}
 % \DoNotIndex{\relax}
 % \DoNotIndex{\renewcommand}
 % \DoNotIndex{\renewenvironment}
-% \DoNotIndex{\reset@font}
 % \DoNotIndex{\rhead}
 % \DoNotIndex{\selectfont}
 % \DoNotIndex{\setlength}
@@ -619,7 +619,7 @@ Schlegl",
 %    \begin{macrocode}
 \def\surname#1{\gdef\mlastyle@surname{#1}}
 \def\mlastyle@surname{\def\ml@##1 ##2,##3@@{##2}%
-  \expandafter\ml@\@author, ,@@}
+  \def\and##1 {\unskip, }\expandafter\ml@\@author, ,@@}
 \let\lastname\surname
 %    \end{macrocode}
 % \end{macro}
@@ -636,6 +636,7 @@ Schlegl",
 % \end{macro}
 % \subsubsection{Macros}
 % \begin{macro}{\maketitle}
+% \begin{macro}{\and}
 % |\maketitle| generates a heading in MLA format.
 %    \begin{macrocode}
   \renewcommand{\maketitle}{\begin{flushleft}
@@ -645,8 +646,10 @@ Schlegl",
     \@date\end{flushleft}
     \begin{center}\@title\end{center}\par
   }
+  \let\and\par
 %    \end{macrocode}
 % \end{macro}
+% \end{macro}
 % \begin{macro}{\today}
 % |\today| is redefined to DD~Mon.~YYYY format.
 %    \begin{macrocode}
@@ -879,10 +882,6 @@ Schlegl",
 % This first block is the beginnings of an implementation for
 % \package{natbib}.  Surely there is a better way.
 %    \begin{macrocode}
-\newif\ifmlastyle@pages
-\renewcommand\NAT@citetp
-{\@ifnextchar[{\mlastyle@pagestrue\NAT@@citetp}%
-  {\mlastyle@pagesfalse\NAT@@citetp[]}}
 \newcommand{\bibstyle@mlastyle}{%
   \bibpunct[\mlastyle@space]{\mlastyle@brack(}{\mlastyle@brack)}%
     {;}{a}{\mlastyle@comma}{,}
@@ -906,6 +905,10 @@ Schlegl",
 \def\mlastyle@notitle
   { \ \ \ \ \unskip\unskip\unskip\unskip\unskip\unskip}
 \RequirePackage{natbib}
+\newif\ifmlastyle@pages
+\renewcommand\NAT@citetp
+{\@ifnextchar[{\mlastyle@pagestrue\NAT@@citetp}%
+  {\mlastyle@pagesfalse\NAT@@citetp[]}}
 %    \end{macrocode}
 %\end{macro}
 % \begin{macro}{\cite}
@@ -937,6 +940,7 @@ Schlegl",
 % executed.
 %    \begin{macrocode}
 \ifmlastyle@style
+%    \end{macrocode}
 % If the \Lopt{bibstyle} option is set, specify the bibliography style.
 %    \begin{macrocode}
   \ifmlastyle@bibstyle
@@ -946,6 +950,28 @@ Schlegl",
 % \end{macro}
 %    \begin{macrocode}
   \let\cite\citep
+  \let\mlastyle@citequeue\empty
+  \def\mlastyle@cite#1#2#3{\csname#1\endcsname[#2]{#3}}
+  \newcommand\citeflush{\ifhmode\unskip\fi
+    \ifx\mlastyle@citequeue\@empty\else{} \let\@citea\relax
+    \citetext{\@for\@citeb:=\mlastyle@citequeue\do{\@citea
+    \expandafter\mlastyle@cite\@citeb\def\@citea{\NAT@sep\ }}}%
+    \global\let\mlastyle@citequeue\@empty\fi}
+  \newcommand\mlastyle@citeadd[3]{\ifx\mlastyle@citequeue\@empty
+    \xdef\mlastyle@citequeue{{#1}{#2}{#3}}\else
+    \xdef\mlastyle@citequeue{\mlastyle@citequeue,%
+    {#1}{#2}{#3}}\fi}
+  \newcommand\citeadd[2][]{\mlastyle@citeadd{citealp}{#1}{#2}}
+  \newcommand\citea{\@ifstar
+    {\let\mlastyle@star*\mlastyle@citea}
+    {\let\mlastyle@star\empty\mlastyle@citea}}
+  \newcommand\mlastyle@citea[2][]{\expandafter\citeauthor
+    \mlastyle@star{#2}\mlastyle@citeadd{citeyear}{#1}{#2}}
+  \newcommand\Citea{\@ifstar
+    {\let\mlastyle@star*\mlastyle@Citea}
+    {\let\mlastyle@star\empty\mlastyle@Citea}}
+  \newcommand\mlastyle@Citea[2][]{\expandafter\Citeauthor
+    \mlastyle@star{#2}\mlastyle@citeadd{citeyear}{#1}{#2}}
   \newcommand\citepage[2][]{\citeyearpar[#1]{#2}}
   \newcommand\citepageM[2][]{\unskip{} \citeyearpar[#1]{#2}}
   \newcommand\citeindirect[2][]{\citep[qtd.\ in][#1]{#2}}