Advertisement
Guest User

Modified apa.bbx

a guest
Aug 4th, 2021
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Latex 64.44 KB | None | 0 0
  1. %% Copyright 2020 Philip Kime
  2. %%
  3. %% This work may be distributed and/or modified under the
  4. %% conditions of the LaTeX Project Public License, either version 1.3
  5. %% of this license or (at your option) any later version.
  6. %% The latest version of this license is in
  7. %%   http://www.latex-project.org/lppl.txt
  8. %% and version 1.3 or later is part of all distributions of LaTeX
  9. %% version 2005/12/01 or later.
  10. %%
  11. %% This work has the LPPL maintenance status `maintained'.
  12. %%
  13. %% The Current Maintainer of this work is Philip Kime.
  14.  
  15. \ProvidesFile{apa.bbx}[2020/08/28\space v9.14\space APA biblatex references style]
  16. \RequireBiber[3]
  17. \RequireBibliographyStyle{standard}
  18. \urlstyle{same} % APA examples all have URLs in same font as text
  19.  
  20. % Declare the language mapping suffix
  21. \DeclareLanguageMappingSuffix{-apa}
  22.  
  23. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  24. % Optional parens/brackets
  25. % Thanks to egreg from https://tex.stackexchange.com/questions/53068/how-to-check-if-a-macro-value-is-empty-or-will-not-create-text-with-plain-tex-co
  26. % for this test for expanded emptiness so that we can easily opt to not print parens around nothing
  27. % Without this, it is very messy - you have to test all potential fields for defness first and this
  28. % is messy because the fields in the additional info vary betwee entrytypes
  29. \def\foreverunspace{%
  30.   \ifnum\lastnodetype=11
  31.     \unskip\foreverunspace
  32.   \else
  33.     \ifnum\lastnodetype=12
  34.       \unkern\foreverunspace
  35.     \else
  36.       \ifnum\lastnodetype=13
  37.         \unpenalty\foreverunspace
  38.       \fi
  39.     \fi
  40.   \fi
  41. }
  42.  
  43. % we need a way to save the state of the punctuation buffer
  44. % cf. \blx@initunit in biblatex.sty for what we need to copy
  45.  
  46. % this uses the internal implementation of etoolbox toggles
  47. % fingers crossed no one messes with it
  48. \newrobustcmd*{\apablx@savetoggle}[1]{%
  49.   \csletcs{apablx@savedtoggle@#1}{etb@tgl@#1}}
  50.  
  51. \newrobustcmd*{\apablx@restoretoggle}[1]{%
  52.   \csletcs{etb@tgl@#1}{apablx@savedtoggle@#1}}
  53.  
  54. \newrobustcmd*{\apablx@savepunctstate}{%
  55.   \apablx@savetoggle{blx@block}%
  56.   \apablx@savetoggle{blx@unit}%
  57.   \apablx@savetoggle{blx@insert}%
  58.   \apablx@savetoggle{blx@lastins}%
  59.   \apablx@savetoggle{blx@keepunit}%
  60.   \let\apablx@savd@unitpunct\blx@unitpunct
  61.   \let\apablx@savd@puncthook\abx@puncthook}
  62.  
  63. \newrobustcmd*{\apablx@restorepunctstate}{%
  64.   \global\apablx@restoretoggle{blx@block}%
  65.   \global\apablx@restoretoggle{blx@unit}%
  66.   \global\apablx@restoretoggle{blx@insert}%
  67.   \global\apablx@restoretoggle{blx@lastins}%
  68.   \global\apablx@restoretoggle{blx@keepunit}%
  69.   \global\let\blx@unitpunct\apablx@savd@unitpunct
  70.   \global\let\abx@puncthook\apablx@savd@puncthook}
  71.  
  72. % printtext that checks if it would print anything
  73. \newrobustcmd{\printtexte}[2][]{%
  74.   \apablx@savepunctstate
  75.   \setbox0=\hbox{#2\foreverunspace}%
  76.   \apablx@restorepunctstate
  77.   \ifdim\wd0=0pt
  78.   \else
  79.     \ifblank{#1}
  80.      {\printtext{#2}}
  81.      {\printtext[#1]{#2}}%
  82.   \fi}
  83.  
  84. %
  85. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  86.  
  87. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  88. % (APA 9.8) - Allow variable max authors/editors limit
  89. %             Default to APA 19
  90.  
  91. \newcommand{\maxprtauth}{20}
  92. \DeclareBibliographyOption{apamaxprtauth}{%
  93.   \ifstrempty{#1}
  94.    {}
  95.    {\renewcommand{\maxprtauth}{#1}}}
  96.  
  97. %
  98. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  99.  
  100. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  101. % Multiple related entries, even though there are no
  102. % examples in APA 7th, should probably be this
  103.  
  104. \renewcommand*{\relateddelim}{\addcomma\addspace}
  105.  
  106. %
  107. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  108.  
  109. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  110. % Force roman numerals into arabic using
  111. % etoolbox macros
  112.  
  113. \newcommand{\apanum}[1]{\ifrmnum{#1}{\rmntonum{#1}}{#1}}
  114.  
  115. %
  116. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  117.  
  118. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  119. % (APA 9.43) Hanging indent of 0.5in
  120.  
  121. \setlength{\bibhang}{0.5in}
  122.  
  123. %
  124. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  125.  
  126. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  127. % Date formats. Suppress end range of less specific fields
  128.  
  129. \newcommand*{\mkdaterangeapalong}[1]{%
  130.   \begingroup
  131.     \blx@metadateinfo{#1}%
  132.     \iffieldundef{#1year}{}
  133.      {\datecircaprint
  134.        \ifboolexpr{ test {\ifstrequal{#1}{url}}
  135.                     or test {\ifentrytype{legal}}
  136.                     or ( test {\ifentrytype{legadminmaterial}} and
  137.                          test {\ifkeyword{proposed}} ) }
  138.          {\printtext{%
  139.              \mkbibdateapalongmdy{#1year}{#1month}{#1day}%
  140.              \iffieldundef{#1endyear}%
  141.                {}%
  142.                {\iffieldequalstr{#1endyear}{}% open-ended range?
  143.                  {\bibdatedash\bibstring{present}}
  144.                  {\bibdatedash%
  145.                   \iffieldsequal{#1year}{#1endyear}%
  146.                     {\iffieldsequal{#1month}{#1endmonth}%
  147.                       {\iffieldsequal{#1day}{#1endday}%
  148.                         {}%
  149.                         {\mkbibdateapalongmdy{}{}{#1endday}}}%
  150.                       {\mkbibdateapalongmdy{}{#1endmonth}{#1endday}}}%
  151.                     {\mkbibdateapalongmdy{#1endyear}{#1endmonth}{#1endday}}}}%
  152.              \dateuncertainprint}}
  153.          {\printtext{%
  154.              \mkbibdateapalong{#1year}{#1month}{#1day}%
  155.              \dateeraprint{#1year}%
  156.              \iffieldundef{#1endyear}%
  157.                {}%
  158.                {\iffieldequalstr{#1endyear}{}% open-ended range?
  159.                  {\bibdatedash\bibstring{present}}
  160.                  {\bibdatedash%
  161.                   \iffieldsequal{#1year}{#1endyear}%
  162.                     {\iffieldsequal{#1month}{#1endmonth}%
  163.                       {\iffieldsequal{#1day}{#1endday}%
  164.                         {}%
  165.                         {\mkbibdateapalong{}{}{#1endday}}}%
  166.                       {\mkbibdateapalong{}{#1endmonth}{#1endday}}}%
  167.                     {\mkbibdateapalong{#1endyear}{#1endmonth}{#1endday}%
  168.                    \dateeraprint{#1endyear}}}%
  169.                \enddateuncertainprint}}}}%
  170.   \endgroup}
  171.  
  172. % Only for DATE as only \printdateextra is used
  173. \newcommand*{\mkdaterangeapalongextra}[1]{%
  174.   \begingroup
  175.     \blx@metadateinfo{#1}%
  176.     \iffieldundef{#1year}{}
  177.       {\printtext{%
  178.         \datecircaprint
  179.         \mkbibdateapalongextra{#1year}{#1month}{#1day}%
  180.         \dateeraprint{#1year}%
  181.         \dateuncertainprint
  182.         \iffieldundef{#1endyear}%
  183.           {}%
  184.           {\iffieldequalstr{#1endyear}{}% open-ended range?
  185.             {\bibdatedash\bibstring{present}}
  186.             {\bibdatedash%
  187.              \iffieldsequal{#1year}{#1endyear}%
  188.                {\iffieldsequal{#1month}{#1endmonth}%
  189.                   {\iffieldsequal{#1day}{#1endday}%
  190.                     {}%
  191.                     {\mkbibdateapalongextra{}{}{#1endday}}}
  192.                  {\mkbibdateapalongextra{}{#1endmonth}{#1endday}}}
  193.               {\mkbibdateapalongextra{#1endyear}{#1endmonth}{#1endday}%
  194.                 \dateeraprint{#1endyear}}}%
  195.            \enddateuncertainprint}}}%
  196.   \endgroup}
  197.  
  198. \AtEndPreamble{%
  199.   \renewcommand*{\datecircaprint}{%
  200.     \ifdatecirca{\biblcstring{circa}\printdelim{datecircadelim}}{}}}
  201.  
  202. %
  203. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  204.  
  205. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  206. % (APA 8.12) sort citations
  207. % (APA 8.17) More than two authors is truncated to one but overriden for list ambiguity to
  208. %            point of no ambiguity
  209. % (APA 8.20) Use initials to disambiguate shared surnames
  210. % (APA 8.19) Use year postfix to disambiguate multiple items in same year
  211. % (APA 9.44, 9.46, 9.47) Sorting is nyt but we need to account for PUBSTATE which comes
  212. %                        after all normal cites for the same author
  213. % (APA 9.42) Secular Before Common Era dates, approximate dates
  214. % (APA Figure 9.2) Sorting ignores punctuation in names
  215. % (APA 9.47) Ignore "The", "An" and "A" when sorting titles
  216.  
  217. \DeclareNosort{
  218.  \nosort{setnames}{\regexp{\p{General_Category=Punctuation}}}
  219.  \nosort{settitles}{\regexp{\A(?:The|An|A)\s+}}
  220. }
  221.  
  222. \DeclareSortingTemplate{apa}{
  223.  \sort{
  224.    \field{presort}
  225.  }
  226.  \sort[final]{
  227.    \field{sortkey}
  228.  }
  229.  \sort{
  230.    \field{sortname}
  231.    \field{author}
  232.    \field{groupauthor}
  233.    \field{editor}
  234.    \field{sorttitle}
  235.    \field{title}
  236.  }
  237.  \sort{
  238.    \field{pubstate}
  239.  }
  240.  \sort{
  241.    \field{sortyear}
  242.    \field{year}
  243.    \literal{-2000000000}% APA has "nodates" coming first
  244.   }
  245.   \sort{
  246.    \field{sorttitle}
  247.    \field{title}
  248.  }
  249.  \sort{
  250.    \field{volume}
  251.    \literal{0}
  252.  }
  253. }
  254.  
  255. % Include groupauthor
  256. \DeclareLabelname{%
  257.   \field{shortauthor}
  258.  \field{author}
  259.  \field{groupauthor}
  260.  \field{shorteditor}
  261.  \field{editor}
  262. }
  263.  
  264. % Don't fall back on other year fields if there is no year, use
  265. % "nodate" string
  266. \DeclareLabeldate{%
  267.   \field{pubstate}
  268.  \field{date}
  269.  \field{eventdate}
  270.  \field{year}%legacy - no ISO8601 support
  271.   \literal{nodate}
  272. }
  273.  
  274. % CONSTITUTION entrytypes have no dates at all so no fall back to nodate literal either
  275. \DeclareLabeldate[constitution]{\field{date}}
  276.  
  277. \ExecuteBibliographyOptions{%
  278.                             abbreviate=true,%
  279.                             autocite=inline,%
  280.                             backref=false,%
  281.                             citetracker=true,%
  282.                             date=apalong,%
  283.                             dateabbrev=false,%
  284.                             datecirca=true,%
  285.                             dateera=secular,%
  286.                             dateuncertain=true,%
  287.                             eventdate=comp,%
  288.                             labeldate=apalong,%
  289.                             labeldateparts=true,%
  290.                             maxbibnames=20,%
  291.                             maxcitenames=2,%
  292.                             minbibnames=19,%
  293.                             mincitenames=1,%
  294.                             mincrossrefs=999,%
  295.                             maxitems=999,%
  296.                             origdate=apalong,%
  297.                             pagetracker=true,%
  298.                             sortcites=true,%
  299.                             sorting=apa,%
  300.                             uniquelist=minyear,%
  301.                             uniquename=init,%
  302.                             uniqueprimaryauthor=true,%
  303.                             urldate=apalong,%
  304.                             useprefix=true,%
  305.                             usetranslator=true,%
  306.                             usenarrator=true}
  307.  
  308. %
  309. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  310.  
  311. % Enforce ignoring of PUBSTATE if there is a YEAR or DATE field
  312. % (APA 10.2:32) Remove PUBLISHER if it is the same as GROUPAUTHOR
  313. % Force @COLLECTION, @REFERENCE->@BOOK and @INCOLLECTION,@INREFERENCE->@INBOOK
  314.  
  315. \DeclareStyleSourcemap{
  316.  \maps[datatype=bibtex]{
  317.    \map{
  318.      \step[typesource=reference, typetarget=book]
  319.    }
  320.    \map{
  321.      \step[typesource=inreference, typetarget=inbook]
  322.    }
  323.    \map{
  324.      \step[typesource=collection, typetarget=book]
  325.    }
  326.    \map{
  327.      \step[typesource=incollection, typetarget=inbook]
  328.    }
  329.    \map{
  330.      \step[typesource=hardware, typetarget=software]
  331.    }
  332.    \map{
  333.      \pertype{proceedings}
  334.      \step[fieldsource=booktitle, fieldtarget=title]
  335.      \step[typesource=proceedings, typetarget=book]
  336.    }
  337.    \map{
  338.      \pertype{inproceedings}
  339.      \step[notfield=editor, final]
  340.      \step[fieldsource=booktitle, fieldtarget=journaltitle]
  341.      \step[typesource=inproceedings, typetarget=article]
  342.    }
  343.    \map{
  344.      \step[typesource=inproceedings, typetarget=inbook]
  345.    }
  346.    \map{
  347.      \step[fieldsource=year, final]
  348.      \step[fieldset=pubstate, null]
  349.    }
  350.    \map{
  351.      \step[fieldsource=date, final]
  352.      \step[fieldset=pubstate, null]
  353.    }
  354.    \map{
  355.      \step[fieldsource=groupauthor, match=\regexp{([^{}]+)}, final]
  356.      \step[fieldsource=publisher, match=\regexp{$1}, final]%$
  357.       \step[fieldset=publisher, null]
  358.    }
  359.  }
  360. }
  361.  
  362. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  363. % Flag to say whether the "in" has
  364. % been placed already in IN*
  365. % Reset every bibitem.
  366.  
  367. \newbool{bbx:in}
  368. \AtEveryBibitem{\global\boolfalse{bbx:in}}
  369.  
  370. %
  371. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  372.  
  373. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  374. % Set up some standard APA formats
  375.  
  376. % General format of titles. Ugly Chicago-style lowercasing of English titles
  377. \DeclareFieldFormat{apacase}{\MakeSentenceCase*{#1}}
  378.  
  379. % HOWPUBLISHED
  380. \DeclareFieldFormat[unpublished]{howpublished}{\mkbibbrackets{%
  381.   \ifbibstring{#1}{\bibcpstring{#1}}{#1}}}
  382.  
  383. % TITLE
  384. \DeclareFieldFormat*{title}{\mkbibemph{#1}\isdot}
  385. \DeclareFieldFormat[article,inbook,incollection,periodical,misc,legislation,legadminmaterial,jurisdiction,inproceedings,legal]{title}{#1\isdot}
  386. \DeclareFieldFormat[audio,video]{title}{\iffieldundef{maintitle}{\mkbibemph{#1}\isdot}{#1}}
  387. \DeclareFieldFormat[presentation]{title}{\iffieldundef{maintitle}{\mkbibemph{#1}}{#1}\isdot}
  388.  
  389. % SUBTITLE
  390. \DeclareFieldFormat[legmaterial]{subtitle}{\mkbibemph{#1}}
  391.  
  392. % TITLEADDON
  393. \DeclareFieldFormat{titleaddon}{\mkbibbrackets{\MakeSentenceCase*{#1}}}
  394. \DeclareFieldFormat[legislation]{titleaddon}{#1}
  395.  
  396. % MAINTITLEADDON
  397. \DeclareFieldFormat{maintitleaddon}{\mkbibbrackets{\MakeSentenceCase*{#1}}}
  398.  
  399. % NOTE
  400. \DeclareFieldFormat[legmaterial,legadminmaterial]{note}{\mkbibparens{#1}}
  401.  
  402. % BOOKTITLEADDON
  403. \DeclareFieldFormat{booktitleaddon}{\mkbibbrackets{\MakeSentenceCase*{#1}}}
  404.  
  405. % ISSUETITLE
  406. \DeclareFieldFormat{issuetitle}{#1\isdot}
  407. \DeclareFieldFormat[periodical]{issuetitle}{\mkbibbrackets{#1}}
  408.  
  409. % ORIGTITLE
  410. \DeclareFieldFormat{origtitle}{\mkbibemph{\MakeSentenceCase*{#1}}\isdot}
  411. \DeclareFieldFormat[article,inbook,incollection,inproceedings,proceedings,presentation]{origtitle}{\MakeSentenceCase*{#1}\isdot}
  412.  
  413. % VOLUME
  414. \DeclareFieldFormat{volume}{\iffieldundef{maintitle}
  415.                              {\bibcpstring{volume}~\apanum{#1}}
  416.                              {\mkbibemph{\bibcpstring{volume}~\apanum{#1}}}}
  417. \DeclareFieldFormat[article]{volume}{\mkbibemph{\apanum{#1}}}
  418. \DeclareFieldFormat[inproceedings,periodical]{volume}{\mkbibemph{\apanum{#1}}}
  419.  
  420. % VOLUMES
  421. \DeclareFieldFormat{volumes}{\bibcpstring{volumes}~#1}
  422.  
  423. % CHAPTER
  424.  
  425. \DeclareFieldFormat{chapter}{\bibcpstring{chapter}~\apanum{#1}}
  426.  
  427. % NUMBER
  428. \DeclareFieldFormat{number}{\iffieldundef{volume}
  429.                             {\ifinteger{\thefield{number}}
  430.                               {\addspace\mkbibemph{\bibcpstring{number}~\apanum{#1}}\adddot}
  431.                               {\apanum{#1}}}
  432.                             {\mkbibemph{\apanum{#1}}}}
  433. \DeclareFieldFormat[report]{number}{\apanum{#1}}
  434. \DeclareFieldFormat[article,periodical,inproceedings]{number}{\mkbibparens{\apanum{#1}}}
  435. \DeclareFieldFormat[reprint]{number}{\mkbibbrackets{\apanum{#1}}}
  436. \DeclareFieldFormat{legmaterialnum}{%
  437.   \ifthenelse{%
  438.     \iffieldequalstr{type}{report}\OR%
  439.     \iffieldequalstr{type}{execorder}}{\bibcpstring{number}~\apanum{#1}}{\apanum{#1}}}
  440.  
  441.  
  442. % PAGES
  443. \DeclareFieldFormat{pageswithprefix}{\mkpageprefix[bookpagination]{#1}}
  444. \DeclareFieldFormat[inbook,incollection]{pages}{\mkpageprefix[bookpagination]{#1}}
  445. \DeclareFieldFormat[periodical]{pages}{#1}
  446.  
  447. % PART
  448. \DeclareFieldFormat*{part}{#1}
  449.  
  450. % ORGANIZATION
  451. \DeclareListFormat[misc]{organization}{\mkbibemph{#1}}
  452.  
  453. % LOCATION
  454. \DeclareListFormat[periodical]{location}{\mkbibemph{#1}}
  455. \DeclareListFormat{publisher}{%
  456.   \usebibmacro{publisher:delim}{#1}%
  457.   #1\isdot}
  458. \DeclareListFormat{location}{%
  459.   \usebibmacro{location:delim}{#1}%
  460.   #1\isdot}
  461.  
  462. % NAMEADDON
  463. \DeclareFieldFormat[misc]{nameaddon}{\mkbibparens{#1}}
  464.  
  465. % VERSION
  466. \DeclareFieldFormat[dataset,software]{version}{\bibcpstring{version}~#1}
  467. \DeclareFieldFormat[online]{version}{\mkbibparens{#1}}
  468.  
  469. % URL
  470. \DeclareFieldFormat{url}{\url{#1}}
  471. \DeclareFieldFormat{urldate}{#1}
  472.  
  473. %
  474. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  475.  
  476. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  477. % (APA 9.47) Works by the same author have the full author
  478. %            name, not an eliding dash. Author is always
  479. %            last name first.
  480. % (APA 10.1:4) Ellipsis from 20th position and then nothing until last
  481. % (APA 9.x) Unknown names and dates
  482. % (APA 9.8) Two group authors drop the comma in between
  483.  
  484. % \printnames does different things depending on whether the format you are
  485. % calling is the default for the name field or is a custom format:
  486. %
  487. %   * Default format (e.g. "labelname" format for printing labelname): no
  488. %     start/stop max/minnames truncation is done first - the format is
  489. %     supposed to do it.
  490. %   * Custom format (e.g. "labelname" format for printing author):
  491. %     max/minnames truncation is done before calling the format so we have
  492. %     to do \printnames[format][-\value{listtotal}]{field} to ensure we get
  493. %     all of the names in the list to work on
  494.  
  495. % It's not completely obvious but it's implied that names identical apart from a suffix
  496. % are to be treated as different name lists for extradate calculation so we add suffix
  497. % to the default definition
  498. \DeclareUniquenameTemplate{
  499.  \namepart[use=true, base=true]{prefix}
  500.  \namepart[base=true]{family}
  501.  \namepart{given}
  502.  \namepart{suffix}
  503. }
  504.  
  505. \DeclareNameAlias{default}{apaauthor}
  506.  
  507. \DeclareNameFormat{apaauthor}{%
  508.   \ifthenelse{\value{listcount}=\maxprtauth\AND\value{listcount}<\value{listtotal}}
  509.    {\addcomma\space\ldots\space}
  510.    {\ifthenelse{\value{listcount}>\maxprtauth\AND\value{listcount}<\value{listtotal}}
  511.      {}
  512.      {\usebibmacro{name:apa:family-given}%
  513.          {\namepartfamily}%
  514.          {\namepartgiven}%
  515.          {\namepartgiveni}%
  516.          {\namepartprefix}%
  517.          {\namepartsuffix}%
  518.        \let\bibstring\bibcplstring
  519.        \usebibmacro{role}{\addspace}{\mkbibparens}%
  520.        \hasitemannotation[\currentname][username]
  521.          {\addspace\mkbibbrackets{\getitemannotation[\currentname][username]}}
  522.         {}}}%
  523.   \ifthenelse{\value{listcount}=\value{listtotal}}%
  524.     {\ifmorenames
  525.       {\printdelim{andothersdelim}%
  526.         \biblcstring{andothers}}
  527.       {}%
  528.      \let\bibstring\bibcplstring
  529.      \usebibmacro{roles}{\addspace}{\mkbibparens}}
  530.    {}}
  531.  
  532. \DeclareNameFormat{apanames}{%
  533.   \ifthenelse{\value{listcount}=\maxprtauth\AND\value{listcount}<\value{listtotal}}
  534.    {\addcomma\space\ldots\space}
  535.    {\ifthenelse{\value{listcount}>\maxprtauth\AND\value{listcount}<\value{listtotal}}
  536.      {}
  537.      {\usebibmacro{name:apa:given-family}%
  538.          {\namepartfamily}%
  539.          {\namepartgiven}%
  540.          {\namepartgiveni}%
  541.          {\namepartprefix}%
  542.          {\namepartsuffix}%
  543.        \let\bibstring\bibcpsstring
  544.        \usebibmacro{role}{\addcomma\space}{\@firstofone}}}%
  545.   \ifthenelse{\value{listcount}=\value{listtotal}}%
  546.     {\ifmorenames
  547.       {\printdelim{andothersdelim}%
  548.         \biblcstring{andothers}}
  549.       {}%
  550.      \let\bibstring\bibcplstring
  551.      \usebibmacro{roles}{\addspace}{\@firstofone}}
  552.    {}}
  553.  
  554. \renewbibmacro*{author/editor}{%
  555.   \ifthenelse{\ifnameundef{author}\AND\ifnameundef{groupauthor}}
  556.    {\ifnameundef{editor}
  557.      {\usebibmacro{title}%
  558.         % need to clear all title fields so we don't get them again later
  559.         \clearfield{title}%
  560.        \clearfield{subtitle}%
  561.        \clearfield{titleaddon}}
  562.      {\usebibmacro{editorinauthpos}}}
  563.    {\usebibmacro{author}}%
  564.   \newunit\newblock%
  565.   \usebibmacro{labelyear+extradate}}
  566.  
  567. \newbibmacro*{author/editor:related}{%
  568.   \ifthenelse{\ifnameundef{author}\AND\ifnameundef{groupauthor}}
  569.    {\ifnameundef{editor}
  570.      {\usebibmacro{title}%
  571.         % need to clear all title fields so we don't get them again later
  572.         \clearfield{title}%
  573.        \clearfield{subtitle}%
  574.        \clearfield{titleaddon}}
  575.      {\usebibmacro{editorinauthpos:related}}}
  576.    {\usebibmacro{author:related}}}
  577.  
  578. \newbibmacro*{editorinauthpos}{%
  579.   \printnames[apaauthor][-\value{listtotal}]{editor}%
  580.   \setunit{\addspace}%
  581.   \ifnameundef{editor}
  582.    {}
  583.    {\printtext[parens]{\usebibmacro{apaeditorstrg}{editor}}%
  584.      % need to clear editor so we don't get an "In" clause later
  585.      \clearname{editor}}}
  586.  
  587. \newbibmacro*{editorinauthpos:related}{%
  588.   \printnames[apanames][-\value{listtotal}]{editor}%
  589.   \setunit{\addspace}%
  590.   \ifnameundef{editor}
  591.    {}
  592.    {\printtext[parens]{\usebibmacro{apaeditorstrg}{editor}}%
  593.      % need to clear editor so we don't get an "In" clause later
  594.      \clearname{editor}}}
  595.  
  596. \renewbibmacro*{author}{%
  597.   \ifnameundef{author}
  598.    {\printnames[apaauthor][-\value{listtotal}]{groupauthor}}
  599.    {\printnames[apaauthor][-\value{listtotal}]{author}}%
  600.   \setunit*{\addspace}%
  601.   \printfield{nameaddon}%
  602.   \ifnameundef{with}
  603.    {}
  604.    {\setunit{\addspace}%
  605.      \printtext[parens]{%
  606.        \bibstring{with}%
  607.        \setunit{\addspace}%
  608.        \printnames[apaauthor][-\value{listtotal}]{with}}%
  609.      \setunit{\addspace}}}
  610.  
  611. \newbibmacro*{author:related}{%
  612.   \ifnameundef{author}
  613.    {\printnames[apanames][-\value{listtotal}]{groupauthor}}
  614.    {\printnames[apanames][-\value{listtotal}]{author}}%
  615.   \setunit*{\addspace}}
  616.  
  617. %
  618. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  619.  
  620. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  621. % (APA 9.8) Author delimiters are ampersands before final author
  622. %           Long author lists
  623. %           Serial comma for lists of three or more
  624. %           Ampersand only (no comma) between two group authors
  625.  
  626. \DeclareDelimFormat[bib,biblist]{finalnamedelim}{%
  627.   \ifthenelse{\value{listcount}>\maxprtauth}
  628.    {}
  629.    {\ifthenelse{\value{liststop}>2}
  630.       {\finalandcomma\addspace\&\space}
  631.       {\addspace\&\space}}}
  632.  
  633. \DeclareDelimFormat[bib,biblist]{finalnamedelim:apa:family-given}{%
  634.   \ifthenelse{\value{listcount}>\maxprtauth}
  635.    {}
  636.    {\ifthenelse{\ifcurrentname{groupauthor}\AND%
  637.                  \value{liststop}=2}
  638.     {\addspace\&\space}
  639.     {\finalandcomma\addspace\&\space}}}
  640.  
  641. %
  642. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  643.  
  644. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  645. % (APA 9.47) Use "nodate" bibstring for references with no year
  646. %            Months and days go into parenthesis with year, if set
  647. % (APA 8.13, 10.2) circa or uncertain dates in brackets
  648.  
  649. % Make sure endmonth gets an expansion too
  650. \DeclareFieldFormat{endmonth}{\mkbibmonth{#1}}
  651.  
  652. \newbibmacro*{labelyear+extradate}{%
  653.   \iffieldundef{labelyear}
  654.    {\iffieldundef{origyear}
  655.      {}
  656.      {\printtext[apadate]{\printorigdate}}}%
  657.     {\printtext[apadate]{\printlabeldateextra}}}
  658.  
  659. \DeclareFieldFormat{apadate}{%
  660.   \ifboolexpr{ test {\ifdatecirca} or test {\ifdateuncertain} }
  661.    {\mkbibbrackets{#1}}
  662.    {\mkbibparens{#1}}}
  663.  
  664. %
  665. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  666.  
  667. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  668. % (APA 10.5) Conference event information
  669.  
  670. \newbibmacro*{eventinfo}{%
  671.   \printfield{eventtitle}%
  672.   \setunit{\addcomma\addspace}%
  673.   \printfield{venue}}
  674.  
  675. %
  676. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  677.  
  678. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  679. % (APA 9.25) No prefix for pages
  680.  
  681. \DeclareFieldFormat{pages}{#1}
  682.  
  683. %
  684. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  685.  
  686. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  687. % (APA 9.52) References in a meta-analysis
  688. %            Dates ignore month/day in nonacademic
  689. %            articles
  690.  
  691. \renewbibmacro*{begentry}{%
  692.   \ifkeyword{meta}{\textsuperscript{*}}{}}
  693.  
  694. %
  695. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  696.  
  697. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  698. % Title and additional post title information
  699.  
  700. \renewbibmacro*{title}{%
  701.   \ifthenelse{\iffieldundef{title}\AND\iffieldundef{subtitle}}
  702.    {\printfield{titleaddon}}
  703.    {\iffieldundef{origtitle}
  704.       {\printtext[title]{%
  705.         \printfield{title}%
  706.         \setunit{\subtitlepunct}%
  707.         \printfield{subtitle}}}
  708.      {\printfield{origtitle}%
  709.        \setunit{\addspace}%
  710.        \printtext[brackets]{%
  711.         \printfield{title}%
  712.         \setunit{\subtitlepunct}%
  713.         \printfield{subtitle}}}%
  714.      \setunit{\addspace}%
  715.      \ifentrytype{inbook}{}{\usebibmacro{addinfo1}}% additional info in parens
  716.      \setunit{\addspace}%
  717.      \printfield{titleaddon}%
  718.      \setunit{\addspace}%
  719.      \usebibmacro{addinfo2}}}%
  720.  
  721. \newbibmacro*{addinfo1}{%
  722.   \printtexte[parens]{%
  723.     \usebibmacro{editor+trans+narr}%
  724.     \setunit*{\addsemicolon\addspace}%
  725.     \printfield{edition}%
  726.     \setunit*{\addcomma\addspace}%
  727.     \ifthenelse{\ifentrytype{report}\OR%
  728.                 \ifentrytype{thesis}\OR%
  729.                 \ifentrytype{unpublished}\OR%
  730.                 \ifentrytype{dataset}\OR%
  731.                 \ifentrytype{software}\OR%
  732.                 \ifentrytype{audio}\OR%
  733.                 \ifentrytype{patent}\OR%
  734.                 \ifentrytype{image}}{\usebibmacro{addinfo3}}{}%
  735.     \setunit*{\addcomma\addspace}%
  736.     \ifentrytype{inbook}{\printfield{pages}}{}%
  737.     \setunit*{\addcomma\addspace}%
  738.     \ifentrytype{book}{\printfield{volumes}}{}%
  739.     \setunit*{\addcomma\addspace}%
  740.     \ifentrytype{book}{\printfield{volume}}{}}}
  741.  
  742. % Additional post title information in brackets unless it's the meta subtype "nonacademic"
  743. % which is used to conditionalise date formats in the .lbx files
  744. \newbibmacro*{addinfo2}{%
  745.   \printtexte[brackets]{%
  746.    \iffieldequalstr{entrysubtype}{nonacademic}
  747.     {}
  748.     {\iffieldbibstring{entrysubtype}
  749.        {\bibcplstring{\thefield{entrysubtype}}}
  750.        {\printfield{entrysubtype}}}%
  751.     \setunit*{\addsemicolon\addspace}%
  752.     \printfield{note}}}
  753.  
  754. % number/issue information
  755. \newbibmacro*{addinfo3}{%
  756.   \iffieldundef{type}
  757.    {\iffieldundef{issue}
  758.      {\iffieldnums{number}{\bibcpstring{number}~}{}\printfield{number}}
  759.      {\printfield{issue}\setunit{\addspace}%
  760.        \iffieldundef{number}
  761.         {}
  762.         {\iffieldnums{number}{\bibcpstring{number}~}{}\printfield{number}}}}
  763.    {\printfield{type}\setunit{\addspace}%
  764.      \iffieldundef{number}
  765.       {}
  766.       {\iffieldnums{number}{\bibcpstring{number}~}{}\printfield{number}}}%
  767.   \ifthenelse{\ifentrytype{dataset}\OR\ifentrytype{software}}
  768.    {\setunit*{\addsemicolon\addspace}%
  769.      \printfield{version}}
  770.    {}}
  771.  
  772. %
  773. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  774.  
  775. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  776. % (APA 10.1 Example 6) eprints (eLocator)
  777.  
  778. \DeclareFieldFormat[article]{eid}{\bibcpstring{jourarticle}~#1}
  779. \DeclareFieldFormat{eprint}{#1}
  780.  
  781. %
  782. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  783.  
  784. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  785. % (APA 10)   Commas between title and volume for articles
  786. % (APA 10.6) eLocator is part of journal info
  787.  
  788. \renewbibmacro*{journal+issuetitle}{%
  789.   \usebibmacro{journal}%
  790.   \setunit*{\addcomma\addspace}%
  791.   \printfield{volume}%
  792.   \printfield{number}%
  793.   \setunit{\addcomma\addspace}%
  794.   \printfield{eid}%
  795.   \newunit\newblock
  796.   \usebibmacro{issuename}%
  797.   \newunit}
  798.  
  799. \newbibmacro*{issuename}{%
  800.   \iffieldundef{issuetitle}
  801.    {}
  802.     {\printtext[issuetitle]{%
  803.        \printfield[noformat]{issuetitle}%
  804.        \setunit{\subtitlepunct}%
  805.        \printfield[noformat]{issuesubtitle}}}}
  806.  
  807. %
  808. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  809.  
  810. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  811. % "In" precedes editor/trans list, no colon
  812. % Use a flag to track as it could be inserted in more
  813. % than one potential location
  814.  
  815. \newbibmacro*{in}{%
  816.   \ifbool{bbx:in}%
  817.     {}%
  818.     {\global\booltrue{bbx:in}%
  819.      \bibcpstring{in}\setunit{\space}}}
  820.  
  821. %
  822. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  823.  
  824. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  825. % Names
  826.  
  827. \newcommand*{\apabbx@ifrole@item}{%
  828.   \xifinlist{item@\currentname @role@\the\value{listcount}}%
  829.             \abx@annotation@defined}
  830.  
  831. \newtoggle{apabbx:role:item:punct}
  832.  
  833. \newcommand*{\apabbx@rolelist@item}{}
  834. \forcsvlist{\listadd\apabbx@rolelist@item}{%
  835.   writer,director,execproducer,producer,host,chair,guestexpert}
  836.  
  837. \newcommand*{\apabbx@printrole@item@i}[1]{%
  838.   \ifitemannotation[\currentname][role]{#1}
  839.    {\iftoggle{apabbx:role:item:punct}
  840.       {\addspace\&\space}
  841.       {}%
  842.      \bibstring{#1}%
  843.      \toggletrue{apabbx:role:item:punct}}
  844.    {}%
  845. }
  846.  
  847. \newcommand*{\apabbx@printrole@item}{%
  848.   \forlistloop{\apabbx@printrole@item@i}{\apabbx@rolelist@item}}
  849.  
  850. % Individual name roles
  851. % takes two arguments
  852. % {<pre punct>}{<wrapper>}
  853. \newbibmacro*{role}[2]{%
  854.   \apabbx@ifrole@item
  855.     {#1%
  856.      #2{%
  857.        \togglefalse{apabbx:role:item:punct}%
  858.        \hasitemannotation[\currentname][role]%
  859.          {\getitemannotation[\currentname][role]}
  860.         {\apabbx@printrole@item}}}
  861.    {}%
  862. }
  863.  
  864. \newcommand*{\apabbx@ifrole@field}{%
  865.   \xifinlist{field@\currentname @role}%
  866.             \abx@annotation@defined}
  867.  
  868. \newtoggle{apabbx:role:field:punct}
  869.  
  870. \newcommand*{\apabbx@rolelist@field}{}
  871. \forcsvlist{\listadd\apabbx@rolelist@field}{%
  872.   writers,directors,execproducers,producers,hosts,chairs,guestexperts}
  873.  
  874. \newcommand*{\apabbx@printrole@field@i}[1]{%
  875.   \iffieldannotation[\currentname][role]{#1}
  876.    {\iftoggle{apabbx:role:field:punct}
  877.       {\addspace\&\space}
  878.       {}%
  879.      \bibstring{#1}%
  880.      \toggletrue{apabbx:role:field:punct}}
  881.    {}%
  882. }
  883.  
  884. \newcommand*{\apabbx@printrole@field}{%
  885.   \forlistloop{\apabbx@printrole@field@i}{\apabbx@rolelist@field}}
  886.  
  887. % roles for complete name lists
  888. % takes two arguments
  889. % {<pre punct>}{<wrapper>}
  890. \newbibmacro*{roles}[2]{%
  891.   \apabbx@ifrole@field
  892.     {#1%
  893.      #2{%
  894.        \togglefalse{apabbx:role:field:punct}%
  895.        \hasfieldannotation[\currentname][role]%
  896.          {\getfieldannotation[\currentname][role]}
  897.         {\apabbx@printrole@field}}}
  898.    {}%
  899. }
  900.  
  901. %
  902. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  903.  
  904. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  905. % Name format
  906.  
  907. % #1 = family name
  908. % #2 = given name
  909. % #3 = given name (initials)
  910. % #4 = name prefix
  911. % #5 = name suffix
  912.  
  913. \newbibmacro*{name:delim:apa:family-given}[1]{%
  914.   \ifnumgreater{\value{listcount}}{\value{liststart}}
  915.    {\ifboolexpr{
  916.       test {\ifnumless{\value{listcount}}{\value{liststop}}}
  917.       or
  918.       test \ifmorenames
  919.     }
  920.       {\printdelim{multinamedelim}}
  921.       {\printdelim{finalnamedelim:apa:family-given}}}
  922.    {}}
  923.  
  924. \newbibmacro*{name:apa:family-given}[5]{%
  925.   \ifuseprefix
  926.     {\usebibmacro{name:delim:apa:family-given}{#4#1}%
  927.      \usebibmacro{name:hook}{#4#1}%
  928.      \ifdefvoid{#4}{}{%
  929.        \mkbibnameprefix{#4}\isdot%
  930.        \ifprefchar{}{\bibnamedelimc}}%
  931.      \mkbibnamefamily{#1}\isdot%
  932.      \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{#3}\isdot%
  933.                       \ifthenelse{\value{uniquename}>1}
  934.                        {\bibnamedelimd\mkbibbrackets{#2}}
  935.                        {}}%
  936.      \ifdefvoid{#5}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#5}\isdot}}
  937.    {\usebibmacro{name:delim:apa:family-given}{#1}%
  938.      \usebibmacro{name:hook}{#1}%
  939.      \mkbibnamefamily{#1}\isdot
  940.      \ifboolexpe{%
  941.        test {\ifdefvoid{#2}}
  942.       and
  943.       test {\ifdefvoid{#4}}}
  944.       {}
  945.       {\revsdnamepunct}%
  946.      \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{#3}%
  947.                       \ifthenelse{\value{uniquename}>1}
  948.                        {\bibnamedelimd\mkbibbrackets{#2}}
  949.                        {}}%
  950.      \ifdefvoid{#4}{}{%
  951.        \bibnamedelimc\mkbibnameprefix{#4}%
  952.        \ifprefchar{}{\bibnamedelimc}}%
  953.      \ifdefvoid{#5}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#5}\isdot}}}
  954.  
  955. \newbibmacro*{name:apa:given-family}[5]{%
  956.   \usebibmacro{name:delim}{#2#4#1#5}%
  957.   \usebibmacro{name:hook}{#2#4#1#5}%
  958.   \ifdefvoid{#2}{}{\mkbibnamegiven{#3}\isdot%
  959.                    \ifthenelse{\value{uniquename}>1}
  960.                     {\bibnamedelimd\mkbibbrackets{#2}}
  961.                     {}%
  962.                    \bibnamedelimd}%
  963.   \ifdefvoid{#4}{}{%
  964.     \mkbibnameprefix{#4}\isdot
  965.    \ifprefchar{}{\bibnamedelimc}}%
  966.   \mkbibnamefamily{#1}\isdot%
  967.   \ifdefvoid{#5}{}{\bibnamedelimd\mkbibnamesuffix{#5}\isdot}}
  968.  
  969. %
  970. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  971.  
  972. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  973. % (APA 9.10) Role strings in parens after author list
  974. %            Collapse roles if same person
  975. % (APA 10.1 Example 10) Translator
  976. % (APA 10.2 Example 22) Narrator
  977.  
  978. \newbibmacro*{editor+trans+narr}{%
  979.   \ifthenelse{\ifnameundef{editor}\AND%
  980.               \ifnameundef{editora}\AND%
  981.               \ifnameundef{editorb}\AND%
  982.               \ifnameundef{editorc}\AND%
  983.               \ifnameundef{translator}\AND%
  984.               \ifnameundef{narrator}}%
  985.     {\printtext{}}% Print nothing, so the puncutation tracker is kept informed
  986.     {\ifnamesequal{editor}{translator}%
  987.        {\printnames[apanames][-\value{listtotal}]{editor}%
  988.         \setunit*{\addcomma\addspace}%
  989.         \usebibmacro{apaeditorstrg}{editor}%
  990.         \setunit*{\addspace\&\space}%
  991.         \bibcpstring{translator}}
  992.       {\ifnameundef{editor}%
  993.           {}%
  994.           {\printnames[apanames][-\value{listtotal}]{editor}%
  995.            \setunit{\addcomma\addspace}%
  996.            \usebibmacro{apaeditorstrg}{editor}%
  997.            \clearname{editor}%
  998.            \setunit{\addsemicolon\space}}%
  999.         \ifnameundef{translator}%
  1000.           {\setunit{}}%
  1001.           {\printnames[apanames][-\value{listtotal}]{translator}%
  1002.            \setunit{\addcomma\addspace}%
  1003.            \bibcpstring{translator}%
  1004.            \clearname{translator}%
  1005.            \setunit{\addsemicolon\space}}%
  1006.         \ifnameundef{narrator}%
  1007.           {\setunit{}}%
  1008.           {\printnames[apanames][-\value{listtotal}]{narrator}%
  1009.            \setunit{\addcomma\addspace}%
  1010.            \bibcpstring{narrator}%
  1011.            \clearname{narrator}}}}}
  1012.  
  1013. \newbibmacro*{editor+trans}{%
  1014.   \ifthenelse{\ifnameundef{editor}\AND%
  1015.               \ifnameundef{editora}\AND%
  1016.               \ifnameundef{editorb}\AND%
  1017.               \ifnameundef{editorc}\AND%
  1018.               \ifnameundef{translator}}%
  1019.     {\setunit{\adddot\addspace}}%
  1020.     {\ifnamesequal{editor}{translator}%
  1021.       {\usebibmacro{in}%
  1022.        \printnames[apanames][-\value{listtotal}]{editor}%
  1023.        \setunit{\addspace}%
  1024.        \printtext[parens]{%
  1025.          \usebibmacro{apaeditorstrg}{editor}%
  1026.          \setunit*{\addspace\&\space}%
  1027.          \bibcpstring{translator}}}
  1028.      {\ifnameundef{translator}%
  1029.         {}%
  1030.         {\setunit{\addspace}%
  1031.          \printtext[parens]{\printnames[apanames][-\value{listtotal}]{translator}%
  1032.            \setunit{\addcomma\addspace}%
  1033.            \bibcpstring{translator}}%
  1034.          \clearname{translator}%
  1035.          \setunit{\adddot\addspace}}%
  1036.        \usebibmacro{in}%
  1037.        \usebibmacro{editorx}}%
  1038.      \setunit{\addcomma\addspace}}}
  1039.  
  1040. %
  1041. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1042.  
  1043. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1044. % Special journal issues are periodicals
  1045.  
  1046. \renewbibmacro*{periodical}{%
  1047.   \iffieldundef{title}
  1048.    {}
  1049.     {\printtext[title]{%
  1050.        \printfield[apacase]{title}%
  1051.        \setunit{\subtitlepunct}%
  1052.        \printfield[apacase]{subtitle}}}}
  1053.  
  1054. \renewbibmacro*{title+issuetitle}{%
  1055.   \usebibmacro{periodical}%
  1056.   \setunit{\addspace}%
  1057.   \printfield{issuetitle}}%
  1058.  
  1059. \newbibmacro*{pnumber}{%
  1060.   \printfield{volume}%
  1061.   \printfield{number}}
  1062.  
  1063. %
  1064. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1065.  
  1066. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1067. % (APA 10.1 Example 10) Original year
  1068.  
  1069. % Only give ORIGYEAR in references if both:
  1070. %   YEAR is also given
  1071. %   YEAR and ORIGYEAR are different
  1072.  
  1073. \newbibmacro*{origyear}{%
  1074.   \ifboolexpr{%
  1075.     not test {\iffieldundef{origyear}}
  1076.    not test {\iffieldundef{labelyear}}
  1077.    and not test {\iffieldsequal{labelyear}{origyear}}}
  1078.     {\printtext[parens]{%
  1079.        \bibcpstring{origyear}
  1080.       \setunit{\addnbspace}%
  1081.        \printorigdate}%
  1082.      \renewcommand*{\finentrypunct}{\relax}}
  1083.    {}}
  1084.  
  1085. %
  1086. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1087.  
  1088. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1089. % (APA 10.3) Reference work references
  1090.  
  1091. \renewbibmacro*{maintitle+title}{%
  1092.   \iffieldsequal{maintitle}{title}
  1093.    {\clearfield{maintitle}%
  1094.      \clearfield{mainsubtitle}%
  1095.      \clearfield{maintitleaddon}}
  1096.    {\iffieldundef{maintitle}
  1097.      {}
  1098.      {\usebibmacro{maintitle}%
  1099.        \newunit\newblock
  1100.        \iffieldundef{volume}
  1101.         {}
  1102.         {\printfield{volume}%
  1103.           \printfield{part}%
  1104.           \setunit{\adddot\space}}}}%
  1105.   \usebibmacro{title}%
  1106.   \newunit}
  1107.  
  1108. \renewbibmacro*{maintitle+booktitle}{%
  1109.   \ifthenelse{\iffieldundef{maintitle}\AND\iffieldundef{booktitle}}
  1110.    {}
  1111.    {\ifthenelse{\ifnameundef{editor}\AND
  1112.                 \ifnameundef{editora}\AND
  1113.                 \ifnameundef{editorb}\AND
  1114.                 \ifnameundef{editorc}\AND
  1115.                 \(\ifnameundef{groupauthor}\AND\NOT\ifnameundef{author}\)}{}{\usebibmacro{in}}%
  1116.      \iffieldundef{maintitle}
  1117.      {}
  1118.      {\usebibmacro{maintitle}%
  1119.        \newunit\newblock
  1120.        \iffieldundef{volume}
  1121.         {}
  1122.         {\printfield{volume}%
  1123.           \printfield{part}%
  1124.           \setunit{\adddot\addspace}}}%
  1125.       \usebibmacro{booktitle}%
  1126.       \setunit{\addspace}%
  1127.       \usebibmacro{addinfo1}}}
  1128.  
  1129. \renewbibmacro*{maintitle}{%
  1130.   \ifthenelse{\iffieldundef{maintitle}\AND\iffieldundef{mainsubtitle}}
  1131.    {}
  1132.     {\printtext[maintitle]{%
  1133.        \printfield[apacase]{maintitle}%
  1134.        \setunit{\subtitlepunct}%
  1135.        \printfield[apacase]{mainsubtitle}}%
  1136.     \setunit{\addspace}}
  1137.  \printfield{maintitleaddon}}
  1138.  
  1139. \renewbibmacro*{booktitle}{%
  1140.   \ifthenelse{\iffieldundef{booktitle}\AND\iffieldundef{booksubtitle}}
  1141.    {}
  1142.     {\printtext[booktitle]{%
  1143.        \printfield[apacase]{booktitle}%
  1144.        \setunit{\subtitlepunct}%
  1145.        \printfield[apacase]{booksubtitle}}%
  1146.      \setunit{\addspace}}%
  1147.   \printfield{booktitleaddon}}
  1148.  
  1149. %
  1150. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1151.  
  1152. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1153. %  Colon separates title/subtitle
  1154. %  Skip if following terminating punctuation
  1155.  
  1156. \renewcommand*{\subtitlepunct}{\ifterm{}{\addcolon}\space}
  1157.  
  1158. %
  1159. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1160.  
  1161. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1162. % (APA 10.2.24) Multiple publishers, semi-colon sep
  1163.  
  1164. \newbibmacro*{publisher:delim}[1]{%
  1165.   \ifnumgreater{\value{listcount}}{\value{liststart}}
  1166.    {\printdelim[publisher]{multilistdelim}}
  1167.    {}}
  1168.  
  1169. \DeclareDelimFormat[publisher]{multilistdelim}{\addsemicolon\space}
  1170. \DeclareDelimFormat[publisher]{finallistdelim}{\addsemicolon\space}
  1171.  
  1172. %
  1173. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1174.  
  1175. %%%%%%%%%%%%%%%%%%%%%%
  1176. % (APA 10.10) Software
  1177.  
  1178. \newbibmacro*{appentry}{%
  1179.   \iffieldundef{appentry}
  1180.    {\newunit\newblock}
  1181.    {\printfield[apacase]{appentry}%
  1182.      \newunit\newblock
  1183.      \usebibmacro{in}%
  1184.      \setunit{\addspace}}}
  1185.  
  1186. %
  1187. %%%%%%%%%%%%%%%%%%%%%%
  1188.  
  1189. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1190. % (APA 10.1 Example 18) Comment on article
  1191.  
  1192. \newcommand*{\begrelateddelimcommenton}{\addspace}
  1193. \DeclareFieldFormat{related:commenton}{\def\bibstring{\blx@imc@bibcpstring}\mkbibbrackets{#1}}
  1194.  
  1195. \newbibmacro*{related:commenton}[1]{%
  1196.   \entrydata*{#1}{%
  1197.     \printtext{\mkbibquote{\printfield[apacase]{title}}}}}
  1198.  
  1199. %
  1200. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1201.  
  1202. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1203. % (APA 10.7) Reviews - role strings need to be the
  1204. %                      short versions in reviews
  1205.  
  1206. \DeclareFieldFormat{reviewtitle}{%
  1207.   \iffieldequalstr{entrysubtype}{tvepisode}
  1208.    {\mkbibquote{\MakeSentenceCase*{#1}}}
  1209.    {\MakeSentenceCase*{#1}}}
  1210.  
  1211. \newcommand*{\begrelateddelimreviewof}{\addspace}
  1212. \DeclareFieldFormat{related:reviewof}{\def\bibstring{\blx@imc@bibcpsstring}\mkbibbrackets{#1}}
  1213.  
  1214. \newbibmacro*{related:reviewof}[1]{%
  1215.   \entrydata*{#1}{%
  1216.     \printtext{\mkbibemph{%
  1217.                  \printfield[reviewtitle]{title}%
  1218.                  \iffieldundef{subtitle}
  1219.                   {}
  1220.                   {\setunit{\addcolon\addspace}%
  1221.                     \printfield[reviewtitle]{subtitle}}}%
  1222.                \setunit{\addcomma\addspace}%
  1223.                \biblstring{byauthor}%
  1224.                \setunit{\addspace}%
  1225.                \usebibmacro{author/editor:related}}}}
  1226.  
  1227. %
  1228. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1229.  
  1230. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1231. % (APA 10.13) Audio
  1232.  
  1233. \newbibmacro*{mainaudio}{%
  1234.   \iffieldundef{maintitle}{}
  1235.    {\iffieldequalstr{entrysubtype}{podcastepisode}{\bibcpstring{in}}{\bibcpstring{on}}%
  1236.      \setunit{\addspace}%
  1237.      \printfield{maintitle}}}
  1238.  
  1239. %
  1240. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1241.  
  1242. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1243. % (APA 10.12) Audiovisual
  1244.  
  1245. \newbibmacro*{mainvideo}{%
  1246.   \iffieldundef{maintitle}
  1247.    {}
  1248.    {\usebibmacro{in}%
  1249.      \printnames[apanames][-\value{listtotal}]{execproducer}%
  1250.      \setunit{\addspace}%
  1251.      \bibcplstring[\mkbibparens]{execproducers}%
  1252.      \setunit{\addcomma\addspace}%
  1253.      \printfield{maintitle}}}
  1254.  
  1255. %
  1256. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1257.  
  1258. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1259. % Related entries
  1260. %
  1261. % Have to force capitlisation bibstring variant because the delim
  1262. % has no printable char and this breaks default capitalisation
  1263.  
  1264. % Suppress final period after reprints in parens
  1265. \renewbibmacro*{endrelated}{%
  1266.   \iffieldequalstr{relatedtype}{reprintfrom}
  1267.    {\renewcommand*{\finentrypunct}{\relax}}
  1268.    {}}
  1269.  
  1270. \newcommand*{\begrelateddelimreprintfrom}{\addperiod\addspace}
  1271.  
  1272. % Some APA related entries are just after title, some are at the end of
  1273. % the entry. This is for those after the title
  1274. \newbibmacro*{apa:related}{%
  1275.   \iffieldundef{related}
  1276.    {}
  1277.    {\ifthenelse{\iffieldequalstr{relatedtype}{reviewof}\OR%
  1278.                  \iffieldequalstr{relatedtype}{commenton}}
  1279.       {\usebibmacro{related:init}%
  1280.         \usebibmacro{related}%
  1281.         \togglefalse{bbx:related}}% disable default related expansion later on
  1282.        {}}}
  1283.  
  1284. \DeclareFieldFormat{related:reprintfrom}{\let\bibstring\bibcpstring\mkbibparens{#1}}
  1285.  
  1286. \renewbibmacro*{related:reprintfrom}[1]{%
  1287.   \entrydata*{#1}{%
  1288.     \ifentrytype{article}
  1289.       {\mkbibquote{%
  1290.          \printfield[apacase]{title}%
  1291.          \setunit{\subtitlepunct}%
  1292.          \printfield[apacase]{subtitle}}%
  1293.        \setunit{\addcomma\addspace}%
  1294.        \printlabeldateextra
  1295.        \setunit{\addcomma\addspace}%
  1296.        \usebibmacro{journal}%
  1297.        \setunit*{\addcomma\addspace}%
  1298.        \printfield{volume}%
  1299.        \printfield[reprint]{number}%
  1300.        \setunit*{\addcomma\addspace}%
  1301.        \usebibmacro{eprint}%
  1302.        \setunit{\addcomma\addspace}%
  1303.        \iffieldundef{issuetitle}
  1304.         {}
  1305.          {\printtext[issuetitle]{%
  1306.             \printfield[noformat]{issuetitle}%
  1307.             \setunit{\subtitlepunct}%
  1308.             \printfield[noformat]{issuesubtitle}}}%
  1309.        \setunit{\addcomma\addspace}%
  1310.        \printfield{pages}%
  1311.        \setunit{\addcomma\addspace}%
  1312.        \printfield{note}%
  1313.        \setunit{\addcomma\addspace}%
  1314.        \usebibmacro{location+publisher}%
  1315.        \setunit{\addcomma\addspace}%
  1316.        \usebibmacro{doi+url}%
  1317.        \setunit{}}
  1318.   {\ifentrytype{book}
  1319.       {\mkbibemph{%
  1320.          \printfield[apacase]{title}%
  1321.          \setunit{\subtitlepunct}%
  1322.          \printfield[apacase]{subtitle}}%
  1323.        \setunit{\addcomma\addspace}%
  1324.        \printfield[pageswithprefix]{pages}%
  1325.        \setunit{\addcomma\addspace}%
  1326.        \biblstring{byauthor}\space
  1327.       \printnames[apanames][-\value{listtotal}]{editor}%
  1328.        \setunit{\addcomma\addspace}%
  1329.        \usebibmacro{apaeditorstrg}{editor}%
  1330.        \setunit{\addcomma\addspace}%
  1331.        \printlabeldateextra
  1332.        \setunit{\addcomma\addspace}%
  1333.        \usebibmacro{location+publisher}%
  1334.        \setunit{\addcomma\addspace}%
  1335.        \usebibmacro{doi+url}%
  1336.        \setunit{}}
  1337.     {}}}}
  1338.  
  1339. %
  1340. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1341.  
  1342. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1343. % (APA 9.51) Annotations
  1344.  
  1345. \newtoggle{bbx:annotation}
  1346. \DeclareBiblatexOption{global,type,entry}[boolean]{annotation}[true]{%
  1347.   \settoggle{bbx:annotation}{#1}}
  1348. \ExecuteBibliographyOptions{annotation=true}
  1349.  
  1350. \renewbibmacro*{annotation}{%
  1351.   \ifboolexpr{       test {\iffieldundef{annotation}}
  1352.              or not togl {bbx:annotation}}
  1353.    {}
  1354.    {\begingroup
  1355.     \togglefalse{blx@bibliography}%
  1356.      \newline
  1357.      \setunit{}%
  1358.      \printfield{annotation}%
  1359.      \endgroup}}
  1360.  
  1361. %
  1362. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1363.  
  1364. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1365. % (APA 11.4) Court cases
  1366.  
  1367. \newtoggle{apa:courtdate}
  1368.  
  1369. \DeclareListFormat{citation}{%
  1370.   \global\toggletrue{apa:courtdate}%
  1371.   \hasitemannotation[\currentlist][citeorg]%
  1372.     {#1\addspace\mkbibparens{\getitemannotation[\currentlist][citeorg]%
  1373.      \hasitemannotation[\currentlist][citedate]
  1374.        {\addspace\getitemannotation[\currentlist][citedate]%
  1375.          \global\togglefalse{apa:courtdate}} % disable normal date printing if it's in the citation info
  1376.        {}}}
  1377.    {\ifitemannotation[\currentlist][citeinfo]{appeal}
  1378.       {\mkbibemph{#1}}
  1379.       {#1}}%
  1380.   \ifthenelse{\value{listcount}<\value{liststop}}
  1381.    {\addcomma\addspace}
  1382.    {}}
  1383.  
  1384. \DeclareFieldFormat{courtdate}{%
  1385.   % disable normal date printing if it's in the citation info
  1386.   \iftoggle{apa:courtdate}
  1387.    {\iflistundef{organization}
  1388.      {\mkbibparens{#1}}
  1389.       {\mkbibparens{%
  1390.          \printlist{organization}\space #1}}}
  1391.    {}}
  1392.  
  1393. %
  1394. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1395.  
  1396. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1397. % (APA 11.5) Statutes
  1398.  
  1399. \newbibmacro*{statdate}{%
  1400.   \iffieldundef{origyear}
  1401.    {\printtext[parens]{\printlabeldate}}
  1402.     {\printtext[parens]{\printorigdate%
  1403.                         \addspace\&\addspace rev\adddot\addspace\printlabeldate}}}
  1404.  
  1405. %
  1406. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1407.  
  1408. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1409. % (APA 11.6) Legislative Material and Admin Material
  1410.  
  1411. \newbibmacro*{location:delim}[1]{%
  1412.   \ifnumgreater{\value{listcount}}{\value{liststart}}
  1413.    {\printdelim[location]{multilistdelim}}
  1414.    {}}
  1415.  
  1416. \DeclareDelimFormat[location]{multilistdelim}{\addcomma\space}
  1417. \DeclareDelimFormat[location]{finallistdelim}{\addcomma\space}
  1418.  
  1419. \newbibmacro*{legmattitle}{%
  1420.   \iffieldundef{title}
  1421.    {\ifbibxstring{\thefield{source}}{\bibcpsstring{\thefield{source}}}{}%
  1422.      \setunit*{\addspace}%
  1423.      \bibcpsstring{\thefield{type}}%
  1424.      \setunit*{\addspace}%
  1425.      \printfield[legmaterialnum]{number}}
  1426.    {\printfield{title}%
  1427.      \setunit*{\addcolon\addspace}\newblock
  1428.     \printfield{subtitle}}}
  1429.  
  1430. %
  1431. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1432.  
  1433. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1434. % (APA 10.x) General entrytype drivers
  1435.  
  1436. % Custom driver to make a cleaner example for 9.44
  1437. \DeclareBibliographyDriver{nameonly}{%
  1438.   \usebibmacro{begentry}%
  1439.   \printnames[apaauthor][-\value{listtotal}]{author}%
  1440.   \usebibmacro{finentry}}
  1441.  
  1442. \DeclareBibliographyDriver{article}{%
  1443.   \usebibmacro{bibindex}%
  1444.   \usebibmacro{begentry}%
  1445.   \usebibmacro{author/editor}%
  1446.   \setunit{\printdelim{nametitledelim}}\newblock
  1447.  \usebibmacro{title}%
  1448.   \setunit{\addspace}\newblock
  1449.  \usebibmacro{apa:related}%
  1450.   \newunit\newblock
  1451.   \usebibmacro{journal+issuetitle}%
  1452.   \setunit{\bibpagespunct}%
  1453.   \printfield{pages}%
  1454.   \newunit\newblock
  1455.   \printfield{howpublished}%
  1456.   \newunit\newblock
  1457.   \usebibmacro{doi+url}%
  1458.   \newblock
  1459.   \usebibmacro{origyear}%
  1460.   \newunit\newblock
  1461.   \printfield{addendum}%
  1462.   \setunit{\addspace}\newblock
  1463.  \iftoggle{bbx:related}
  1464.    {\usebibmacro{related:init}%
  1465.      \usebibmacro{related}}
  1466.    {}%
  1467.   \usebibmacro{pageref}%
  1468.   \usebibmacro{annotation}%
  1469.   \usebibmacro{finentry}}
  1470.  
  1471. \DeclareBibliographyDriver{audio}{%
  1472.   \usebibmacro{bibindex}%
  1473.   \usebibmacro{begentry}%
  1474.   \usebibmacro{author/editor}%
  1475.   \setunit{\printdelim{nametitledelim}}\newblock
  1476.  \usebibmacro{title}%
  1477.   \setunit{\addspace}\newblock
  1478.  \usebibmacro{apa:related}%
  1479.   \newunit\newblock
  1480.   \usebibmacro{mainaudio}%
  1481.   \newunit\newblock
  1482.   \usebibmacro{location+publisher}%
  1483.   \newunit\newblock
  1484.   \usebibmacro{doi+url}%
  1485.   \newblock
  1486.   \usebibmacro{origyear}%
  1487.   \newunit\newblock
  1488.   \printfield{addendum}%
  1489.   \setunit{\addspace}\newblock
  1490.  \iftoggle{bbx:related}
  1491.    {\usebibmacro{related:init}%
  1492.      \usebibmacro{related}}
  1493.    {}%
  1494.   \usebibmacro{pageref}%
  1495.   \usebibmacro{annotation}%
  1496.   \usebibmacro{finentry}}
  1497.  
  1498. \DeclareBibliographyDriver{book}{%
  1499.   \usebibmacro{bibindex}%
  1500.   \usebibmacro{begentry}%
  1501.   \usebibmacro{author/editor}%
  1502.   \setunit{\printdelim{nametitledelim}}\newblock
  1503.  \usebibmacro{maintitle+title}%
  1504.   \newunit\newblock
  1505.   \printlist{publisher}%
  1506.   \newunit\newblock
  1507.   \usebibmacro{doi+url}%
  1508.   \newblock
  1509.   \usebibmacro{origyear}%
  1510.   \newunit\newblock
  1511.   \printfield{addendum}%
  1512.   \newunit\newblock
  1513.   \iftoggle{bbx:related}
  1514.    {\usebibmacro{related:init}%
  1515.      \usebibmacro{related}}
  1516.    {}%
  1517.   \usebibmacro{pageref}%
  1518.   \usebibmacro{annotation}%
  1519.   \usebibmacro{finentry}}
  1520.  
  1521. \DeclareBibliographyDriver{constitution}{%
  1522.   \usebibmacro{bibindex}%
  1523.   \usebibmacro{begentry}%
  1524.   \bibcpsstring{\thefield{source}}%
  1525.   \setunit{\addspace}\newblock
  1526.  \bibcpsstring{\thefield{type}}%
  1527.   \setunit{\addspace}\newblock
  1528.  \iffieldundef{amendment}{}{\bibsstring{amendment}\setunit{\addspace}\printfield{amendment}}%
  1529.   \setunit{\addcomma\addspace}\newblock
  1530.  \iffieldundef{article}{}{\bibsstring{article}\setunit{\addspace}\printfield{article}}%
  1531.   \setunit{\addcomma\addspace}\newblock
  1532.  \iffieldundef{section}{}{\bibsstring{section}\setunit{\addspace}\printfield{section}}%
  1533.   \setunit{\addcomma\addspace}\newblock
  1534.  \iffieldundef{part}{}{\bibsstring{paragraph}\setunit{\addspace}\printfield{part}}%
  1535.   \setunit{\addspace}\newblock
  1536.  \ifkeyword{repealed}{\printtext[parens]{\biblcsstring{repealed}\setunit{\addspace}\printeventdate}}{}%
  1537.   \usebibmacro{doi+url}%
  1538.   \usebibmacro{pageref}%
  1539.   \usebibmacro{annotation}%
  1540.   \usebibmacro{finentry}}
  1541.  
  1542. \DeclareBibliographyDriver{dataset}{%
  1543.   \usebibmacro{bibindex}%
  1544.   \usebibmacro{begentry}%
  1545.   \usebibmacro{author/editor}%
  1546.   \setunit{\printdelim{nametitledelim}}\newblock
  1547.  \usebibmacro{title}%
  1548.   \newunit\newblock
  1549.   \printfield{type}%
  1550.   \newunit\newblock
  1551.   \printlist{organization}%
  1552.   \newunit\newblock
  1553.   \usebibmacro{location+publisher}%
  1554.   \newunit\newblock
  1555.   \printlist{institution}%
  1556.   \newunit\newblock
  1557.   \usebibmacro{doi+url}%
  1558.   \newblock
  1559.   \printfield{addendum}%
  1560.   \newunit\newblock
  1561.   \iftoggle{bbx:related}
  1562.    {\usebibmacro{related:init}%
  1563.      \usebibmacro{related}}
  1564.    {}%
  1565.   \usebibmacro{pageref}%
  1566.   \usebibmacro{annotation}%
  1567.   \usebibmacro{finentry}}
  1568.  
  1569. \DeclareBibliographyDriver{image}{%
  1570.   \usebibmacro{bibindex}%
  1571.   \usebibmacro{begentry}%
  1572.   \usebibmacro{author/editor}%
  1573.   \setunit{\printdelim{nametitledelim}}\newblock
  1574.  \usebibmacro{title}%
  1575.   \newunit\newblock
  1576.   \usebibmacro{location+publisher}%
  1577.   \newunit\newblock
  1578.   \usebibmacro{doi+url}%
  1579.   \newblock
  1580.   \printfield{addendum}%
  1581.   \newunit\newblock
  1582.   \iftoggle{bbx:related}
  1583.    {\usebibmacro{related:init}%
  1584.      \usebibmacro{related}}
  1585.    {}%
  1586.   \usebibmacro{pageref}%
  1587.   \usebibmacro{annotation}%
  1588.   \usebibmacro{finentry}}
  1589.  
  1590. \DeclareBibliographyDriver{inbook}{%
  1591.   \usebibmacro{bibindex}%
  1592.   \usebibmacro{begentry}%
  1593.   \usebibmacro{author/editor}%
  1594.   \setunit{\printdelim{nametitledelim}}\newblock
  1595.  \usebibmacro{title}%
  1596.   \setunit{\addspace}\newblock
  1597.  \usebibmacro{apa:related}%
  1598.   \newunit\newblock
  1599.   \usebibmacro{editor+trans}%
  1600.   \newblock
  1601.   \usebibmacro{maintitle+booktitle}%
  1602.   \newunit\newblock
  1603.   \printlist{publisher}%
  1604.   \newunit\newblock
  1605.   \usebibmacro{doi+url}%
  1606.   \newblock
  1607.   \usebibmacro{origyear}%
  1608.   \newunit\newblock
  1609.   \printfield{addendum}%
  1610.   \newunit\newblock
  1611.   \iftoggle{bbx:related}
  1612.    {\usebibmacro{related:init}%
  1613.      \usebibmacro{related}}
  1614.    {}%
  1615.   \usebibmacro{pageref}%
  1616.   \usebibmacro{annotation}%
  1617.   \usebibmacro{finentry}}
  1618.  
  1619. \DeclareBibliographyDriver{jurisdiction}{%
  1620.   \usebibmacro{bibindex}%
  1621.   \usebibmacro{begentry}%
  1622.   \printfield{title}%
  1623.   \setunit{\addcomma\addspace}\newblock
  1624.  \printlist{citation}%
  1625.   \setunit{\addspace}\newblock
  1626.  \printtext[courtdate]{\printlabeldate}%
  1627.   \newunit\newblock
  1628.   \usebibmacro{doi+url}%
  1629.   \usebibmacro{pageref}%
  1630.   \usebibmacro{annotation}%
  1631.   \usebibmacro{finentry}}
  1632.  
  1633. \DeclareBibliographyDriver{legal}{%
  1634.   \usebibmacro{bibindex}%
  1635.   \usebibmacro{begentry}%
  1636.   \printfield{title}%
  1637.   \setunit{\addspace}%
  1638.   \printfield{titleaddon}%
  1639.   \setunit{\addcomma\addspace}\newblock
  1640.   \printlabeldate%
  1641.   \setunit{\addcomma\addspace}\newblock
  1642.  \usebibmacro{doi+url}%
  1643.   \usebibmacro{pageref}%
  1644.   \usebibmacro{annotation}%
  1645.   \usebibmacro{finentry}}
  1646.  
  1647. \DeclareBibliographyDriver{legislation}{%
  1648.   \usebibmacro{bibindex}%
  1649.   \usebibmacro{begentry}%
  1650.   \printfield{title}%
  1651.   \setunit{\addspace}%
  1652.   \printfield{titleaddon}%
  1653.   \setunit{\addcomma\addspace}\newblock
  1654.  \printlist{location}%
  1655.   \setunit{\addspace}\newblock
  1656.  \usebibmacro{statdate}%
  1657.   \newunit\newblock
  1658.   \usebibmacro{doi+url}%
  1659.   \usebibmacro{pageref}%
  1660.   \usebibmacro{annotation}%
  1661.   \usebibmacro{finentry}}
  1662.  
  1663. \DeclareBibliographyDriver{legadminmaterial}{%
  1664.   \usebibmacro{bibindex}%
  1665.   \usebibmacro{begentry}%
  1666.   \usebibmacro{legmattitle}%
  1667.   \setunit{\addcomma\addspace}\newblock
  1668.  \printlist{citation}%
  1669.   \setunit{\addspace}\newblock
  1670.  \printtext[parens]{\ifkeyword{proposed}{\bibstring{proposed}\space}{}\printlabeldate}%
  1671.   \setunit{\addspace}\newblock
  1672.  \printfield{note}%
  1673.   \newunit\newblock
  1674.   \usebibmacro{doi+url}%
  1675.   \usebibmacro{pageref}%
  1676.   \usebibmacro{annotation}%
  1677.   \usebibmacro{finentry}}
  1678.  
  1679. \DeclareBibliographyDriver{legmaterial}{%
  1680.   \usebibmacro{bibindex}%
  1681.   \usebibmacro{begentry}%
  1682.   \usebibmacro{legmattitle}%
  1683.   \setunit{\addcomma\addspace}\newblock
  1684.  \printlist{location}%
  1685.   \setunit{\addspace}\newblock
  1686.  \printtext[parens]{\printlabeldate}%
  1687.   \setunit{\addspace}\newblock
  1688.  \printfield{note}%
  1689.   \newunit\newblock
  1690.   \usebibmacro{doi+url}%
  1691.   \usebibmacro{pageref}%
  1692.   \usebibmacro{annotation}%
  1693.   \usebibmacro{finentry}}
  1694.  
  1695. \DeclareBibliographyDriver{manual}{%
  1696.   \usebibmacro{bibindex}%
  1697.   \usebibmacro{begentry}%
  1698.   \usebibmacro{author/editor}%
  1699.   \setunit{\printdelim{nametitledelim}}\newblock
  1700.  \usebibmacro{title}%
  1701.   \newunit\newblock
  1702.   \printfield{type}%
  1703.   \newunit
  1704.   \printfield{version}%
  1705.   \newunit\newblock
  1706.   \printlist{organization}%
  1707.   \newunit
  1708.   \usebibmacro{location+publisher}%
  1709.   \newunit\newblock
  1710.   \usebibmacro{doi+url}%
  1711.   \newblock
  1712.   \printfield{addendum}%
  1713.   \newunit\newblock
  1714.   \iftoggle{bbx:related}
  1715.    {\usebibmacro{related:init}%
  1716.      \usebibmacro{related}}
  1717.    {}%
  1718.   \usebibmacro{pageref}%
  1719.   \usebibmacro{annotation}%
  1720.   \usebibmacro{finentry}}
  1721.  
  1722. \DeclareBibliographyDriver{misc}{%
  1723.   \usebibmacro{bibindex}%
  1724.   \usebibmacro{begentry}%
  1725.   \usebibmacro{author/editor}%
  1726.   \setunit{\printdelim{nametitledelim}}\newblock
  1727.  \usebibmacro{title}%
  1728.   \setunit{\addspace}\newblock
  1729.  \usebibmacro{apa:related}%
  1730.   \newunit\newblock
  1731.   \printlist{organization}%
  1732.   \newunit\newblock
  1733.   \usebibmacro{doi+url}%
  1734.   \newblock
  1735.   \printfield{addendum}%
  1736.   \newunit\newblock
  1737.   \iftoggle{bbx:related}
  1738.    {\usebibmacro{related:init}%
  1739.      \usebibmacro{related}}
  1740.    {}%
  1741.   \usebibmacro{pageref}%
  1742.   \usebibmacro{annotation}%
  1743.   \usebibmacro{finentry}}
  1744.  
  1745. \DeclareBibliographyDriver{online}{%
  1746.   \usebibmacro{bibindex}%
  1747.   \usebibmacro{begentry}%
  1748.   \usebibmacro{author/editor}%
  1749.   \setunit{\printdelim{nametitledelim}}\newblock
  1750.  \usebibmacro{title}%
  1751.   \setunit{\addspace}\newblock
  1752.  \printfield{version}%
  1753.   \setunit{\addspace}\newblock
  1754.  \usebibmacro{apa:related}%
  1755.   \newunit\newblock
  1756.   \usebibmacro{eprint}%
  1757.   \newunit\newblock
  1758.   \printlist{organization}%
  1759.   \addperiod\addspace
  1760.   \newunit\newblock
  1761.   \usebibmacro{doi+url}%
  1762.   \newblock
  1763.   \printfield{addendum}%
  1764.   \newunit\newblock
  1765.   \iftoggle{bbx:related}
  1766.    {\usebibmacro{related:init}%
  1767.      \usebibmacro{related}}
  1768.    {}%
  1769.   \usebibmacro{pageref}%
  1770.   \usebibmacro{annotation}%
  1771.   \usebibmacro{finentry}}
  1772.  
  1773. \DeclareBibliographyDriver{patent}{%
  1774.   \usebibmacro{bibindex}%
  1775.   \usebibmacro{begentry}%
  1776.   \usebibmacro{author/editor}%
  1777.   \setunit{\printdelim{nametitledelim}}\newblock
  1778.  \usebibmacro{title}%
  1779.   \setunit{\addspace}\newblock
  1780.  \usebibmacro{apa:related}%
  1781.   \newunit\newblock
  1782.   \usebibmacro{location+publisher}%
  1783.   \newunit\newblock
  1784.   \usebibmacro{doi+url}%
  1785.   \newunit\newblock
  1786.   \printfield{addendum}%
  1787.   \newunit\newblock
  1788.   \iftoggle{bbx:related}
  1789.    {\usebibmacro{related:init}%
  1790.      \usebibmacro{related}}
  1791.    {}%
  1792.   \usebibmacro{pageref}%
  1793.   \usebibmacro{finentry}}
  1794.  
  1795. \DeclareBibliographyDriver{periodical}{%
  1796.   \usebibmacro{bibindex}%
  1797.   \usebibmacro{begentry}%
  1798.   \usebibmacro{author/editor}%
  1799.   \setunit{\printdelim{nametitledelim}}\newblock
  1800.  \usebibmacro{title+issuetitle}%
  1801.   \setunit{\adddot\addspace}
  1802.  \usebibmacro{journal}%
  1803.   \setunit{\addcomma\addspace}
  1804.  \printlist{location}%
  1805.   \setunit{\addcomma\addspace}
  1806.  \usebibmacro{pnumber}%
  1807.   \setunit{\addcomma\addspace}
  1808.  \printfield{pages}%
  1809.   \newunit\newblock
  1810.   \usebibmacro{doi+url}%
  1811.   \newunit\newblock
  1812.   \printfield{addendum}%
  1813.   \newunit\newblock
  1814.   \iftoggle{bbx:related}
  1815.    {\usebibmacro{related:init}%
  1816.      \usebibmacro{related}}
  1817.    {}%
  1818.   \usebibmacro{pageref}%
  1819.   \usebibmacro{annotation}%
  1820.   \usebibmacro{finentry}}
  1821.  
  1822. \DeclareBibliographyDriver{presentation}{%
  1823.   \usebibmacro{bibindex}%
  1824.   \usebibmacro{begentry}%
  1825.   \usebibmacro{author/editor}%
  1826.   \setunit{\printdelim{nametitledelim}}\newblock
  1827.  \usebibmacro{title}%
  1828.   \setunit{\addspace}\newblock
  1829.  \usebibmacro{apa:related}%
  1830.   \newunit\newblock
  1831.   \usebibmacro{editor+trans}%
  1832.   \setunit*{\addcomma\addspace}\newblock
  1833.  \usebibmacro{maintitle+booktitle}%
  1834.   \newunit\newblock
  1835.   \usebibmacro{eventinfo}%
  1836.   \newunit\newblock
  1837.   \printlist{organization}%
  1838.   \newunit
  1839.   \usebibmacro{location+publisher}%
  1840.   \newunit\newblock
  1841.   \printfield{pages}%
  1842.   \newunit\newblock
  1843.   \usebibmacro{origyear}%
  1844.   \newunit\newblock
  1845.   \usebibmacro{doi+url}%
  1846.   \newblock
  1847.   \printfield{addendum}%
  1848.   \newunit\newblock
  1849.   \iftoggle{bbx:related}
  1850.    {\usebibmacro{related:init}%
  1851.      \usebibmacro{related}}
  1852.    {}%
  1853.   \usebibmacro{pageref}%
  1854.   \usebibmacro{annotation}%
  1855.   \usebibmacro{finentry}}
  1856.  
  1857. \DeclareBibliographyDriver{report}{%
  1858.   \usebibmacro{bibindex}%
  1859.   \usebibmacro{begentry}%
  1860.   \usebibmacro{author/editor}%
  1861.   \setunit{\printdelim{nametitledelim}}\newblock
  1862.  \usebibmacro{title}%
  1863.   \setunit{\addspace}\newblock
  1864.  \usebibmacro{apa:related}%
  1865.   \newunit\newblock
  1866.   \printlist{institution}%
  1867.   \newunit\newblock
  1868.   \usebibmacro{location+publisher}%
  1869.   \newunit\newblock
  1870.   \usebibmacro{doi+url}%
  1871.   \newblock
  1872.   \printfield{addendum}%
  1873.   \newunit\newblock
  1874.   \iftoggle{bbx:related}
  1875.    {\usebibmacro{related:init}%
  1876.      \usebibmacro{related}}
  1877.    {}%
  1878.   \usebibmacro{pageref}%
  1879.   \usebibmacro{annotation}%
  1880.   \usebibmacro{finentry}}
  1881.  
  1882. \DeclareBibliographyDriver{software}{%
  1883.   \usebibmacro{bibindex}%
  1884.   \usebibmacro{begentry}%
  1885.   \usebibmacro{author/editor}%
  1886.   \setunit{\printdelim{nametitledelim}}\newblock
  1887.  \usebibmacro{appentry}%
  1888.   \usebibmacro{title}%
  1889.   \newunit\newblock
  1890.   \usebibmacro{location+publisher}%
  1891.   \newunit\newblock
  1892.   \usebibmacro{doi+url}%
  1893.   \newblock
  1894.   \printfield{addendum}%
  1895.   \newunit\newblock
  1896.   \iftoggle{bbx:related}
  1897.    {\usebibmacro{related:init}%
  1898.      \usebibmacro{related}}
  1899.    {}%
  1900.   \usebibmacro{pageref}%
  1901.   \usebibmacro{annotation}%
  1902.   \usebibmacro{finentry}}
  1903.  
  1904. \DeclareBibliographyDriver{thesis}{%
  1905.   \usebibmacro{bibindex}%
  1906.   \usebibmacro{begentry}%
  1907.   \usebibmacro{author/editor}%
  1908.   \setunit{\printdelim{nametitledelim}}\newblock
  1909.  \usebibmacro{title}%
  1910.   \newunit\newblock
  1911.   \printlist{institution}%
  1912.   \newunit\newblock
  1913.   \usebibmacro{location+publisher}%
  1914.   \newunit\newblock
  1915.   \usebibmacro{doi+url}%
  1916.   \newunit\newblock
  1917.   \printfield{addendum}%
  1918.   \newunit\newblock
  1919.   \iftoggle{bbx:related}
  1920.    {\usebibmacro{related:init}%
  1921.      \usebibmacro{related}}
  1922.    {}%
  1923.   \usebibmacro{pageref}%
  1924.   \usebibmacro{annotation}%
  1925.   \usebibmacro{finentry}}
  1926.  
  1927. \DeclareBibliographyDriver{unpublished}{%
  1928.   \usebibmacro{bibindex}%
  1929.   \usebibmacro{begentry}%
  1930.   \usebibmacro{author/editor}%
  1931.   \setunit{\printdelim{nametitledelim}}\newblock
  1932.  \usebibmacro{title}%
  1933.   \setunit{\addspace}\newblock
  1934.  \usebibmacro{apa:related}%
  1935.   \setunit{\addspace}%
  1936.   \printfield{howpublished}%
  1937.   \newunit\newblock
  1938.   \printfield{venue}%
  1939.   \setunit{\addcomma\addspace}
  1940.  \printlist{institution}%
  1941.   \newunit\newblock
  1942.   \usebibmacro{doi+url}%
  1943.   \newblock
  1944.   \printfield{addendum}%
  1945.   \newunit\newblock
  1946.   \iftoggle{bbx:related}
  1947.    {\usebibmacro{related:init}%
  1948.      \usebibmacro{related}}
  1949.    {}%
  1950.   \usebibmacro{pageref}%
  1951.   \usebibmacro{annotation}%
  1952.   \usebibmacro{finentry}}
  1953.  
  1954. \DeclareBibliographyDriver{video}{%
  1955.   \usebibmacro{bibindex}%
  1956.   \usebibmacro{begentry}%
  1957.   \usebibmacro{author/editor}%
  1958.   \setunit{\printdelim{nametitledelim}}\newblock
  1959.  \usebibmacro{title}%
  1960.   \setunit{\addspace}\newblock
  1961.  \usebibmacro{apa:related}%
  1962.   \newunit\newblock
  1963.   \usebibmacro{mainvideo}%
  1964.   \newunit\newblock
  1965.   \usebibmacro{location+publisher}%
  1966.   \newunit\newblock
  1967.   \usebibmacro{doi+url}%
  1968.   \newblock
  1969.   \printfield{addendum}%
  1970.   \newunit\newblock
  1971.   \iftoggle{bbx:related}
  1972.    {\usebibmacro{related:init}%
  1973.      \usebibmacro{related}}
  1974.    {}%
  1975.   \usebibmacro{pageref}%
  1976.   \usebibmacro{annotation}%
  1977.   \usebibmacro{finentry}}
  1978.  
  1979. %
  1980. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1981.  
  1982. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1983. % Modified, common macros
  1984.  
  1985. \newbibmacro*{editorx}{%
  1986.   \ifnameundef{editor}
  1987.    {}
  1988.    {\printnames[apanames][-\value{listtotal}]{editor}%
  1989.      \setunit{\addspace}%
  1990.      \printtext[parens]{\usebibmacro{apaeditorstrg}{editor}}
  1991.     \clearname{editor}%
  1992.      \newunit}%
  1993.   \ifnameundef{editora}
  1994.    {}
  1995.    {\printnames[apanames][-\value{listtotal}]{editora}%
  1996.      \setunit{\addspace}%
  1997.      \printtext[parens]{\usebibmacro{apaeditorstrg}{editora}}
  1998.     \clearname{editora}%
  1999.      \newunit}%
  2000.   \ifnameundef{editorb}
  2001.    {}
  2002.    {\printnames[apanames][-\value{listtotal}]{editorb}%
  2003.      \setunit{\addspace}%
  2004.      \printtext[parens]{\usebibmacro{apaeditorstrg}{editorb}}
  2005.     \clearname{editorb}%
  2006.      \newunit}%
  2007.   \ifnameundef{editorc}
  2008.    {}
  2009.    {\printnames[apanames][-\value{listtotal}]{editorc}%
  2010.      \setunit{\addspace}%
  2011.      \printtext[parens]{\usebibmacro{apaeditorstrg}{editorc}}
  2012.     \clearname{editorc}%
  2013.      \newunit}}
  2014.  
  2015. \newbibmacro*{apaeditorstrg}[1]{%
  2016.   \iffieldundef{#1type}
  2017.    {\ifthenelse{\value{#1}>1\OR\ifandothers{#1}}
  2018.       {\bibcpstring{editors}}
  2019.       {\bibcpstring{editor}}}
  2020.    {\ifthenelse{\value{#1}>1\OR\ifandothers{#1}}
  2021.         {\bibcpstring{type\thefield{#1type}s}}
  2022.         {\bibcpstring{type\thefield{#1type}}}}}
  2023.  
  2024.  
  2025.  
  2026. %(APA 9.35) No periods after URLS
  2027. % we'll override a global url option for for @online entries
  2028. \ExecuteBibliographyOptions[online]{url=true}
  2029. \newbibmacro*{doi+url}{%
  2030.   \ifboolexpr{          test {\iffieldundef{doi}}
  2031.                 or not togl {bbx:doi}}
  2032.    {\ifboolexpr{       test {\iffieldundef{url}}
  2033.                 or not togl {bbx:url}}
  2034.       {\newunit}
  2035.       {\usebibmacro{url+urldate}%
  2036.         \setunit{\addspace}}}
  2037.    {\printfield{doi}%
  2038.      \renewcommand*{\finentrypunct}{\relax}%
  2039.      \setunit{\addspace}}}
  2040.  
  2041. \renewbibmacro*{url+urldate}{%
  2042.   \ifthenelse{\iffieldundef{url}\OR\NOT\iffieldundef{doi}}
  2043.    {}
  2044.    {\iffieldundef{urlyear}
  2045.      {}
  2046.      {\bibstring{retrieved}%
  2047.        \setunit{\addspace}%
  2048.        \printurldate
  2049.        \setunit{\urldatecomma}%
  2050.        \bibstring{from}%
  2051.        \setunit{\addspace}}%
  2052.      \iffieldundef{url}{}{\printfield{url}\renewcommand*{\finentrypunct}{\relax}}}}
  2053.  
  2054. \DeclareFieldFormat{doi}{%
  2055.   \ifhyperref
  2056.     {\href{https://doi.org/#1}{\nolinkurl{https://doi.org/#1}}}
  2057.    {\nolinkurl{https://doi.org/#1}}}
  2058.  
  2059. \newbibmacro*{location+publisher}{%
  2060.   \printlist{location}%
  2061.   \setunit*{\addcomma\space}%
  2062.   \printlist{publisher}}
  2063.  
  2064. %
  2065. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2066.  
  2067. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2068. % Unchanged from authoryear-comp
  2069.  
  2070. \DeclareBibliographyOption{dashed}[true]{%
  2071.   \ifstrequal{#1}{true}
  2072.    {\ExecuteBibliographyOptions{pagetracker}%
  2073.      \renewbibmacro*{bbx:savehash}{\savefield{fullhash}{\bbx@lasthash}}}
  2074.    {\ExecuteBibliographyOptions{pagetracker=false}%
  2075.      \renewbibmacro*{bbx:savehash}{}}}
  2076.  
  2077. \DeclareFieldFormat{shorthandwidth}{#1}
  2078. \setlength{\bibitemsep}{0pt}
  2079.  
  2080. \defbibenvironment{bibliography}
  2081.  {\list
  2082.     {}
  2083.     {\setlength{\leftmargin}{\bibhang}%
  2084.       \setlength{\itemindent}{-\leftmargin}%
  2085.       \setlength{\itemsep}{\bibitemsep}%
  2086.       \setlength{\parsep}{\bibparsep}}}
  2087.  {\endlist}
  2088.  {\item}
  2089.  
  2090. \defbibenvironment{shorthands}
  2091.  {\list
  2092.     {\printfield[shorthandwidth]{shorthand}}
  2093.     {\setlength{\labelwidth}{\shorthandwidth}%
  2094.       \setlength{\leftmargin}{\labelwidth}%
  2095.       \setlength{\labelsep}{\biblabelsep}%
  2096.       \addtolength{\leftmargin}{\labelsep}%
  2097.       \setlength{\itemsep}{\bibitemsep}%
  2098.       \setlength{\parsep}{\bibparsep}%
  2099.       \renewcommand*{\makelabel}[1]{##1\hss}}}
  2100.  {\endlist}
  2101.  {\item}
  2102.  
  2103. \InitializeBibliographyStyle{%
  2104.   \global\undef\bbx@lasthash}
  2105.  
  2106. \newbibmacro*{bbx:savehash}{%
  2107.   \savefield{fullhash}{\bbx@lasthash}}
  2108.  
  2109. \newbool{bbx@inset}
  2110. \DeclareBibliographyDriver{set}{%
  2111.   \booltrue{bbx@inset}%
  2112.   \entryset{}{}%
  2113.   \newunit\newblock
  2114.   \usebibmacro{setpageref}%
  2115.   \finentry}
  2116.  
  2117. \endinput
  2118.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement