Created
February 22, 2020 18:05
-
-
Save SimonAB/91a7b417e38303dbf77fbaab426e3162 to your computer and use it in GitHub Desktop.
BibLaTeX PNAS style
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% --------------------------------------------------------------- | |
%% biblatex-pnas --- A biblatex implementation | |
%% of the PNAS bibliography style | |
%% Version: 2020-02-22 | |
%% --------------------------------------------------------------- | |
%% | |
\ProvidesFile{pnas.bbx} | |
% Load the standard style to avoid copy-pasting unnecessary material | |
\RequireBibliographyStyle{numeric-comp} | |
% Additional options | |
\newtoggle{bbx:articletitle} | |
\DeclareBibliographyOption{articletitle}[true]{% | |
\settoggle{bbx:articletitle}{#1}% | |
} | |
% Alter settings that carry through from biblatex | |
\ExecuteBibliographyOptions{ | |
articletitle = true , | |
doi = true , | |
giveninits , | |
maxnames = 6 , | |
maxcitenames = 2 , | |
urldate = year , | |
useprefix , | |
} | |
% Modify the name format | |
\DeclareNameFormat{default}{% | |
\nameparts{#1}% | |
\usebibmacro{name:given-family} | |
{\namepartfamily} | |
{\namepartgiveni} | |
{\namepartprefix} | |
{\namepartsuffix}% | |
\usebibmacro{name:andothers}% | |
} | |
\renewbibmacro*{name:andothers}{% | |
\ifboolexpr{ | |
test {\ifnumequal{\value{listcount}}{\value{liststop}}} | |
and | |
test \ifmorenames | |
} | |
{% | |
\ifnumgreater{\value{liststop}}{1} | |
{\finalandcomma} | |
{}% | |
\andothersdelim | |
\bibstring[\mkbibemph]{andothers}% | |
} | |
{}% | |
} | |
% Field formats for the bibliography environment | |
\DeclareFieldFormat{labelnumberwidth}{#1\adddot} | |
% Custom field formats | |
\DeclareFieldFormat{edition}{% | |
\ifinteger{#1} | |
{\bibstring{edition}~#1} | |
{#1}% | |
} | |
\DeclareFieldFormat[inproceedings]{booktitle}{#1} | |
\DeclareFieldFormat{doi}{% | |
DOI\space | |
\ifhyperref | |
{\href{http://dx.doi.org/#1}{\nolinkurl{#1}}} | |
{\nolinkurl{#1}}% | |
} | |
\DeclareFieldFormat[article]{pages}{#1} | |
\DeclareFieldFormat[proceedings]{title}{#1} | |
\DeclareFieldFormat[article]{title}{#1\adddot\space\nopunct} | |
\DeclareFieldFormat[report]{title}{\mkbibquote{#1}} | |
\DeclareFieldFormat{url}{\url{#1}} | |
\DeclareFieldFormat{urldate}{#1} | |
\DeclareFieldFormat[article,periodical]{volume}{\mkbibbold{#1}} | |
% Simple modifications to punctuation, etc. | |
\renewcommand*{\finalnamedelim}{% | |
\ifcurrentname{labelname} | |
{% | |
\ifnumgreater{\value{liststop}}{2} | |
{\finalandcomma} | |
{}% | |
\addspace | |
\bibstring{and}% | |
\space | |
} | |
{\multinamedelim}% | |
} | |
\renewcommand*\intitlepunct{\addspace} | |
\renewcommand*\newunitpunct{\addcomma\space} | |
% Bibliography strings | |
\NewBibliographyString{presentedat} | |
\DefineBibliographyStrings{english}{ | |
editor = Ed\adddot , | |
editors = Eds\adddot , | |
patentus = US Patent , | |
presentedat = presented at the\addspace , | |
} | |
% Bibliography macros | |
\renewbibmacro*{event+venue+date}{% | |
\printfield{eventtitle}% | |
\ifboolexpr{ | |
test {\iffieldundef{venue}} | |
and | |
test {\iffieldundef{eventyear}} | |
} | |
{} | |
{% | |
\printfield{venue}% | |
\newunit | |
\iffieldundef{eventyear} | |
{% | |
\printdate | |
\clearfield{year}% | |
} | |
{% | |
\printeventdate | |
\clearfield{eventyear}% | |
}% | |
}% | |
\newunit | |
} | |
\renewbibmacro*{institution+location+date}{% | |
\ifboolexpr{ | |
test {\iflistundef{institution}} | |
and | |
test {\iflistundef{location}} | |
and | |
test {\iffieldundef{edition}} | |
and | |
test {\iffieldundef{date}} | |
} | |
{} | |
{% | |
\nopunct | |
\printtext[parens]{% | |
\printlist{institution}% | |
\newunit | |
\printlist{location}% | |
\newunit | |
\printfield{edition}% | |
\newunit | |
\usebibmacro{date}% | |
}% | |
}% | |
} | |
\renewbibmacro*{journal+issuetitle}{% | |
\usebibmacro{journal}% | |
\setunit*{\addspace}% | |
\iffieldundef{series} | |
{} | |
{% | |
\newunit | |
\printfield{series}% | |
\setunit{\addspace}% | |
}% | |
\printfield{volume}% | |
\newunit | |
\usebibmacro{issue}% | |
\newunit | |
} | |
\renewbibmacro*{publisher+location+date}{% | |
\ifboolexpr{ | |
test {\iflistundef{publisher}} | |
and | |
test {\iflistundef{location}} | |
and | |
test {\iffieldundef{edition}} | |
and | |
test {\iffieldundef{date}} | |
} | |
{} | |
{% | |
\nopunct | |
\printtext[parens]{% | |
\printlist{publisher}% | |
\newunit | |
\printlist{location}% | |
\newunit | |
\printfield{edition}% | |
\newunit | |
\usebibmacro{date}% | |
}% | |
}% | |
} | |
\renewbibmacro*{url+urldate}{% | |
\iffieldundef{url} | |
{} | |
{% | |
\printtext[parens]{% | |
\usebibmacro{urldate}% | |
\setunit*{\addsemicolon\space}% | |
\usebibmacro{url}% | |
}}} | |
% New bibliography drivers, using the required order of fields. These | |
% are mainly copied from standard.bbx then modified. | |
\DeclareBibliographyDriver{article}{% | |
\usebibmacro{bibindex}% | |
\usebibmacro{begentry}% | |
\usebibmacro{author/translator+others}% | |
\setunit{\labelnamepunct}\newblock | |
\iftoggle{bbx:articletitle} | |
{\usebibmacro{title}} | |
{}% | |
\newunit | |
\printlist{language}% | |
\newunit\newblock | |
\usebibmacro{byauthor}% | |
\newunit\newblock | |
\usebibmacro{bytranslator+others}% | |
\newunit\newblock | |
\printfield{version}% | |
\newunit\newblock | |
\usebibmacro{journal+issuetitle}% | |
\newunit | |
\usebibmacro{byeditor+others}% | |
\newunit | |
\usebibmacro{note+pages}% | |
\newunit | |
\iftoggle{bbx:isbn} | |
{\printfield{issn}} | |
{}% | |
\newunit\newblock | |
\usebibmacro{doi+eprint+url}% | |
\setunit{\addspace}\newblock | |
\iffieldundef{year} | |
{\printfield{howpublished}} | |
{\usebibmacro{issue+date}}% | |
\newunit\newblock | |
\usebibmacro{addendum+pubstate}% | |
\setunit{\bibpagerefpunct}\newblock | |
\usebibmacro{pageref}% | |
\newunit\newblock | |
\iftoggle{bbx:related} | |
{\usebibmacro{related:init}% | |
\usebibmacro{related}} | |
{}% | |
\usebibmacro{finentry}% | |
} | |
\DeclareBibliographyDriver{book}{% | |
\usebibmacro{bibindex}% | |
\usebibmacro{begentry}% | |
\usebibmacro{author/editor+others/translator+others}% | |
\setunit{\labelnamepunct}\newblock | |
\usebibmacro{maintitle+title}% | |
\newunit | |
\printlist{language}% | |
\newunit\newblock | |
\usebibmacro{byauthor}% | |
\newunit\newblock | |
\usebibmacro{byeditor+others}% | |
\newunit\newblock | |
\printfield{volumes}% | |
\newunit\newblock | |
\newunit\newblock | |
\printfield{note}% | |
\newunit\newblock | |
\usebibmacro{publisher+location+date}% | |
\newunit\newblock | |
\printfield{volume} | |
\newunit | |
\usebibmacro{chapter+pages}% | |
\newunit | |
\printfield{pagetotal}% | |
\newunit\newblock | |
\iftoggle{bbx:isbn} | |
{\printfield{isbn}} | |
{}% | |
\newunit\newblock | |
\usebibmacro{doi+eprint+url}% | |
\newunit\newblock | |
\usebibmacro{addendum+pubstate}% | |
\setunit{\bibpagerefpunct}\newblock | |
\usebibmacro{pageref}% | |
\newunit\newblock | |
\iftoggle{bbx:related} | |
{\usebibmacro{related:init}% | |
\usebibmacro{related}} | |
{}% | |
\usebibmacro{finentry}% | |
} | |
\DeclareBibliographyDriver{collection}{% | |
\usebibmacro{bibindex}% | |
\usebibmacro{begentry}% | |
\usebibmacro{editor+others}% | |
\setunit{\labelnamepunct}\newblock | |
\usebibmacro{maintitle+title}% | |
\newunit | |
\printlist{language}% | |
\newunit\newblock | |
\usebibmacro{byeditor+others}% | |
\newunit\newblock | |
\printfield{volumes}% | |
\newunit\newblock | |
\printfield{note}% | |
\newunit\newblock | |
\usebibmacro{publisher+location+date}% | |
\newunit\newblock | |
\printfield{volume} | |
\newunit | |
\usebibmacro{chapter+pages}% | |
\newunit | |
\printfield{pagetotal}% | |
\newunit\newblock | |
\iftoggle{bbx:isbn} | |
{\printfield{isbn}} | |
{}% | |
\newunit\newblock | |
\usebibmacro{doi+eprint+url}% | |
\newunit\newblock | |
\usebibmacro{addendum+pubstate}% | |
\setunit{\bibpagerefpunct}\newblock | |
\usebibmacro{pageref}% | |
\newunit\newblock | |
\iftoggle{bbx:related} | |
{\usebibmacro{related:init}% | |
\usebibmacro{related}} | |
{}% | |
\usebibmacro{finentry}% | |
} | |
\DeclareBibliographyDriver{inbook}{% | |
\usebibmacro{bibindex}% | |
\usebibmacro{begentry}% | |
\usebibmacro{author/translator+others}% | |
\setunit{\labelnamepunct}\newblock | |
\printlist{language}% | |
\newunit\newblock | |
\usebibmacro{byauthor}% | |
\newunit\newblock | |
\usebibmacro{in:}% | |
\usebibmacro{bybookauthor}% | |
\setunit*{\newunitpunct}\newblock | |
\usebibmacro{maintitle+booktitle}% | |
\newunit\newblock | |
\usebibmacro{byeditor+others}% | |
\newunit\newblock | |
\printfield{volumes}% | |
\newunit\newblock | |
\printfield{note}% | |
\newunit\newblock | |
\usebibmacro{publisher+location+date}% | |
\newunit\newblock | |
\printfield{volume} | |
\newunit | |
\usebibmacro{chapter+pages}% | |
\newunit\newblock | |
\iftoggle{bbx:isbn} | |
{\printfield{isbn}} | |
{}% | |
\newunit\newblock | |
\usebibmacro{doi+eprint+url}% | |
\newunit\newblock | |
\usebibmacro{addendum+pubstate}% | |
\setunit{\bibpagerefpunct}\newblock | |
\usebibmacro{pageref}% | |
\newunit\newblock | |
\iftoggle{bbx:related} | |
{\usebibmacro{related:init}% | |
\usebibmacro{related}} | |
{}% | |
\usebibmacro{finentry}% | |
} | |
\DeclareBibliographyDriver{incollection}{% | |
\usebibmacro{bibindex}% | |
\usebibmacro{begentry}% | |
\usebibmacro{author/translator+others}% | |
\setunit{\labelnamepunct}\newblock | |
\printlist{language}% | |
\newunit\newblock | |
\usebibmacro{byauthor}% | |
\newunit\newblock | |
\usebibmacro{in:}% | |
\usebibmacro{maintitle+booktitle}% | |
\newunit\newblock | |
\usebibmacro{byeditor+others}% | |
\newunit\newblock | |
\printfield{volumes}% | |
\newunit\newblock | |
\printfield{note}% | |
\newunit\newblock | |
\usebibmacro{publisher+location+date}% | |
\newunit\newblock | |
\printfield{volume} | |
\newunit | |
\usebibmacro{chapter+pages}% | |
\newunit\newblock | |
\iftoggle{bbx:isbn} | |
{\printfield{isbn}} | |
{}% | |
\newunit\newblock | |
\usebibmacro{doi+eprint+url}% | |
\newunit\newblock | |
\usebibmacro{addendum+pubstate}% | |
\setunit{\bibpagerefpunct}\newblock | |
\usebibmacro{pageref}% | |
\newunit\newblock | |
\iftoggle{bbx:related} | |
{\usebibmacro{related:init}% | |
\usebibmacro{related}} | |
{}% | |
\usebibmacro{finentry}% | |
} | |
\DeclareBibliographyDriver{inproceedings}{% | |
\usebibmacro{bibindex}% | |
\usebibmacro{begentry}% | |
\usebibmacro{author/translator+others}% | |
\setunit{\labelnamepunct}\newblock | |
\printlist{language}% | |
\newunit\newblock | |
\usebibmacro{byauthor}% | |
\newunit\newblock | |
\bibstring{presentedat}% | |
\usebibmacro{maintitle+booktitle}% | |
\newunit\newblock | |
\usebibmacro{byeditor+others}% | |
\newunit\newblock | |
\iffieldundef{maintitle} | |
{\printfield{volume}% | |
\printfield{part}} | |
{}% | |
\newunit | |
\printfield{volumes}% | |
\newunit\newblock | |
\printfield{note}% | |
\newunit\newblock | |
\usebibmacro{event+venue+date}% | |
\newunit\newblock | |
\usebibmacro{chapter+pages}% | |
\newunit\newblock | |
\iftoggle{bbx:isbn} | |
{\printfield{isbn}} | |
{}% | |
\newunit\newblock | |
\usebibmacro{doi+eprint+url}% | |
\newunit\newblock | |
\usebibmacro{addendum+pubstate}% | |
\setunit{\bibpagerefpunct}\newblock | |
\usebibmacro{pageref}% | |
\newunit\newblock | |
\iftoggle{bbx:related} | |
{\usebibmacro{related:init}% | |
\usebibmacro{related}} | |
{}% | |
\usebibmacro{finentry}% | |
} | |
\DeclareBibliographyDriver{online}{% | |
\usebibmacro{bibindex}% | |
\usebibmacro{begentry}% | |
\usebibmacro{author/editor+others/translator+others}% | |
\setunit{\labelnamepunct}\newblock | |
\usebibmacro{title}% | |
\newunit | |
\printlist{language}% | |
\newunit\newblock | |
\usebibmacro{byauthor}% | |
\newunit\newblock | |
\usebibmacro{byeditor+others}% | |
\newunit\newblock | |
\printfield{version}% | |
\newunit | |
\printfield{note}% | |
\newunit\newblock | |
\printlist{organization}% | |
\newunit\newblock | |
\iftoggle{bbx:eprint} | |
{\usebibmacro{eprint}} | |
{}% | |
\nopunct | |
\usebibmacro{url+urldate}% | |
\newunit\newblock | |
\usebibmacro{addendum+pubstate}% | |
\setunit{\bibpagerefpunct}\newblock | |
\usebibmacro{pageref}% | |
\newunit\newblock | |
\usebibmacro{related}% | |
\usebibmacro{finentry}% | |
} | |
\DeclareBibliographyDriver{patent}{% | |
\usebibmacro{bibindex}% | |
\usebibmacro{begentry}% | |
\usebibmacro{author}% | |
\setunit{\labelnamepunct}\newblock | |
\printlist{language}% | |
\newunit\newblock | |
\usebibmacro{byauthor}% | |
\newunit\newblock | |
\printfield{type}% | |
\newunit | |
\printfield{number}% | |
\iflistundef{location} | |
{} | |
{\setunit*{\addspace}% | |
\printtext[parens]{% | |
\printlist[][-\value{listtotal}]{location}}}% | |
\newunit\newblock | |
\printfield{note}% | |
\newunit\newblock | |
\usebibmacro{doi+eprint+url}% | |
\newunit | |
\nopunct | |
\printfield[parens]{year}% | |
\newunit\newblock | |
\usebibmacro{addendum+pubstate}% | |
\setunit{\bibpagerefpunct}\newblock | |
\usebibmacro{pageref}% | |
\newunit\newblock | |
\iftoggle{bbx:related} | |
{\usebibmacro{related:init}% | |
\usebibmacro{related}} | |
{}% | |
\usebibmacro{finentry}% | |
} | |
\DeclareBibliographyDriver{periodical}{% | |
\usebibmacro{bibindex}% | |
\usebibmacro{begentry}% | |
\printfield{issuetitle}% | |
\newunit | |
\usebibmacro{author/editor+others/translator+others}% | |
\setunit{\labelnamepunct}\newblock | |
\usebibmacro{maintitle+title}% | |
\newunit | |
\printlist{language}% | |
\newunit\newblock | |
\usebibmacro{byauthor}% | |
\newunit\newblock | |
\usebibmacro{byeditor+others}% | |
\newunit\newblock | |
\printfield{volumes}% | |
\newunit\newblock | |
\newunit\newblock | |
\printfield{note}% | |
\newunit\newblock | |
\usebibmacro{publisher+location+date}% | |
\newunit\newblock | |
\printfield{volume} | |
\newunit | |
\usebibmacro{chapter+pages}% | |
\newunit | |
\printfield{pagetotal}% | |
\newunit\newblock | |
\iftoggle{bbx:isbn} | |
{\printfield{isbn}} | |
{}% | |
\newunit\newblock | |
\usebibmacro{addendum+pubstate}% | |
\setunit{\bibpagerefpunct}\newblock | |
\usebibmacro{pageref}% | |
\newunit\newblock | |
\iftoggle{bbx:related} | |
{\usebibmacro{related:init}% | |
\usebibmacro{related}} | |
{}% | |
\usebibmacro{finentry}% | |
} | |
\DeclareBibliographyDriver{thesis}{% | |
\usebibmacro{bibindex}% | |
\usebibmacro{begentry}% | |
\usebibmacro{author}% | |
\setunit{\labelnamepunct}\newblock | |
\printlist{language}% | |
\newunit\newblock | |
\usebibmacro{byauthor}% | |
\newunit\newblock | |
\printfield{note}% | |
\newunit\newblock | |
\printfield{type}% | |
\newunit\newblock | |
\printlist{institution}% | |
\newunit | |
\printdate | |
\newunit\newblock | |
\usebibmacro{chapter+pages}% | |
\newunit | |
\printfield{pagetotal}% | |
\newunit\newblock | |
\usebibmacro{doi+eprint+url}% | |
\newunit\newblock | |
\usebibmacro{addendum+pubstate}% | |
\setunit{\bibpagerefpunct}\newblock | |
\usebibmacro{pageref}% | |
\newunit\newblock | |
\iftoggle{bbx:related} | |
{\usebibmacro{related:init}% | |
\usebibmacro{related}} | |
{}% | |
\usebibmacro{finentry}% | |
} | |
%% End of file `pnas.bbx'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% --------------------------------------------------------------- | |
%% biblatex-pnas --- A biblatex implementation | |
%% of the PNAS bibliography style | |
%% Version: 2020-02-22 | |
%% --------------------------------------------------------------- | |
%% | |
\ProvidesFile{pnas.cbx} | |
[\abx@cbxid] | |
\ExecuteBibliographyOptions{labelnumber,sortcites,autocite=inline} | |
\renewcommand*{\multicitedelim}{\addcomma\space} | |
\renewcommand*{\iffinalcitedelim}{% | |
\ifnumequal{\value{textcitecount}}{\value{textcitetotal}-1}} | |
\providebool{bbx:subentry} | |
\newbool{cbx:parens} | |
\newcounter{cbx@tempcnta} | |
\newcounter{cbx@tempcntb} | |
\DeclareFieldFormat{entrysetcount}{\mknumalph{#1}} | |
\newbibmacro*{cite:init}{% | |
\global\boolfalse{cbx:parens}% | |
\global\undef\cbx@lasthash | |
\global\undef\cbx@lastnumber | |
\global\undef\cbx@lastprefix | |
\setcounter{cbx@tempcnta}{0}% | |
\setcounter{cbx@tempcntb}{-2}} | |
\newbibmacro*{cite:comp}{% | |
\addtocounter{cbx@tempcntb}{1}% | |
\iffieldundef{shorthand} | |
{\ifbool{bbx:subentry} | |
{\iffieldundef{entrysetcount} | |
{\usebibmacro{cite:comp:comp}} | |
{\usebibmacro{cite:comp:inset}}} | |
{\usebibmacro{cite:comp:comp}}} | |
{\usebibmacro{cite:comp:shand}}} | |
\newbibmacro*{cite:comp:comp}{% | |
\ifboolexpr{ | |
( test {\iffieldundef{labelprefix}} and test {\ifundef\cbx@lastprefix} ) | |
or | |
test {\iffieldequals{labelprefix}{\cbx@lastprefix}} | |
} | |
{\ifnumequal{\thefield{labelnumber}}{\value{cbx@tempcntb}} | |
{\savefield{entrykey}{\cbx@lastkey}% | |
\savefield{labelnumber}{\cbx@lastnumber}% | |
\addtocounter{cbx@tempcnta}{1}} | |
{\ifnumequal{\thefield{labelnumber}}{\value{cbx@tempcntb}-1} | |
{} | |
{\usebibmacro{cite:dump}% | |
\ifnumgreater{\value{cbx@tempcntb}}{-1} | |
{\multicitedelim} | |
{}% | |
\printtext[bibhyperref]{% | |
\printfield{labelprefix}% | |
\printfield{labelnumber}}}}} | |
{\usebibmacro{cite:comp:end}}% | |
\setcounter{cbx@tempcntb}{\thefield{labelnumber}}% | |
\savefield{labelprefix}{\cbx@lastprefix}} | |
\newbibmacro*{cite:comp:end}{% | |
\usebibmacro{cite:dump}% | |
\ifnumgreater{\value{cbx@tempcntb}}{-1} | |
{\multicitedelim} | |
{}% | |
\printtext[bibhyperref]{% | |
\printfield{labelprefix}% | |
\printfield{labelnumber}}} | |
\newbibmacro*{cite:comp:inset}{% | |
\usebibmacro{cite:dump}% | |
\ifnumgreater{\value{cbx@tempcntb}}{-1} | |
{\multicitedelim} | |
{}% | |
\printtext[bibhyperref]{% | |
\printfield{labelprefix}% | |
\printfield{labelnumber}% | |
\printfield{entrysetcount}}% | |
\setcounter{cbx@tempcntb}{-1}} | |
\newbibmacro*{cite:comp:shand}{% | |
\usebibmacro{cite:dump}% | |
\ifnumgreater{\value{cbx@tempcntb}}{-1} | |
{\multicitedelim} | |
{}% | |
\printtext[bibhyperref]{\printfield{shorthand}}% | |
\setcounter{cbx@tempcntb}{-1}} | |
\newbibmacro*{cite:dump}{% | |
\ifnumgreater{\value{cbx@tempcnta}}{0} | |
{\ifnumgreater{\value{cbx@tempcnta}}{1} | |
{\bibrangedash} | |
{\multicitedelim}% | |
\bibhyperref[\cbx@lastkey]{% | |
\ifdef\cbx@lastprefix | |
{\printtext[labelprefix]{\cbx@lastprefix}} | |
{}% | |
\printtext[labelnumber]{\cbx@lastnumber}}} | |
{}% | |
\setcounter{cbx@tempcnta}{0}% | |
\global\undef\cbx@lastprefix} | |
\newbibmacro*{textcite}{% | |
\iffieldequals{namehash}{\cbx@lasthash} | |
{\usebibmacro{cite:comp}} | |
{\usebibmacro{cite:dump}% | |
\ifbool{cbx:parens} | |
{\printtext{\bibclosebracket}\global\boolfalse{cbx:parens}} | |
{}% | |
\iffirstcitekey | |
{} | |
{\textcitedelim}% | |
\usebibmacro{cite:init}% | |
\ifnameundef{labelname} | |
{\printfield[citetitle]{labeltitle}} | |
{\printnames{labelname}}% | |
\setunit*{\printdelim{namelabeldelim}}% | |
\printtext{\bibopenbracket}\global\booltrue{cbx:parens}% | |
\ifnumequal{\value{citecount}}{1} | |
{\usebibmacro{prenote}} | |
{}% | |
\usebibmacro{cite:comp}% | |
\stepcounter{textcitecount}% | |
\savefield{namehash}{\cbx@lasthash}}} | |
\DeclareCiteCommand{\cite}[\mkbibparens] | |
{\usebibmacro{cite:init}% | |
\usebibmacro{prenote}} | |
{\usebibmacro{citeindex}% | |
\usebibmacro{cite:comp}} | |
{} | |
{\usebibmacro{cite:dump}% | |
\usebibmacro{postnote}} | |
\DeclareCiteCommand{\parencite}[\mkbibparens] | |
{\usebibmacro{cite:init}% | |
\usebibmacro{prenote}} | |
{\usebibmacro{citeindex}% | |
\usebibmacro{cite:comp}} | |
{} | |
{\usebibmacro{cite:dump}% | |
\usebibmacro{postnote}} | |
\DeclareCiteCommand{\footcite}[\mkbibfootnote] | |
{\usebibmacro{cite:init}% | |
\usebibmacro{prenote}} | |
{\usebibmacro{citeindex}% | |
\usebibmacro{cite:comp}} | |
{} | |
{\usebibmacro{cite:dump}% | |
\usebibmacro{postnote}} | |
\DeclareCiteCommand{\footcitetext}[\mkbibfootnotetext] | |
{\usebibmacro{cite:init}% | |
\usebibmacro{prenote}} | |
{\usebibmacro{citeindex}% | |
\usebibmacro{cite:comp}} | |
{} | |
{\usebibmacro{cite:dump}% | |
\usebibmacro{postnote}} | |
\DeclareCiteCommand{\smartcite}[\iffootnote\mkbibparens\mkbibfootnote] | |
{\usebibmacro{cite:init}% | |
\usebibmacro{prenote}} | |
{\usebibmacro{citeindex}% | |
\usebibmacro{cite:comp}} | |
{} | |
{\usebibmacro{cite:dump}% | |
\usebibmacro{postnote}} | |
\DeclareCiteCommand{\supercite}[\mkbibsuperscript] | |
{\usebibmacro{cite:init}% | |
\let\multicitedelim=\supercitedelim | |
\iffieldundef{prenote} | |
{} | |
{\BibliographyWarning{Ignoring prenote argument}}% | |
\iffieldundef{postnote} | |
{} | |
{\BibliographyWarning{Ignoring postnote argument}}} | |
{\usebibmacro{citeindex}% | |
\usebibmacro{cite:comp}} | |
{} | |
{\usebibmacro{cite:dump}} | |
\DeclareCiteCommand{\cbx@textcite} | |
{\usebibmacro{cite:init}} | |
{\usebibmacro{citeindex}% | |
\usebibmacro{textcite}} | |
{} | |
{\usebibmacro{cite:dump}% | |
\usebibmacro{postnote}% | |
\ifbool{cbx:parens} | |
{\bibclosebracket\global\boolfalse{cbx:parens}} | |
{}} | |
\DeclareCiteCommand{\textcite}[\cbx@textcite@init\cbx@textcite] | |
{\gdef\cbx@savedkeys{}% | |
\citetrackerfalse% | |
\pagetrackerfalse% | |
\DeferNextCitekeyHook% | |
\usebibmacro{cite:init}} | |
{\ifthenelse{\iffirstcitekey\AND\value{multicitetotal}>0} | |
{\protected@xappto\cbx@savedcites{()(\thefield{multipostnote})}% | |
\global\clearfield{multipostnote}} | |
{}% | |
\xappto\cbx@savedkeys{\thefield{entrykey},}% | |
\iffieldequals{namehash}{\cbx@lasthash} | |
{} | |
{\stepcounter{textcitetotal}% | |
\savefield{namehash}{\cbx@lasthash}}} | |
{} | |
{\protected@xappto\cbx@savedcites{% | |
[\thefield{prenote}][\thefield{postnote}]{\cbx@savedkeys}}} | |
% textcite has nested \DeclareCiteCommand definitions for textcite and we want to use | |
% the normal textcite context | |
\DeclareDelimcontextAlias{cbx@textcite}{textcite} | |
\newrobustcmd{\cbx@textcite@init}[2]{% | |
\setcounter{textcitetotal}{0}% | |
\setcounter{textcitecount}{0}% | |
\def\cbx@savedcites{#1}#2\cbx@savedcites\empty} | |
\DeclareMultiCiteCommand{\cbx@textcites}{\cbx@textcite}{} | |
\DeclareMultiCiteCommand{\textcites}[\cbx@textcites@init\cbx@textcites]{\textcite}{} | |
\let\cbx@textcites@init\cbx@textcite@init | |
\pretocmd{\cbx@textcites@init}{\UseNextMultiCiteHook}{}{} | |
\DeclareMultiCiteCommand{\cites}[\mkbibbrackets]{\cite}{\multicitedelim} | |
\DeclareMultiCiteCommand{\parencites}[\mkbibbrackets]{\parencite}{\multicitedelim} | |
\DeclareMultiCiteCommand{\smartcites}[\iffootnote\mkbibbrackets\mkbibfootnote] | |
{\smartcite}{\multicitedelim} | |
\endinput |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment