Debian Codegraph @

texmf-dist/doc/latex/biblatex-apa6/biblatex-apa6-test.tex

raw
1 \documentclass[paper=a4]{article}
2 \usepackage[american]{babel}
3 \usepackage{csquotes}
4 \usepackage{shortvrb}
5 \usepackage{ifthen}
6 \usepackage{color}
7 \usepackage[retainmissing]{MnSymbol}
8 \usepackage[top=2.5cm]{geometry}
9
10 % Unicode
11 \usepackage{fontspec}
12 \setmainfont[Ligatures=TeX]{TeXGyrePagella}
13 \setsansfont[Ligatures=TeX]{TexGyreHeros}
14 \setmonofont[Ligatures=NoCommon]{TeXGyreCursor}
15 \MakeAutoQuote{«}{»}
16
17 % Biblatex
18 \usepackage[style=apa6]{biblatex}
19
20 % Custom settings for misc entries in order to format the table for 6.13*
21 % This table implies that the examples on each line are in a separate
22 % document but since we are generating the citations from a real data
23 % source, we have to prevent the usual uniquelist processing by making
24 % all of the examples MISC entrytypes and changing uniquelist
25 % per-type. There is no point in just typesetting static data as this
26 % wouldn't be a test of anything.
27 \ExecuteBibliographyOptions[misc]{uniquelist=false}
28 \DeclareNameFormat[misc]{labelname}{%
29 \ifthenelse{\value{listcount}=1\OR\value{listtotal}=2}
30 {\usebibmacro{labelname:doname}
31 {\namepartfamily}
32 {\namepartfamilyi}
33 {\namepartgiven}
34 {\namepartgiveni}
35 {\namepartprefix}
36 {\namepartprefixi}
37 {\namepartsuffix}
38 {\namepartsuffixi}}
39 {\ifthenelse{\value{listtotal}>5}
40 {\ifnum\value{listcount}=2 \andothersdelim\bibstring{andothers}\fi
41 \ifnum\value{listcount}>2 \relax\fi}
42 {\ifciteseen
43 {\ifnum\value{listcount}=2 \andothersdelim\bibstring{andothers}\fi
44 \ifnum\value{listcount}=3 \relax\fi
45 \ifnum\value{listcount}=4 \relax\fi
46 \ifnum\value{listcount}=5 \relax\fi}
47 {\usebibmacro{labelname:doname}
48 {\namepartfamily}
49 {\namepartfamilyi}
50 {\namepartgiven}
51 {\namepartgiveni}
52 {\namepartprefix}
53 {\namepartprefixi}
54 {\namepartsuffix}
55 {\namepartsuffixi}}}}}
56 \MakeShortVerb{\|}
57
58 \newcommand\apa[2][]{\ifthenelse{\equal{#1}{}}%
59 {\textcolor{blue}{\texttt{(APA #2)}}}%
60 {\textcolor{blue}{\texttt{(APA #2 Example #1)}}}}
61
62 \setlength{\parskip}{3ex}
63
64 \makeatletter
65 % This solution to detokenize leaving a space after the command and
66 % arguments is due to Bruno Le Floch on T.SE
67 \long\def\apaexi#1{%
68 \catcode64=11
69 \begingroup
70 % Ensure that every character is preserved by \lowercase.
71 \count@\z@
72 \loop\ifnum\count@<256
73 \lccode\count@\z@
74 \advance\count@\@ne
75 \repeat
76 % Except spaces, changed to ^^A
77 \lccode32=\@ne
78 \lowercase{%
79 \endgroup
80 \expandafter\test@\detokenize{#1}\relax%
81 \catcode64=12}}
82 % Then map {^^A => space, space =>} onto the string.
83 \def\test@#1{%
84 \ifx#1\relax\test@end\fi
85 \ifnum`#1=\@ne\space\else#1\fi
86 \test@}
87 \def\test@end\fi#1\test@{\fi}
88
89 \def\apaex#1{\hbox{\hspace{-4em}\texttt{\small\apaexi{#1}}}\\$\rcurvearrowse$ \textbf{#1}}
90 \def\apaexs#1{\hbox{\texttt{\footnotesize\apaexi{#1}}} \textbf{\small #1}}
91 \makeatother
92
93 % This just makes it easier to find a specific (APA 7.x) example in the
94 % typeset references section
95 \reversemarginpar
96 \renewbibmacro*{begentry}{\marginpar{\footnotesize \textcolor{blue}{\thefield{entrykey}}}}
97
98 \usepackage[colorlinks=true]{hyperref}
99
100 %%%%%%%%%%%%%%%%%%%%%%%%%%%% END PREAMBLE %%%%%%%%%%%%%%%%%%%%%%%%%
101
102 \begin{document}
103 \section*{|biblatex-apa| style examples}
104 This file typesets just about all useful examples from
105 \apa{6.11}--\apa{6.21} and \apa{7.01}--\apa{7.11}. Also included are some
106 clarifications from the APA blog
107 (\url{http://blog.apastyle.org/apastyle/}). Please refer to the
108 |biblatex-apa6-test-references.bib| file for details on the references
109 entries. The |.bib| key for each entry in the References section is listed
110 for convenience in the left margin. The keys are not arbitrary and consist
111 of the APA section they are taken from (7.01--7.11), followed by a colon,
112 followed by the example number. This makes it easier to cross-reference the
113 typeset examples with the commented |.bib| file. I chose not to put the
114 examples in the References section in example number order so that the APA
115 requirements for References list alphabetisation and order could also be
116 demonstrated.
117
118 \section*{Citations}
119 \begin{refsection}[../bibtex/bib/biblatex-apa6-test-citations]
120 \noindent Please see accompanying file |biblatex-apa6-test-citations.bib|
121 for the bibliographic entries which these examples use.
122
123 \noindent\apa{4.03}\\
124 Oxford comma in citations for three or more names:\\
125 \apaex{\textcite{oc1}}\\
126 \apaex{\parencite{oc2}}
127
128 \noindent\apa{6.11}\\
129 Simple cite. «Jr.» suffix is not shown (bib entry for this example has a suffix):\\
130 \apaex{\textcite{6.11}}
131
132 \noindent Within a paragraph, not in the «narrative sense»:\\
133 \apaex{\autocite{6.11}}
134
135 \noindent To cite the parts separately:\\
136 \apaex{\citeyear{6.11}, \citeauthor{6.11}}
137
138 \noindent The per-paragraph rules for elision of years are more flexible in
139 APA 6th edition. There is more discretion to do this as the narrative
140 consistency suggests and so this style no longer automatically elides years
141 after the first mention within a paragraph. Cases can be handled as
142 per the examples above.
143
144 \noindent\apa{6.12} \apa{6.13}\\
145 Citations like\\
146 \apaex{\textcite{6.12a}}\\
147 which have two authors are never name-truncated after the first cite:\\
148 \apaex{\textcite{6.12a}}
149
150 \noindent First citation of 3--5 author entry:\\
151 \apaex{\textcite{6.12b}}
152
153 \noindent Subsequent citations:\\
154 \apaex{\textcite{6.12b}}\\
155 Subsequent citations within a paragraph:\\
156 \apaex{\citeauthor{6.12b}}
157
158 \noindent Note that the dropping of the year for subsequent paragraph
159 citations is not automatic as there may be cases where you don't want to do
160 this (see APA 6.11).
161
162 \noindent Automatic list disambiguation for ambiguous truncations after
163 first cite. Note that «et al» is plural so
164 it will only truncate two or more names. If it would truncate just one
165 name, we just give the name:\\
166 \apaex{\textcite{6.12c}}\\
167 \apaex{\textcite{6.12d}}\\
168 \apaex{\textcite{6.12c}}\footnote{This example is incorrect in the
169 APA 6th edition manual because «et al» is replacing only one name. This has been
170 verified with the APA and will be corrected in future editions.}\\
171 \apaex{\textcite{6.12d}}
172
173 \noindent Multiple-authors in running text are separated by «and».
174 However, in parenthetical cites, multiple authors are separated by «\&»:\\
175 \apaex{\textcite{6.12e}}\\
176 \apaex{\parencite{6.12f}}
177
178 \noindent Automatic list disambiguation for ambiguous truncations again,
179 this time the truncation is on first cite as there are more than 5 authors:\\
180 \apaex{\textcite{6.12g}}\\
181 \apaex{\textcite{6.12h}}
182
183 \noindent Automatic list disambiguation is only for ambiguous author lists
184 in the same year so these are not disambiguated:\\
185 \apaex{\textcite{6.12i}}\\
186 \apaex{\textcite{6.12j}}\\
187 \apaex{\textcite{6.12i}}\\
188 \apaex{\textcite{6.12j}}
189
190 \noindent The following table replicates with real data the examples
191 in Table 6.1, p.~177 of the APA 6th Edition manual. Note that this
192 table in the APA manual essentially assumes that the citations on each
193 line are in a separate document since there is no list disambiguation
194 or repeated cite truncations between lines. To simulate this with real
195 data, the source for this document uses |\citereset| between lines and
196 makes all of the data entries of MISC type, unsetting «uniquelist» for
197 this type and using a custom labelname style.
198
199 \begin{center}
200 \begin{tabular}{lllll}
201 \textbf{\parbox{2cm}{\center Type of citation}} & \textbf{\parbox{2.4cm}{\center First
202 citation in text}} & \textbf{\parbox{2.4cm}{\center Subsequent citations in
203 text}} & \textbf{\parbox{2.4cm}{\center Parenthetical format, first citation
204 in text}} & \textbf{\parbox{2.4cm}{\center Parenthetical format, subsequent
205 citations in text}}\\\\
206 \hline
207 \\
208 \parbox{2cm}{\raggedright One work by one author}
209 & \parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13a}}} &
210 \parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13a}}}\citereset
211 & \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13a}}}
212 & \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13a}}}\\\\
213 \parbox{2cm}{\raggedright One work by two authors}
214 & \parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13b}}} &
215 \parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13b}}}\citereset
216 & \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13b}}}
217 & \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13b}}}\\\\
218 \parbox{2cm}{\raggedright One work by three authors}
219 & \parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13c}}} &
220 \parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13c}}}\citereset
221 & \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13c}}}
222 & \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13c}}}\\\\
223 \parbox{2cm}{\raggedright One work by four authors}
224 & \parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13d}}} &
225 \parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13d}}}\citereset
226 & \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13d}}}
227 & \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13d}}}\\\\
228 \parbox{2cm}{\raggedright One work by five authors}
229 & \parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13e}}} &
230 \parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13e}}}\citereset
231 & \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13e}}}
232 & \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13e}}}\\\\
233 \parbox{2cm}{\raggedright One work by six authors}
234 & \parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13f}}} &
235 \parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13f}}}\citereset
236 & \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13f}}}
237 & \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13f}}}\\\\
238 \parbox{2cm}{\raggedright Groups (readily identified through abbreviation) as authors}
239 & \parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13g}}} &
240 \parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13g}}}\citereset\citeresetapa
241 & \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13g}}}
242 & \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13g}}}\\\\
243 \parbox{2cm}{\raggedright Groups (no abbreviation) as authors}
244 & \parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13h}}} &
245 \parbox{2.4cm}{\raggedright\apaexs{\textcite{6.13h}}}\citereset
246 & \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13h}}}
247 & \parbox{2.4cm}{\raggedright\apaexs{\parencite{6.13h}}}\\\\
248 \hline
249 \end{tabular}
250 \end{center}
251
252 \noindent\apa{6.13}\\
253 Author abbreviations should work between citations of different works by
254 the author:\\
255 \apaex{\parencite{6.13i}}\\
256 \apaex{\parencite{6.13i}}\\
257 \apaex{\parencite{6.13j}}
258
259 \noindent\apa{6.14}\\
260 Citations of an entry with an author who shares a
261 surname with another entry always appears with initials when primary
262 author. It is not explicit in the APA 6th edition manual but initials only
263 appear with primary authors\footnote{\url{http://blog.apastyle.org/apastyle/2014/01/when-to-use-author-initials-for-text-citations.html}}:\\
264 \apaex{\textcite{6.14}}\\
265 \apaex{\textcite{7.01:3b}}
266
267 \noindent\apa{6.15}\\
268 Use |SHORTTITLE| field of the entry if it exists:\\
269 \apaex{\parencite{6.15a}}\\\\
270 Books, reports etc. use italics instead of quotes:\\
271 \apaex{\textcite{6.15b}}\\\\
272 Citing anonymous author:\\
273 \apaex{\textcite{6.15c}}
274
275 \noindent\apa{6.16}\\
276 Two or more works within the same parentheses:\\
277 \apaex{\parencite{6.16a,6.16b}}\\
278 \apaex{\parencite{6.16c,6.16d,6.16e}}
279
280 \noindent Citations of works by same authors in the same year:\\
281 \apaex{\parencite{6.16f,6.16g,6.16h,6.16i,6.16j}}\\\\
282 \textcolor{red}{Note: This example, (p.~178 APA Manual 6th edition, 2nd
283 printing) is slightly odd as the «in press-a» is not indicated and
284 should be «in press» since no other in press items are listed for the
285 same authors in the example.}
286
287 \noindent Compact citations in alphabetic order:\\
288 \apaex{\parencites{6.16k,6.16l}}
289
290 \noindent Compact citations with special order:\\
291 \apaex{\parencites{6.16m}[see also][]{6.16n,6.16o}}
292
293 \noindent «in press» should have hyphen before disambiguating part of label
294 (also in references):\\
295 \apaex{\parencite{6.16p,6.16q,6.16r}}
296
297 \noindent\apa{6.17}\\
298 Secondary sources:\\
299 \apaex{\parencite[as cited in][]{6.17}}
300
301 \noindent\apa{6.18}\\
302 Classical works:\\
303 \apaex{(\citeauthor{6.18a}, trans. \citeyear{6.18a})}\\
304 \textcolor{red}{Note: The example is managed using lower-level cite
305 commands. This is another example of the APA not really thinking about
306 automated processing and specifying an anomalous infix format. It would
307 be better and probably acceptable for it to be:}\\
308 \apaex{\parencite[][trans.]{6.18a}}\\\\
309 Entries with an |ORIGDATE| field will automatically use it:\\
310 \apaex{\textcite{6.18b}}\\\\
311 The other examples of standard classical texts in this section should just
312 be typed by hand--there is little benefit to automating these examples and
313 they wouldn't usually be in the References section anyway.
314
315 \noindent\apa{6.19}\\
316 These examples are easily dealt with using standard |biblatex| functionality.\\
317 \apaex{\parencite[][10]{6.19a}}\\
318 \apaex{\parencite[][Chapter 3]{6.19b}}
319
320 \noindent\apa{6.20}\\
321 Such cases are just typed out--they have no Reference section entry and
322 don't therefore have a bibliography database entry.
323
324 \noindent\apa{6.21}\\
325 Within parentheses, use the |\nptextcite| command which is equivalent to
326 the |\textcite| command but omits the parenthesis and uses commas instead.
327 See the |biblatex-apa6| docs.\\
328 \apaex{(\nptextcite[see Table 3 of][]{6.21} for complete data)}
329
330 \noindent\apa{6.28}\\
331 Entries with no date use «n.d.».\\
332 \apaex{\textcite{6.28a}}\\
333 \apaex{\parencite{6.28a}}\\
334 \apaex{(\nptextcite{6.28a})}
335
336 \noindent\apa{7.01:12c}\\
337 Issue with no editors\\
338 \apaex{\parencite{7.01:12c}}
339
340 \noindent\apa{A7.07}\\
341 A patent citation uses the title but with no quotes\\
342 \apaex{\textcite{A7.07}}\\
343 \apaex{\parencite{A7.07}}
344
345 \noindent Some tests of uniqueness and uniquelist
346
347 \noindent Two works by same authors in same year are disambiguated by extradate «a»
348 and «b» and are truncated after first cite because it is the same author
349 list and therefore not ambiguous:\\
350 \apaex{\textcite{UL1}}\\
351 \apaex{\textcite{UL1}}\\
352 \apaex{\textcite{UL2}}\\
353 \apaex{\textcite{UL2}}\\
354
355 \noindent One author list is an ordered subset of the other and so both need fully
356 expanding to be properly disambiguated. Truncating either would be ambiguous.\\
357 \apaex{\textcite{UL3}}\\
358 \apaex{\textcite{UL3}}\\
359 \apaex{\textcite{UL4}}\\
360 \apaex{\textcite{UL4}}
361
362 \noindent Some misc citation cases\\
363 \apaex{\textcite{6.16c,6.16d,6.16e}}\\
364 \apaex{\textcite{6.16f,6.16g,6.16h}}\\
365 \apaex{\textcite{6.16f,6.16g,6.16h,6.16i,6.16j}}\\
366 Note here that the multicite delimiter is a comma as in running text, a
367 semi-colon would be strange:
368 \apaex{\textcites{6.16f}{6.16g}{6.16h}{6.16i}{6.16j}}\\
369 \apaex{\cite{6.16f,6.16g,6.16h,6.16i,6.16j}}\\
370 \apaex{\cite{6.16k,6.16l}}\\
371 \apaex{\fullcite{FC1}}\\
372 \apaex{\fullcitebib{FC1}}
373
374 \noindent Testing «with»---should not be present in cites (APA 6.27)\\
375 \apaex{\cite{with1}}\\
376 \apaex{\textcite{with1}}
377
378 \noindent Testing author name citing\\
379 \apaex{\citeauthor{ca1}}\\
380 \apaex{\citeauthor{ca1}}
381
382 \noindent Testing nodate\\
383 \apaex{\textcite{nodate1}}\\
384 \apaex{\textcite{nodate2}}
385
386 \noindent Testing full name expansion (APA 6.27). See citation refs for how
387 these appear in references\\
388 \apaex{\textcite{6.27a}}\\
389 \apaex{\textcite{6.27b}}
390
391 \noindent Testing suffices\\
392 \apaex{\textcite{stest1}}\\
393 \apaex{\textcite{stest2}}
394
395 \noindent Testing prefices\\
396 \apaex{\textcite{pretest}}\\
397 \apaex{\textcite{nopretest}}
398
399 % presufftest2 and nopresufftest are the same name and so even though
400 % useprefix=false nopresufftest, hashes are the same so there is an extradate
401 \noindent Testing prefices plus suffices\\
402 \apaex{\textcite{presufftest}}\\
403 \apaex{\textcite{presufftest2}}\\
404 \apaex{\textcite{nopresufftest}}
405
406 \noindent Testing «and others»\\
407 \apaex{\textcite{ao1}}\\
408 \apaex{\textcite{ao2}}
409
410 \noindent Testing seasonal periodical citations\\
411 \apaex{\textcite{season1}}
412
413 \noindent Testing first list name initials only as per:\\
414 \url{http://blog.apastyle.org/apastyle/2014/01/when-to-use-author-initials-for-text-citations.html}\\
415 First citation:\\
416 \apaex{\parencite{first,second,third,fourth,deutsch1963}}\\
417 Second citation:\\
418 \apaex{\parencite{first,second,third,fourth,deutsch1963}}
419
420 % Testing name elision in cites
421 % That is, \parencite{kingetal2005a,weissetal2007a,weissetal2009a}
422 % Should give:
423 % (King, Weiss, & Farmer, 2005; Weiss, King, & Hopkins, 2007; Weiss et al., 2009)
424 % and not
425 % (King, Weiss, & Farmer, 2005; Weiss, King, & Hopkins, 2007, 2009)
426 % which happens if elision is based on namehash because the mincitenames
427 % truncation of the 2007 and 2009 names is the same
428 \noindent{Testing name elision in cites}\\
429 \apaex{\parencite{kingetal2005a,weissetal2007a,weissetal2009a}}
430
431 \noindent Testing circa/BCE/uncertain era format\\
432 \apaex{\nptextcite{plato}}
433
434 \noindent Testing citation formats for complete dates\\
435 \apaex{\textcite{Ludwig2014}}
436
437 \noindent Testing month ranges with same months, different days\\
438 \apaex{\textcite{daterange1}}
439
440 \noindent Testing month ranges with different months\\
441 \apaex{\textcite{daterange2}}
442
443 \end{refsection}
444 \begin{refsection}[../bibtex/bib/biblatex-apa6-test-references]
445 \nocite{*}
446 \end{refsection}
447 \newpage
448 % Just (APA 7.x) real references and related entry examples here
449 \printbibliography[section=2]
450 \newpage
451 % Include a references section for citation examples just so hyperref
452 % targets can be checked
453 \printbibliography[section=1,title=Misc citation references]
454 \end{document}
455
456 % Local Variables:
457 % TeX-engine: luatex
458 % End: