% mslapa is based on previous APA formats. The changes made to produce the
% mslapa format were originally made by Michael S.  Landy in 1995 and are
% public domain. The copyright and licensing of the file as a whole also
% depends on the copyright and licensing of the original code.  
% This statement added 2008/11/25 by Clea F. Rees in an attempt to make the
% situation a little clearer following communication with Michael S. Landy.
% mslapa.sty, 5/1/95
%
% This LaTeX option file is for use with bibliographies produced with
% mslapa.bst.  See the initial comments of mslapa.bst for reasonably complete
% usage documentation.
%
% Edit by Nelson H. F. Beebe <beebe@plot79.math.utah.edu>
% mslapa by: Michael Landy - 5/1/95 (landy@nyu.edu).
%
%

\let\@internalcite\cite

\def\fullcite{%
	\def\citeauthoryear##1##2##3##4{%
		\if@firstcite
			{##1, ##3##4}%
		\else
			\def\@newciteone{##1}%
			\ifx\@newciteone\@oldciteone
				\def\@newcitethree{##3}%
				\ifx\@newcitethree\@oldcitethree
					{,##4}%
				\else
					{,\penalty\@m\ ##3##4}%
				\fi
			\else
				{;\penalty\@m\ ##1, ##3##4}%
			\fi
		\fi
		\def\@oldciteone{##1}%
		\def\@oldcitethree{##3}%
	}%
	\@internalcite
}

\def\shortcite{%
	\def\citeauthoryear##1##2##3##4{%
		\if@firstcite
			{##2, ##3##4}%
		\else
			\def\@newcitetwo{##2}%
			\ifx\@newcitetwo\@oldcitetwo
				\def\@newcitethree{##3}%
				\ifx\@newcitethree\@oldcitethree
					{,##4}%
				\else
					{,\penalty\@m\ ##3##4}%
				\fi
			\else
				{;\penalty\@m\ ##2, ##3##4}%
			\fi
		\fi
		\def\@oldcitetwo{##2}%
		\def\@oldcitethree{##3}%
	}%
	\@internalcite
}

\def\citeyear{%
	\def\citeauthoryear##1##2##3##4{%
		\if@firstcite
			{##3##4}%
		\else
			\def\@newcitethree{##3}%
			\ifx\@newcitethree\@oldcitethree
				{,##4}%
			\else
				{,\penalty\@m\ ##3##4}%
			\fi
		\fi
		\def\@oldcitethree{##3}%
	}%
	\@internalcite
}

\def\fullciteA{\def\citeauthoryear##1##2##3##4{##1}\@internalcite}
\def\shortciteA{\def\citeauthoryear##1##2##3##4{##2}\@internalcite}

\let\cite=\fullcite

\def\@cite#1#2{(#1\if@tempswa , #2\fi)}
\def\@biblabel#1{}

\newlength{\bibhang}
\setlength{\bibhang}{2em}

\newif\if@firstcite
\newif\if@prenote

\@ifundefined{chapter}{\def\thebibliography#1{\section*{References\@mkboth
  {REFERENCES}{REFERENCES}}\list
  {\relax}{\setlength{\labelsep}{0em}
	\setlength{\itemindent}{-\bibhang}
	\setlength{\leftmargin}{\bibhang}}
    \def\newblock{\hskip .11em plus .33em minus .07em}
    \sloppy\clubpenalty4000\widowpenalty4000
    \sfcode`\.=1000\relax}}%
{\def\thebibliography#1{\chapter*{Bibliography\@mkboth
  {BIBLIOGRAPHY}{BIBLIOGRAPHY}}\list
  {\relax}{\setlength{\labelsep}{0em}
	\setlength{\itemindent}{-\bibhang}
	\setlength{\leftmargin}{\bibhang}}
    \def\newblock{\hskip .11em plus .33em minus .07em}
    \sloppy\clubpenalty4000\widowpenalty4000
    \sfcode`\.=1000\relax}}

\def\@citex(#1)[#2]#3{\if@filesw\immediate\write
                            \@auxout{\string\citation{#3}}\fi
  \@firstcitetrue
  \@cite{\@for\@citeb:=#3\do
    {\def\@tempa##1##2\@nil{\edef\@citeb{\if##1\space##2\else##1##2\fi}}%
    \expandafter\@tempa\@citeb\@nil
    \@ifundefined{b@\@citeb}{{\reset@font\bf ?}\@warning
      {Citation `\@citeb' on page \thepage \space undefined}}%
    {\csname b@\@citeb\endcsname}%
    \@firstcitefalse}}{#1}{#2}}

\def\@internalcite{\@ifnextchar ({\@prenotetrue\@intcite2}%
	   {\@prenotefalse\@intcite2()}}

\def\@intcite2(#1){\@ifnextchar [{\@tempswatrue\@citex(#1)}%
	   {\@tempswafalse\@citex(#1)[]}}

\def\@cite#1#2#3{(\if@prenote #2 \fi#1\if@tempswa , #3\fi)}

\def\nocite#1{%
  \def\citeauthoryear##1##2##3##4##5{##5}%
  \if@filesw\immediate\write\@auxout{\string\citation{#1}}\fi
  \@for\@citeb:=#1\do
    {\def\@tempa##1##2\@nil{\edef\@citeb{\if##1\space##2\else##1##2\fi}}%
    \expandafter\@tempa\@citeb\@nil
    \@ifundefined{b@\@citeb}{{\reset@font\bf ?}\@warning
      {Citation `\@citeb' on page \thepage \space undefined}}%
    {\csname b@\@citeb\endcsname}}}