summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/biblatex-apa/biblatex-apa-test.tex
blob: 1d4c7e68b2d2228150deb2e3651714ece81ced24 (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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
\documentclass[paper=a4]{article}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage{shortvrb}
\usepackage{ifthen}
\usepackage{color}
\usepackage[retainmissing]{MnSymbol}
\usepackage[top=2.5cm]{geometry}

% Unicode
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{TeXGyrePagella}
\setsansfont[Ligatures=TeX]{TexGyreHeros}
\setmonofont[Ligatures=NoCommon]{TeXGyreCursor}
\MakeAutoQuote{«}{»}

% Biblatex
\usepackage[style=apa]{biblatex}

% Custom settings for misc entries in order to format the table for 6.13*
% This table implies that the examples on each line are in a separate
% document but since we are generating the citations from a real data
% source, we have to prevent the usual uniquelist processing by making
% all of the examples MISC entrytypes and changing uniquelist
% per-type. There is no point in just typsetting static data as this
% wouldn't be a test of anything.
\ExecuteBibliographyOptions[misc]{uniquelist=false}
\DeclareNameFormat[misc]{labelname}{%
  \ifthenelse{\value{listcount}=1\OR\value{listtotal}=2}
    {\usebibmacro{labelname:doname}{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}
    {\ifthenelse{\value{listtotal}>5}
      {\ifnum\value{listcount}=2 \andothersdelim\bibstring{andothers}\fi
       \ifnum\value{listcount}>2 \relax\fi}
      {\ifciteseen
       {\ifnum\value{listcount}=2 \andothersdelim\bibstring{andothers}\fi
        \ifnum\value{listcount}=3 \relax\fi
        \ifnum\value{listcount}=4 \relax\fi
        \ifnum\value{listcount}=5 \relax\fi}
       {\usebibmacro{labelname:doname}{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}}}}

\MakeShortVerb{\|}

\newcommand\apa[2][]{\ifthenelse{\equal{#1}{}}%
                       {\textcolor{blue}{\texttt{(APA #2)}}}%
                       {\textcolor{blue}{\texttt{(APA #2 Example #1)}}}}

\setlength{\parskip}{3ex}

\makeatletter
% This solution to detokenize leaving a space after the command and
% arguments is due to Bruno Le Floch on T.SE
\long\def\apaexi#1%
  {%
     \catcode64=11
     \begingroup
        % Ensure that every character is preserved by \lowercase.
        \count@\z@
        \loop\ifnum\count@<256
          \lccode\count@\z@
          \advance\count@\@ne
        \repeat
        % Except spaces, changed to ^^A
        \lccode32=\@ne
        \lowercase
          {%
            \endgroup
            \expandafter\test@\detokenize{#1}\relax%
            \catcode64=12
          }%
  }
% Then map {^^A => space, space =>} onto the string.
\def\test@#1%
  {%
    \ifx#1\relax\test@end\fi
    \ifnum`#1=\@ne\space\else#1\fi
    \test@
   }
\def\test@end\fi#1\test@{\fi}

\def\apaex#1{\hbox{\hspace{-4em}\texttt{\small\apaexi{#1}}}\\$\rcurvearrowse$ \textbf{#1}}
\def\apaexs#1{\hbox{\texttt{\footnotesize\apaexi{#1}}} \textbf{\small #1}}
\makeatother

% This just makes it easier to find a specific (APA 7.x) example in the
% typeset references section
\reversemarginpar
\renewbibmacro*{begentry}{\marginpar{\footnotesize \textcolor{blue}{\thefield{entrykey}}}}

\usepackage[colorlinks=true]{hyperref}

%%%%%%%%%%%%%%%%%%%%%%%%%%%% END PREAMBLE %%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareLanguageMapping{american}{american-apa}

\begin{document}
\section*{|biblatex-apa| style examples}
This file typesets just about all useful examples from
\apa{6.11}--\apa{6.21} and \apa{7.01}--\apa{7.11}. Please refer to the
|biblatex-apa-test-references.bib| file for details on the references
entries. The |.bib| key for each entry in the References section is listed
for convenience in the left margin. The keys are not arbitrary and consist
of the APA section they are taken from (7.01--7.11), followed by a colon,
followed by the example number. This makes it easier to cross-reference
the typeset examples with the commented |.bib| file. I chose not to put the
examples in the References section in example number order so that the APA
requirements for References list alphabetisation and order could also be
demonstrated.

\section*{Citations}
\begin{refsection}[biblatex-apa-test-citations]
\noindent Please see accompanying file |biblatex-apa-test-citations.bib|
for the bibliographic entries which these examples use.

\noindent\apa{4.03}\\
Oxford comma in citations for three or more names:\\
\apaex{\textcite{oc1}}\\
\apaex{\parencite{oc2}}

\noindent\apa{6.11}\\
Simple cite. «Jr.» suffix is not shown (bib entry for this example has a suffix):\\
\apaex{\textcite{6.11}}

\noindent Within a paragraph, not in the «narrative sense»:\\
\apaex{\autocite{6.11}}

\noindent To cite the parts separately:\\
\apaex{\citeyear{6.11}, \citeauthor{6.11}}

\noindent The per-paragraph rules for elision of years are more flexible in
APA 6th edition. There is more discretion to do this as the narrative
consistency suggests and so this style no longer automatically elides years
after the first mention within a paragraph. Cases can be handled as
per the examples above.

\noindent\apa{6.12} \apa{6.13}\\
Citations like\\
\apaex{\textcite{6.12a}}\\
which have two authors are never name-truncated after the first cite:\\
\apaex{\textcite{6.12a}}

\noindent First citation of 3--5 author entry:\\
\apaex{\textcite{6.12b}}

\noindent Subsequent first citations in a paragraph:\\
\apaex{\textcite{6.12b}}\\
Subsequent citations within a paragraph:\\
\apaex{\citeauthor{6.12b}}

\noindent Note that the dropping of the year for subsequent paragraph
citations is not automatic as there may be cases where you don't want to do
this (see APA 6.11).

\noindent Automatic list disambiguation for ambiguous truncations after
first cite\footnote{This feature is fairly deep magic and only works when using
  biblatex 1.4+ together with biber 0.9+}. Note that «et al» is plural so
it will only truncate two or more names. If it would truncate just one
name, we just give the name:\\
\apaex{\textcite{6.12c}}\\
\apaex{\textcite{6.12d}}\\
\apaex{\textcite{6.12c}}\footnote{This example is incorrect in the
  APA 6th edition manual because «et al» is replacing only one name. This has been
  verified with the APA and will be corrected in future editions.}\\
\apaex{\textcite{6.12d}}

\noindent Multiple-authors in running text are separated by «and».
However, in parenthetical cites, multiple authors are separated by «\&»:\\
\apaex{\textcite{6.12e}}\\
\apaex{\parencite{6.12f}}

\noindent Automatic list disambiguation for ambiguous truncations again,
this time the truncation is on first cite as there are more than 5 authors:\\
\apaex{\textcite{6.12g}}\\
\apaex{\textcite{6.12h}}

\noindent Automatic list disambiguation is only for ambiguous author lists
in the same year so these are not disambiguated:\\
\apaex{\textcite{6.12i}}\\
\apaex{\textcite{6.12j}}\\
\apaex{\textcite{6.12i}}\\
\apaex{\textcite{6.12j}}

\noindent The following table replicates with real data the examples
in Table 6.1, p.~177 of the APA 6th Edition manual. Note that this
table in the APA manual essentially assumes that the citations on each
line are in a separate document since there is no list disambiguation
or repeated cite truncations between lines. To simulate this with real
data, the source for this document uses |\citereset| between lines and
makes all of the data entries of MISC type, unsetting «uniquelist» for
this type and using a custom labelname style.

\begin{center}
\begin{tabular}{lllll}
\textbf{\parbox{2cm}{\center Type of citation}} & \textbf{\parbox{2.4cm}{\center First
    citation in text}} & \textbf{\parbox{2.4cm}{\center Subsequent citations in
    text}} & \textbf{\parbox{2.4cm}{\center Parenthetical format, first citation
    in text}} & \textbf{\parbox{2.4cm}{\center Parenthetical format, subsequent
    citations in text}}\\\\
\hline
\\
\parbox{2cm}{\raggedright One work by one author}
& \parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13a}}} &
\parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13a}}}\citereset
& \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13a}}}
& \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13a}}}\\\\
\parbox{2cm}{\raggedright One work by two authors}
& \parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13b}}} & 
\parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13b}}}\citereset
& \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13b}}}
& \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13b}}}\\\\
\parbox{2cm}{\raggedright One work by three authors}
& \parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13c}}} & 
\parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13c}}}\citereset
& \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13c}}}
& \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13c}}}\\\\
\parbox{2cm}{\raggedright One work by four authors}
& \parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13d}}} & 
\parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13d}}}\citereset
& \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13d}}}
& \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13d}}}\\\\
\parbox{2cm}{\raggedright One work by five authors}
& \parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13e}}} & 
\parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13e}}}\citereset
& \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13e}}}
& \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13e}}}\\\\
\parbox{2cm}{\raggedright One work by six authors}
& \parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13f}}} & 
\parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13f}}}\citereset
& \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13f}}}
& \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13f}}}\\\\
\parbox{2cm}{\raggedright Groups (readily identified through abbreviation) as authors}
& \parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13g}}} & 
\parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13g}}}\citereset\citeresetapa
& \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13g}}}
& \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13g}}}\\\\
\parbox{2cm}{\raggedright Groups (no abbreviation) as authors}
& \parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13h}}} & 
\parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13h}}}\citereset
& \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13h}}}
& \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13h}}}\\\\
\hline
\end{tabular}
\end{center}

\noindent\apa{6.13}\\
Author abbreviations should work between citations of different works by
the author:\\
\apaex{\parencite{6.13i}}\\
\apaex{\parencite{6.13i}}\\
\apaex{\parencite{6.13j}}

\noindent\apa{6.14}\\
Citations of an entry with an author who shares a
surname with another entry always appears with initials\footnote{This is,
  as with automatic name list disambiguation, fairly deep magic only
  possible with biblatex 1.4+ and biber 0.9+}. Note that the APA example
for this is not really correct for any automated system as the ambiguous
surname should be disambiguated with initials in both cases---we still
don't really know in the APA example whether the Light in the 2008 paper is
the same as the Light in the 2006. The disambiguation performed by biblatex
makes this clear (or as clear as it can be):\\
\apaex{\textcite{6.14}}\\
\apaex{\textcite{7.01:3b}}

\noindent\apa{6.15}\\
Use |SHORTTITLE| field of the entry if it exists:\\
\apaex{\parencite{6.15a}}\\\\
Books, reports etc. use italics instead of quotes:\\
\apaex{\textcite{6.15b}}\\\\
Citing anonymous author:\\
\apaex{\textcite{6.15c}}

\noindent\apa{6.16}\\
Two or more works within the same parentheses:\\
\apaex{\parencite{6.16a,6.16b}}\\
\apaex{\parencite{6.16c,6.16d,6.16e}}

\noindent Citations of works by same authors in the same year:\\
\apaex{\parencite{6.16f,6.16g,6.16h,6.16i,6.16j}}\\\\
\textcolor{red}{Note: This example, (p.~178 APA Manual 6th edition, 2nd
  printing) is slightly odd as the «in press-a» is not indicated and
  should be «in press» since no other in press items are listed for the
  same authors in the example.}

\noindent Compact citations in alphabetic order:\\
\apaex{\parencites{6.16k,6.16l}}

\noindent Compact citations with special order:\\
\apaex{\parencites{6.16m}[see also][]{6.16n,6.16o}}

\noindent «in press» should have hyphen before disambiguating part of label
(also in references):\\
\apaex{\parencite{6.16p,6.16q,6.16r}}

\noindent\apa{6.17}\\
Secondary sources:\\
\apaex{\parencite[as cited in][]{6.17}}

\noindent\apa{6.18}\\
Classical works:\\
\apaex{(\citeauthor{6.18a}, trans. \citeyear{6.18a})}\\
\textcolor{red}{Note: The example is managed using lower-level cite
  commands. This is another example of the APA not really thinking about
  automated processing and specifying an anomalous infix format. It would
  be better and probably acceptable for it to be:}\\
\apaex{\parencite[][trans.]{6.18a}}\\\\
Entries with an |ORIGYEAR| field will automatically use it:\\
\apaex{\textcite{6.18b}}\\\\
The other examples of standard classical texts in this section should just
be typed by hand--there is little benefit to automating these examples and
they wouldn't usually be in the References section anyway.

\noindent\apa{6.19}\\
These examples are easily dealt with using standard |biblatex| functionality.\\
\apaex{\parencite[][10]{6.19a}}\\
\apaex{\parencite[][Chapter 3]{6.19b}}

\noindent\apa{6.20}\\
Such cases are just typed out--they have no Reference section entry and
don't therefore have a bibliography database entry.

\noindent\apa{6.21}\\
Within parentheses, use the |\nptextcite| command which is equivalent to
the |\textcite| command but omits the parenthesis and uses commas instead.
See the |biblatex-apa| docs.\\
\apaex{(\nptextcite[see Table 3 of][]{6.21} for complete data)}

\noindent\apa{6.28}\\
Entries with no date use «n.d.».\\
\apaex{\textcite{6.28a}}\\
\apaex{\parencite{6.28a}}\\
\apaex{(\nptextcite{6.28a})}

\noindent\apa{7.01:12c}\\
Issue with no editors\\
\apaex{\parencite{7.01:12c}}

\noindent\apa{A7.07}\\
A patent citation uses the title but with no quotes\\
\apaex{\textcite{A7.07}}\\
\apaex{\parencite{A7.07}}

\noindent Some tests of uniqueness and uniquelist

\noindent Two works by same authors in same year are disambiguated by extrayear «a»
and «b» and are truncated after first cite because it is the same author
list and therefore not ambiguous:\\
\apaex{\textcite{UL1}}\\
\apaex{\textcite{UL1}}\\
\apaex{\textcite{UL2}}\\
\apaex{\textcite{UL2}}\\

\noindent One author list is an ordered subset of the other and so both need fully
expanding to be properly disambiguated. Truncating either would be ambiguous.\\
\apaex{\textcite{UL3}}\\
\apaex{\textcite{UL3}}\\
\apaex{\textcite{UL4}}\\
\apaex{\textcite{UL4}}

\noindent Some misc citation cases\\
\apaex{\textcite{6.16c,6.16d,6.16e}}\\
\apaex{\textcite{6.16f,6.16g,6.16h}}\\
\apaex{\textcite{6.16f,6.16g,6.16h,6.16i,6.16j}}\\
Note here that the multicite delimiter is a comma as in running text, a
semi-colon would be strange:
\apaex{\textcites{6.16f}{6.16g}{6.16h}{6.16i}{6.16j}}\\
\apaex{\cite{6.16f,6.16g,6.16h,6.16i,6.16j}}\\
\apaex{\cite{6.16k,6.16l}}\\
\apaex{\fullcite{FC1}}\\
\apaex{\fullcitebib{FC1}}

% In citations, "WITH" is ignored (APA 6.27)
\noindent Testing «with»---should not be present in cites\\
\apaex{\cite{with1}}\\
\apaex{\textcite{with1}}

\noindent Testing author name citing\\
\apaex{\citeauthor{ca1}}\\
\apaex{\citeauthor{ca1}}

\noindent Testing nodate\\
\apaex{\textcite{nodate1}}\\
\apaex{\textcite{nodate2}}

\noindent Testing full name expansion (APA 6.27). See citation refs for how
these appear in references\\
\apaex{\textcite{6.27a}}\\
\apaex{\textcite{6.27b}}

\noindent Testing suffices\\
\apaex{\textcite{stest1}}\\
\apaex{\textcite{stest2}}

\noindent Testing prefices\\
\apaex{\textcite{pretest}}\\
\apaex{\textcite{nopretest}}

% presufftest2 and nopresufftest have same year but don't have extrayear
% because useprefix=false for MISC and this is taken account of in
% extrayear generation
\noindent Testing prefices plus suffices\\
\apaex{\textcite{presufftest}}\\
\apaex{\textcite{presufftest2}}\\
\apaex{\textcite{nopresufftest}}

% Testing "and others"
\noindent Testing «and others»\\
\apaex{\textcite{ao}}

% Testing season
\noindent Testing seasonal periodical citations\\
\apaex{\textcite{season1}}

\end{refsection}
\begin{refsection}[biblatex-apa-test-references]
\nocite{*}
\end{refsection}
\newpage
% Just (APA 7.x) real references and related entry examples here
\printbibliography[section=2]
\newpage
% Include a references section for citation examples just so hyperref
% targets can be checked
\printbibliography[section=1,title=Misc citation references]
\end{document}