diff options
author | Karl Berry <karl@freefriends.org> | 2020-04-11 22:41:19 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-04-11 22:41:19 +0000 |
commit | b5027823bc9f2e1d2bdc165ac21a2eb735db0bad (patch) | |
tree | e734b06feee478be8dfe034608ebf809543a456e /Master/texmf-dist/tex/latex/biblatex-apa/apa.bbx | |
parent | f39c33ba2c8fda94a282b268494bd6e69016f0b5 (diff) |
biblatex-apa (9apr20)
git-svn-id: svn://tug.org/texlive/trunk@54667 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/biblatex-apa/apa.bbx')
-rw-r--r-- | Master/texmf-dist/tex/latex/biblatex-apa/apa.bbx | 149 |
1 files changed, 76 insertions, 73 deletions
diff --git a/Master/texmf-dist/tex/latex/biblatex-apa/apa.bbx b/Master/texmf-dist/tex/latex/biblatex-apa/apa.bbx index 2e17e6b3f8e..01a96b6c802 100644 --- a/Master/texmf-dist/tex/latex/biblatex-apa/apa.bbx +++ b/Master/texmf-dist/tex/latex/biblatex-apa/apa.bbx @@ -12,7 +12,7 @@ %% %% The Current Maintainer of this work is Philip Kime. -\ProvidesFile{apa.bbx}[2020/02/22\space v9.6\space APA biblatex references style] +\ProvidesFile{apa.bbx}[2020/04/08\space v9.9\space APA biblatex references style] \RequireBiber[3] \RequireBibliographyStyle{standard} \urlstyle{rm} % APA examples all have URLs in same font as text @@ -62,24 +62,45 @@ \fi } -\newrobustcmd{\mkbibparense}[1]{% - \setbox0=\hbox{#1\foreverunspace}% +% we need a way to save the state of the punctuation buffer +% cf. \blx@initunit in biblatex.sty for what we need to copy + +% this uses the internal implementation of etoolbox toggles +% fingers crossed no one messes with it +\newrobustcmd*{\apablx@savetoggle}[1]{% + \csletcs{apablx@savedtoggle@#1}{etb@tgl@#1}} + +\newrobustcmd*{\apablx@restoretoggle}[1]{% + \csletcs{etb@tgl@#1}{apablx@savedtoggle@#1}} + +\newrobustcmd*{\apablx@savepunctstate}{% + \apablx@savetoggle{blx@block}% + \apablx@savetoggle{blx@unit}% + \apablx@savetoggle{blx@insert}% + \apablx@savetoggle{blx@lastins}% + \apablx@savetoggle{blx@keepunit}% + \let\apablx@savd@unitpunct\blx@unitpunct + \let\apablx@savd@puncthook\abx@puncthook} + +\newrobustcmd*{\apablx@restorepunctstate}{% + \global\apablx@restoretoggle{blx@block}% + \global\apablx@restoretoggle{blx@unit}% + \global\apablx@restoretoggle{blx@insert}% + \global\apablx@restoretoggle{blx@lastins}% + \global\apablx@restoretoggle{blx@keepunit}% + \global\let\blx@unitpunct\apablx@savd@unitpunct + \global\let\abx@puncthook\apablx@savd@puncthook} + +% printtext that checks if it would print anything +\newrobustcmd{\printtexte}[2][]{% + \apablx@savepunctstate + \setbox0=\hbox{#2\foreverunspace}% + \apablx@restorepunctstate \ifdim\wd0=0pt \else - % Since we are evaluating the argument twice and it contains \setunit, - % need to sanitise \setunit second time around. Can't just put in \box0 - % as it might be long and won't linebreak - \mkbibparens{\setunit{}#1}% - \fi} - -\newrobustcmd{\mkbibbracketse}[1]{% - \setbox0=\hbox{#1\foreverunspace}% - \ifdim\wd0=0pt - \else - % Since we are evaluating the argument twice and it contains \setunit, - % need to sanitise \setunit second time around. Can't just put in \box0 - % as it might be long and won't linebreak - \mkbibbrackets{\setunit{}#1}% + \ifblank{#1} + {\printtext{#2}} + {\printtext[#1]{#2}}% \fi} % @@ -433,8 +454,11 @@ % PART \DeclareFieldFormat*{part}{#1} +% ORGANIZATION +\DeclareListFormat[misc]{organization}{\mkbibemph{#1}} + % LOCATION -\DeclareListFormat[misc,periodical]{location}{\mkbibemph{#1}} +\DeclareListFormat[periodical]{location}{\mkbibemph{#1}} \DeclareListFormat{publisher}{% \usebibmacro{publisher:delim}{#1}% #1\isdot} @@ -447,6 +471,7 @@ % VERSION \DeclareFieldFormat[dataset,software]{version}{\bibcpstring{version}~#1} +\DeclareFieldFormat[online]{version}{\mkbibparens{#1}} % URL \DeclareFieldFormat{url}{\url{#1}} @@ -652,7 +677,7 @@ \newbibmacro*{eventinfo}{% \printfield{eventtitle}% \setunit{\addcomma\addspace}% - \usebibmacro{location+publisher}} + \printfield{venue}} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -701,36 +726,34 @@ \usebibmacro{addinfo2}}}% \newbibmacro*{addinfo1}{% - \printtext{% - \mkbibparense{% - \usebibmacro{editor+trans+narr}% - \setunit*{\addsemicolon\addspace}% - \printfield{edition}% - \setunit*{\addcomma\addspace}% - \ifthenelse{\ifentrytype{report}\OR% - \ifentrytype{thesis}\OR% - \ifentrytype{unpublished}\OR% - \ifentrytype{dataset}\OR% - \ifentrytype{software}\OR% - \ifentrytype{audio}\OR% - \ifentrytype{patent}\OR% - \ifentrytype{image}}{\usebibmacro{addinfo3}}{}% - \setunit*{\addcomma\addspace}% - \ifentrytype{inbook}{\printfield{pages}}{}% - \setunit*{\addcomma\addspace}% - \ifentrytype{book}{\printfield{volumes}}{}% - \setunit*{\addcomma\addspace}% - \ifentrytype{book}{\printfield{volume}}{}}}} + \printtexte[parens]{% + \usebibmacro{editor+trans+narr}% + \setunit*{\addsemicolon\addspace}% + \printfield{edition}% + \setunit*{\addcomma\addspace}% + \ifthenelse{\ifentrytype{report}\OR% + \ifentrytype{thesis}\OR% + \ifentrytype{unpublished}\OR% + \ifentrytype{dataset}\OR% + \ifentrytype{software}\OR% + \ifentrytype{audio}\OR% + \ifentrytype{patent}\OR% + \ifentrytype{image}}{\usebibmacro{addinfo3}}{}% + \setunit*{\addcomma\addspace}% + \ifentrytype{inbook}{\printfield{pages}}{}% + \setunit*{\addcomma\addspace}% + \ifentrytype{book}{\printfield{volumes}}{}% + \setunit*{\addcomma\addspace}% + \ifentrytype{book}{\printfield{volume}}{}}} % Additional post title information in brackets \newbibmacro*{addinfo2}{% - \printtext{% - \mkbibbracketse{% - \iffieldbibstring{entrysubtype} - {\bibcplstring{\thefield{entrysubtype}}} - {\printfield{entrysubtype}}% - \setunit*{\addsemicolon\addspace}% - \printfield{note}}}} + \printtexte[brackets]{% + \iffieldbibstring{entrysubtype} + {\bibcplstring{\thefield{entrysubtype}}} + {\printfield{entrysubtype}}% + \setunit*{\addsemicolon\addspace}% + \printfield{note}}} % number/issue information \newbibmacro*{addinfo3}{% @@ -1488,7 +1511,7 @@ \setunit{\printdelim{nametitledelim}}\newblock \usebibmacro{maintitle+title}% \newunit\newblock - \usebibmacro{location+publisher}% + \printlist{publisher}% \newunit\newblock \usebibmacro{doi+url}% \newblock @@ -1533,8 +1556,6 @@ \usebibmacro{title}% \newunit\newblock \printfield{type}% - \newunit - \printfield{note}% \newunit\newblock \printlist{organization}% \newunit\newblock @@ -1588,9 +1609,7 @@ \newblock \usebibmacro{maintitle+booktitle}% \newunit\newblock - \printfield{note}% - \newunit\newblock - \usebibmacro{location+publisher}% + \printlist{publisher}% \newunit\newblock \usebibmacro{doi+url}% \newblock @@ -1621,11 +1640,7 @@ \newunit\newblock \usebibmacro{eventinfo}% \newunit\newblock - \printfield{note}% - \newunit\newblock \printlist{organization}% - \newunit - \printfield{venue}% \iffieldundef{pages} {\setunit{\addcomma\addspace}} {\newunit}% @@ -1730,8 +1745,6 @@ \printfield{type}% \newunit \printfield{version}% - \newunit - \printfield{note}% \newunit\newblock \printlist{organization}% \newunit @@ -1758,7 +1771,7 @@ \setunit{\addspace}\newblock \usebibmacro{apa:related}% \newunit\newblock - \usebibmacro{location+publisher}% + \printlist{organization}% \newunit\newblock \usebibmacro{doi+url}% \newblock @@ -1779,9 +1792,11 @@ \setunit{\printdelim{nametitledelim}}\newblock \usebibmacro{title}% \setunit{\addspace}\newblock + \printfield{version}% + \setunit{\addspace}\newblock \usebibmacro{apa:related}% \newunit\newblock - \printlist{organization}% + \usebibmacro{eprint}% \addperiod\addspace \newunit\newblock \usebibmacro{doi+url}% @@ -1807,8 +1822,6 @@ \newunit\newblock \usebibmacro{location+publisher}% \newunit\newblock - \printfield{note}% - \newunit\newblock \usebibmacro{doi+url}% \newunit\newblock \printfield{addendum}% @@ -1835,8 +1848,6 @@ \setunit{\addcomma\addspace} \printfield{pages}% \newunit\newblock - \printfield{note}% - \newunit\newblock \usebibmacro{doi+url}% \newunit\newblock \printfield{addendum}% @@ -1868,8 +1879,6 @@ \setunit{\addcomma\addspace} \printfield{pages}% \newunit\newblock - \printfield{note}% - \newunit\newblock \printlist{organization}% \newunit\newblock \usebibmacro{doi+url}% @@ -1895,8 +1904,6 @@ \newunit\newblock \printlist{institution}% \newunit\newblock - \printfield{note}% - \newunit\newblock \usebibmacro{location+publisher}% \newunit\newblock \usebibmacro{doi+url}% @@ -1944,8 +1951,6 @@ \newunit\newblock \usebibmacro{location+publisher}% \newunit\newblock - \printfield{note}% - \newunit\newblock \usebibmacro{doi+url}% \newunit\newblock \printfield{addendum}% @@ -1969,12 +1974,10 @@ \setunit{\addspace}% \printfield{howpublished}% \newunit\newblock - \printlist{location}% + \printfield{venue}% \setunit{\addcomma\addspace} \printlist{institution}% \newunit\newblock - \printfield{note}% - \newunit\newblock \usebibmacro{doi+url}% \newblock \printfield{addendum}% |