comparison writeup/mlapa.sty @ 406:a11274742088

Add bibliography style files.
author Arnaud Bergeron <abergeron@gmail.com>
date Wed, 28 Apr 2010 14:28:32 -0400
parents
children
comparison
equal deleted inserted replaced
405:195f95c3d461 406:a11274742088
1 % mlapa.sty style, used in conjunction with mlapa.bst, will produce
2 % an APA-like bibliography style.
3 %
4 % 1) Bibliography entries formatted alphabetically, last name
5 % first, each entry having a hanging indentation and no label.
6 % 2) References in the following formats:
7 % (Author, 1986)
8 % (Author & Author, 1986)
9 % (Author et al., 1986).
10 % 3) Multiple references in the form (Author1, 1986; Author2, 1987)
11 %
12 % To be used as an optional argument to the \documentstyle command; for example
13 % \documentstyle[11pt,apalike]{book}
14 %
15 % 16-Sep-86, original version by Susan King and Oren Patashnik.
16 % 13-Oct-87 changes:
17 % Fixed bug in last line by adding the {} that disappeard when
18 % the \hbox{} was removed from the pre-APALIKE definition;
19 % added club and widow penalties;
20 % patched the \newblock LaTeX bug from `-.07em' to simply `.07em';
21 % and made this work for document styles that don't define `chapter'.
22 % Use brackets for \cite, and no label in the bibliography
23 %
24 % 12/11/89 Use parenthesis () for \cite, (Risto Miikkulainen)
25 %
26 % ---------------------------------------------------------------------------
27 % The following major changes by Risto Miikkulainen 4/8/92:
28 % new style name: myapalike.sty
29 %
30 % The new commands below generate various embedded citations and multiple
31 % years for one authorname and citations without the enclosing parenthesis.
32 % They are enough to generate the standard apa style refs; however,
33 % there is a lot of room for improvement. For example:
34 % - the macros should alphabetize the entries automatically (maybe);
35 % - they should generate multiple years automatically, i.e. if the
36 % current author is the same as previous one, do not repeat it.
37 % This would make \single macros unnecessary.
38 % - with multiple emcites, it should add commas and the word ``and''
39 % automatically between cites.
40 % - Bug: in book style sometimes all the bib entries are dumped on an
41 % extra page in the end. (Just throw that page away if it ever appears.)
42 % - Another bug: for some reason, latex adds extra space after et al.
43 % with emcites and singlecites.
44 % If you have a chance to fix any of these things, let me know.
45 %
46 % You have to use this style with myapalike.bst; it generates bibitems
47 % of the form
48 % \bibitem[Elman, 1989a][Elman][1989a]{elman:representation}
49 % that this file expects to find in the bbl file.
50 %
51 % Examples of commands and what they generate:
52 %
53 %\cite{foobar:1990,doesmith:1991} -- (Foo and Bar 1990; Doe and Smith 1991)
54 %\aucite -- (Foo and Bar; Doe and Smith)
55 %\aunpcite -- Foo and Bar; Doe and Smith
56 %\yrcite -- (1990; 1991)
57 %\yrnpcite -- 1990; 1991
58 %\npcite -- Foo and Bar 1990; Doe and Smith 1991
59 %\emcite -- Foo and Bar (1990); Doe and Smith (1991)
60 %\singlecite -- (Foo and Bar 1990, 1991)
61 %\singlenpcite -- Foo and Bar 1990, 1991
62 %\singleemcite -- Foo and Bar (1990, 1991)
63
64 % Additional changes made by Pat Langley (1/20/2000).
65
66 \def\@biblabel#1{}
67
68 % Set length of hanging indentation for bibliography entries
69 %
70 \newlength{\bibhang}
71 % \setlength{\bibhang}{2em}
72 % Reduce the handing indent for two-column format
73 \setlength{\bibhang}{10pt}
74
75 % \thebibliography environment depends on whether or not `chapter's can exist
76 %
77 \@ifundefined{chapter}{\def\thebibliography#1{\section*{References\@mkboth
78 {REFERENCES}{REFERENCES}}\list
79 {\relax}{\setlength{\labelsep}{0em}
80 \setlength{\itemindent}{-\bibhang}
81 \setlength{\leftmargin}{\bibhang}}
82 \def\newblock{\hskip .11em plus .33em minus .07em}
83 \sloppy\clubpenalty4000\widowpenalty4000
84 \sfcode`\.=1000\relax}}%
85 {\def\thebibliography#1{\chapter*{Bibliography\@mkboth
86 {BIBLIOGRAPHY}{BIBLIOGRAPHY}}\list
87 {\relax}{\setlength{\labelsep}{0em}
88 \setlength{\itemindent}{-\bibhang}
89 \setlength{\leftmargin}{\bibhang}}
90 \def\newblock{\hskip .11em plus .33em minus .07em}
91 \sloppy\clubpenalty4000\widowpenalty4000
92 \sfcode`\.=1000\relax}}
93
94 % `; ' goes between cites, and there's no \hbox around individual cites
95 %
96 \def\@citex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
97 \def\@citea{}\@cite{\@for\@citeb:=#2\do
98 {\@citea\def\@citea{; }\@ifundefined
99 {b@\@citeb}{{\bf ?}\@warning
100 {Citation `\@citeb' on page \thepage \space undefined}}%
101 {\csname b@\@citeb\endcsname}}}{#1}}
102
103 \def\aucite{\@ifnextchar [{\@tempswatrue\@aucitex}{\@tempswafalse\@aucitex[]}}
104 \def\aunpcite{\@ifnextchar [{\@tempswatrue\@aunpcitex}{\@tempswafalse\@aunpcitex[]}}
105 \def\yrcite{\@ifnextchar [{\@tempswatrue\@yrcitex}{\@tempswafalse\@yrcitex[]}}
106 \def\yrnpcite{\@ifnextchar [{\@tempswatrue\@yrnpcitex}{\@tempswafalse\@yrnpcitex[]}}
107 \def\npcite{\@ifnextchar [{\@tempswatrue\@npcitex}{\@tempswafalse\@npcitex[]}}
108 \def\emcite{\@ifnextchar [{\@tempswatrue\@emcitex}{\@tempswafalse\@emcitex[]}}
109 \def\singlecite{\@ifnextchar [{\@tempswatrue\@singlecitex}{\@tempswafalse\@singlecitex[]}}
110 \def\singlenpcite{\@ifnextchar [{\@tempswatrue\@singlenpcitex}{\@tempswafalse\@singlenpcitex[]}}
111 \def\singleemcite{\@ifnextchar [{\@tempswatrue\@singleemcitex}{\@tempswafalse\@singleemcitex[]}}
112
113 % use ``,'' between author labels
114 \def\@aucitex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
115 \def\@citea{}\@aucite{\@for\@citeb:=#2\do
116 {\@citea\def\@citea{; }\@ifundefined
117 {aub@\@citeb}{{\bf ?}\@warning
118 {Citation `\@citeb' on page \thepage \space undefined}}%
119 {\csname aub@\@citeb\endcsname}}}{#1}}
120
121 % use ``,'' between author labels
122 \def\@aunpcitex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
123 \def\@citea{}\@aunpcite{\@for\@citeb:=#2\do
124 {\@citea\def\@citea{; }\@ifundefined
125 {aub@\@citeb}{{\bf ?}\@warning
126 {Citation `\@citeb' on page \thepage \space undefined}}%
127 {\csname aub@\@citeb\endcsname}}}{#1}}
128
129 % use ``,'' between year-only-labels,
130 \def\@yrcitex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
131 \def\@citea{}\@yrcite{\@for\@citeb:=#2\do
132 {\@citea\def\@citea{; }\@ifundefined
133 {yrb@\@citeb}{{\bf ?}\@warning
134 {Citation `\@citeb' on page \thepage \space undefined}}%
135 {\csname yrb@\@citeb\endcsname}}}{#1}}
136
137 % use ``,'' between year-only-labels,
138 \def\@yrnpcitex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
139 \def\@citea{}\@yrnpcite{\@for\@citeb:=#2\do
140 {\@citea\def\@citea{; }\@ifundefined
141 {yrb@\@citeb}{{\bf ?}\@warning
142 {Citation `\@citeb' on page \thepage \space undefined}}%
143 {\csname yrb@\@citeb\endcsname}}}{#1}}
144
145 % use `; ' between parenthesisless cites
146 %
147 \def\@npcitex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
148 \def\@citea{}\@npcite{\@for\@citeb:=#2\do
149 {\@citea\def\@citea{; }\@ifundefined
150 {b@\@citeb}{{\bf ?}\@warning
151 {Citation `\@citeb' on page \thepage \space undefined}}%
152 {\csname b@\@citeb\endcsname}}}{#1}}
153
154 %
155 \newcounter{myfoo}
156 \def\@singleemcitex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
157 \setcounter{myfoo}{0}\@for\@citeb:=#2\do{\ifnum\c@myfoo=0{\csname aub@\@citeb\endcsname}\addtocounter{myfoo}{1}\fi}
158 \def\@citea{}\@yrcite{\@for\@citeb:=#2\do
159 {\@citea\def\@citea{; }\@ifundefined
160 {yrb@\@citeb}{{\bf ?}\@warning
161 {Citation `\@citeb' on page \thepage \space undefined}}%
162 {\csname yrb@\@citeb\endcsname}}}{#1}}
163
164 %
165 \def\@singlecitex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
166 \def\@citea{(}\@citea\setcounter{myfoo}{0}\@for\@citeb:=#2\do{\ifnum\c@myfoo=0{\csname aub@\@citeb\endcsname}\addtocounter{myfoo}{1}\fi}
167 \def\@citea{}\@yrnpcite{\@for\@citeb:=#2\do
168 {\@citea\def\@citea{; }\@ifundefined
169 {yrb@\@citeb}{{\bf ?}\@warning
170 {Citation `\@citeb' on page \thepage \space undefined}}%
171 {\csname yrb@\@citeb\endcsname}}}{#1}\def\@citea{)}\@citea}
172
173 %
174 \def\@singlenpcitex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
175 \setcounter{myfoo}{0}\@for\@citeb:=#2\do{\ifnum\c@myfoo=0{\csname aub@\@citeb\endcsname}\addtocounter{myfoo}{1}\fi}
176 \def\@citea{}\@yrnpcite{\@for\@citeb:=#2\do
177 {\@citea\def\@citea{; }\@ifundefined
178 {yrb@\@citeb}{{\bf ?}\@warning
179 {Citation `\@citeb' on page \thepage \space undefined}}%
180 {\csname yrb@\@citeb\endcsname}}}{#1}}
181
182 % use ``,'' between embedded cites
183 \def\@emcitex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
184 \def\@citea{}\@for\@citeb:=#2\do
185 {\@citea\def\@citea{; }\@aunpcite{\@ifundefined {aub@\@citeb}
186 {{\bf ?}\@warning{Citation `\@citeb' on page \thepage \space undefined}}
187 {\csname aub@\@citeb\endcsname}}{}
188 \@yrcite{\@ifundefined {yrb@\@citeb}
189 {{\bf ?}\@warning{Citation `\@citeb' on page \thepage \space undefined}}
190 {\csname yrb@\@citeb\endcsname}}{#1}}}
191
192 % define b@CITENAME as the full label and aub@CITENAME as the
193 % authors-only-label and yrb@CITENAME as the year-only-label
194 \def\bibcite#1#2#3#4{\global\@namedef{b@#1}{#2}
195 \global\@namedef{aub@#1}{#3}
196 \global\@namedef{yrb@#1}{#4}}
197
198 % parenthesis/no parenthesis around the label
199 \def\@cite#1#2{(#1\if@tempswa , #2\fi)}
200 \def\@aucite#1#2{(#1\if@tempswa , #2\fi)}
201 \def\@yrcite#1#2{(#1\if@tempswa , #2\fi)}
202 \def\@npcite#1#2{#1\if@tempswa , #2\fi}
203 \def\@aunpcite#1#2{#1\if@tempswa , #2\fi}
204 \def\@yrnpcite#1#2{#1\if@tempswa , #2\fi}
205
206 \def\@lbibitem[#1][#2][#3]#4{\item[\@biblabel{#1}]\if@filesw
207 { \def\protect##1{\string ##1\space}\immediate
208 \write\@auxout{\string\bibcite{#4}{#1}{#2}{#3}}}\fi\ignorespaces}