summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/mslapa/mslapa.sty
blob: b0a2ba78de9d4134d841bbf6ff4bac15dadb3d70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
% 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}}}