diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/windycity/bbx/windycity.bbx')
-rw-r--r-- | Master/texmf-dist/doc/latex/windycity/bbx/windycity.bbx | 2026 |
1 files changed, 2026 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/windycity/bbx/windycity.bbx b/Master/texmf-dist/doc/latex/windycity/bbx/windycity.bbx new file mode 100644 index 00000000000..5064b082254 --- /dev/null +++ b/Master/texmf-dist/doc/latex/windycity/bbx/windycity.bbx @@ -0,0 +1,2026 @@ +% Last modified: Thu 31 Jan 2019 08:28:54 PM CST + +% Copyright (c) 2019 Brian Michael Chase. +% +% Permission is granted to copy, distribute and/or modify this +% software under the terms of the LaTeX Project Public License (LPPL), +% version 1.3. +% +% The LPPL maintenance status of this software is 'author-maintained'. +% +% This software is provided 'as is', without warranty of any kind, +% either expressed or implied, including, but not limited to, the +% implied warranties of merchantability and fitness for a particular +% purpose. + +\ProvidesFile{windycity.bbx}[Windy City style for biblatex] + +\@ifpackagelater{biblatex}{2017/11/04} + {} + {\PackageError{biblatex} + {Outdated 'biblatex' package} + {Windy City 2019.01.31 is for biblatex v3.8 and above.\MessageBreak + You are using: '\csuse{ver@biblatex.sty}'.\MessageBreak + This is a fatal error. I'm aborting now.}% + \endinput}% +\RequireBiber + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Bibliography and Entry Options %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\providetoggle{anonauth} +\DeclareEntryOption{anonauth}[true]{% + \ifstrequal{#1}{true} + {\renewcommand*{\anona}{\bibopenbracket}% + \renewcommand*{\anonb}{\bibclosebracket}}% + {}} + +\providetoggle{anonqauth} +\DeclareEntryOption{anonqauth}[true]{% + \ifstrequal{#1}{true} + {\renewcommand*{\anona}{\bibopenbracket}% + \renewcommand*{\anonb}{\addquestion\bibclosebracket}}% + {}} + +\providetoggle{annotate} +\DeclareBibliographyOption{annotate}[true]{% + \ifstrequal{#1}{true} + {\global\toggletrue{annotate}}% + {\global\togglefalse{annotate}}} + +\DeclareBibliographyOption{collsonly}[true]{% + \ifstrequal{#1}{true} + {\ExecuteBibliographyOptions{mincrossrefs=1}% + \ExecuteBibliographyOptions{minxrefs=1}% + \AtBeginBibliography{\blx@key@bibcheck{collsonly}}} + {}} + +\providetoggle{firstshort} +\DeclareBibliographyOption{firstshort}[true]{% + \ifstrequal{#1}{true} + {\global\toggletrue{firstshort}}% + {\global\togglefalse{firstshort}}} + +\providetoggle{ibid} +\DeclareBibliographyOption{ibid}[true]{% + \ifstrequal{#1}{true} + {\global\toggletrue{ibid}% + \global\toggletrue{short}}% + {\global\togglefalse{ibid}}} + +\providetoggle{isbn} +\DeclareBibliographyOption{isbn}[true]{% + \ifstrequal{#1}{true} + {\global\toggletrue{isbn}}% + {\global\togglefalse{isbn}}} +\DeclareEntryOption{isbn}[true]{% + \ifstrequal{#1}{true} + {\toggletrue{isbn}}% + {\togglefalse{isbn}}} + +\providetoggle{listvols} +\DeclareEntryOption{listvols}[true]{% + \ifstrequal{#1}{true} + {\toggletrue{listvols}}% + {\togglefalse{listvols}}} + +\providetoggle{noauth} +\DeclareEntryOption{noauth}[true]{% + \ifstrequal{#1}{true} + {\toggletrue{noauth}}% + {\togglefalse{noauth}}} + +\DeclareBibliographyOption{nolos}[true]{% + \ifstrequal{#1}{true} + {\AtBeginBibliography{\blx@key@bibcheck{nolos}}} + {}} + +\providetoggle{reflist} +\DeclareBibliographyOption{reflist}[true]{% + \ifstrequal{#1}{true} + {\global\toggletrue{reflist}% + \DeclareLabeldate{% + \field{date} + \field{year} + \field{origdate} + \field{urldate} + \literal{nodate}} + \ExecuteBibliographyOptions{% + autocite=inline, + sorting=nyt}}% + {\global\togglefalse{reflist}% + \ExecuteBibliographyOptions{% + autocite=footnote, + sorting=nty}}} + +\providetoggle{short} +\DeclareBibliographyOption{short}[true]{% + \ifstrequal{#1}{true} + {\global\toggletrue{short}% + \global\toggletrue{firstshort}}% + {\global\togglefalse{short}}} + +\providetoggle{skipdate} +\DeclareEntryOption{skipdate}[true]{% + \ifstrequal{#1}{true} + {\toggletrue{skipdate}}% + {\togglefalse{skipdate}}} + +\providetoggle{swapauth} +\DeclareEntryOption{swapauth}[true]{% + \ifstrequal{#1}{true} + {\toggletrue{swapauth}}% + {\togglefalse{swapauth}}} + +\providetoggle{swaptrans} +\DeclareEntryOption{swaptrans}[true]{% + \ifstrequal{#1}{true} + {\toggletrue{swaptrans}}% + {\togglefalse{swaptrans}}} + +\providetoggle{swapvol} +\DeclareBibliographyOption{swapvol}[true]{% + \ifstrequal{#1}{true} + {\global\toggletrue{swapvol}}% + {\global\togglefalse{swapvol}}} +\DeclareEntryOption{swapvol}[true]{% + \ifstrequal{#1}{true} + {\toggletrue{swapvol}}% + {\togglefalse{swapvol}}} + +% For setting 'minbibnames' and such, see CMS, 17th ed., 14.76 and +% 15.29. + +\ExecuteBibliographyOptions{% + abbreviate=true, + autopunct=true, + block=none, + citetracker=constrict, + date=long, + dateabbrev=false, + dateusetime=true, + ibidtracker=constrict, +% Just one use of '\ifciteidem'. See note in windycity.cbx. + idemtracker=false, + indexing=true, + labeldateparts=true, + loccittracker=constrict, + minbibnames=7, + maxbibnames=10, + mincitenames=1, + maxcitenames=3, +% Remember, if 'mincrossrefs' is greater than 1, and you cite just one +% entrykey in a document (or refsection, etc), the field 'crossref' is +% undefined. + mincrossrefs=2, + minxrefs=2, + pagetracker=page, + parentracker=true, + sortcites=false, + time=12h, + timezones=true, + uniquelist=minyear, + uniquename=minfull, + urldate=long, + useeditor=true, + useprefix=false, + usetranslator=true} + +\DeclareLanguageMapping{english}{american-windycity} +\DeclareLabeldate{% 'reflist' preamble option loads an alternative + \field{bookyear} + \field{date} + \field{year} + \field{origdate} + \field{urldate} + \literal{nodate}} +\DeclareLabelname{% + \field{author} + \field{editor} + \field{translator} + \field{editora} + \field{translatora}} +\DeclareLabelname[inbook,incollection]{% + \field{author} + \field{bookauthor} + \field{editor} + \field{translator} + \field{editora} + \field{translatora}} +\DeclareSortingTemplate{nty}{% + \sort{\field{presort}} + \sort[final]{\field{sortkey}} + \sort{% + \field{sortname} + \field{author} + \field{bookauthor} + \field{editor} + \field{translator} + \field{editora} + \field{sorttitle} + \field{title} + \field{booktitle} + \field{bookbooktitle} + \field{blogtitle} + \field{journaltitle}} + \sort{% + \field{sorttitle} + \field{title} + \field{booktitle} + \field{bookbooktitle} + \field{blogtitle} + \field{journaltitle}} + \sort{% + \field{sortyear} + \field{year} + \field{labelyear}} + \sort{% + \field[padside=left,padwidth=4,padchar=0]{volume} + \literal{0000}}} +\DeclareSortingTemplate{nyt}{% + \sort{\field{presort}} + \sort[final]{\field{sortkey}} + \sort{% + \field{sortname} + \field{author} + \field{bookauthor} + \field{editor} + \field{translator} + \field{editora} + \field{sorttitle} + \field{title} + \field{booktitle} + \field{bookbooktitle} + \field{blogtitle} + \field{journaltitle}} + \sort{% + \field{sortyear} + \field{origyear} + \field{labelyear} + \field{year}} + \sort{% + \field{sorttitle} + \field{title} + \field{booktitle} + \field{bookbooktitle} + \field{blogtitle} + \field{journaltitle}} + \sort{% + \field[padside=left,padwidth=4,padchar=0]{volume} + \literal{0000}}} + +\defbibcheck{collsonly}{% + \ifboolexpr{ test {\ifentrytype{bookinbook}} + or test {\ifentrytype{inbook}}} + {\iffieldundef{crossref} + {} + {\skipentry}}% + {\ifentrytype{incollection} + {\iffieldundef{crossref} + {} + {\iffieldundef{chapter} + {} + {\skipentry}}}}} +\defbibcheck{nolos}{% + \iffieldundef{shorthand} + {} + {\skipentry}}% +\defbibcheck{reference}{% + \ifentrytype{reference} + {\skipentry}% + {\ifentrytype{inreference} + {\skipentry}% + {}}} + +%%%%%%%%%%%%%%%%%%%%%%%% +%% Data Inheritance %% +%%%%%%%%%%%%%%%%%%%%%%%% + +\DefaultInheritance[\except{*}{review}{all=false}]{all=true,override=false} +\DeclareDataInheritance{*}{% + incollection,inbook,bookinbook,inproceedings,letter,suppbook,review}{% + \inherit{author}{bookauthor} + \inherit{shortauthor}{shortbookauthor} + \inherit{editor}{editora} + \inherit{editora}{editorb} + \inherit{editorb}{editorc} + \inherit{editortype}{editoratype} + \inherit{editoratype}{editorbtype} + \inherit{editorbtype}{editorctype} + \inherit{translator}{translatora} + \inherit{title}{booktitle} + \inherit{subtitle}{booksubtitle} + \inherit{titleaddon}{booktitleaddon} + \inherit{shorttitle}{shortbooktitle} + \inherit{booktitle}{bookbooktitle} + \inherit{options}{options}} +\DeclareDataInheritance{collection}{collection,inbook,bookinbook}{% + \inherit{year}{bookyear} + \inherit{endyear}{endbookyear}} + +%%%%%%%%%%%%%%%%%%% +%% Preliminary %% +%%%%%%%%%%%%%%%%%%% + +\let\cbx@bibstring\empty +\let\cbx@deflabel\empty +\let\cbx@keyhash\empty +\let\cbx@namelist\empty +\let\anona\empty +\let\anonb\empty +\let\crossreflist\empty +\let\pluga\empty +\let\plugb\empty +\let\xeditor\empty +\let\yeditor\empty +\let\xtitle\empty + +\providetoggle{authposition} +\providetoggle{bibliography} +\providetoggle{collection} +\providetoggle{collection:book} +\providetoggle{collection:inbook} +\providetoggle{journalfirst} +\providetoggle{multicite} +\providetoggle{cbx@first} +\providetoggle{cbx@loccit} +\providetoggle{cbx@short} + +\providetoggle{edshift} +\providetoggle{noed} +\providetoggle{notrans} + +\newcommand*{\AtBeginLists}{% + \renewcommand*{\newunitpunct}{\addperiod\space}% + \let\bibstring\biblstring + \global\undef\bbx@lasthash + \blx@key@bibcheck{reference}}% + +\newcommand*{\AtEveryItem}{% + \global\toggletrue{authposition}% + \global\togglefalse{collection}% + \global\togglefalse{collection:book}% + \global\togglefalse{collection:inbook}% + \global\togglefalse{cbx@short}}% + +\AtBeginBibliography{\AtBeginLists}% +\AtBeginShorthands{\AtBeginLists}% +\AtEveryBibitem{% + \global\toggletrue{bibliography}% + \AtEveryItem}% +\AtEveryLositem{\AtEveryItem}% + +\defbibenvironment{reflist} + {\global\toggletrue{reflist}% + \list{}{% + \leftmargin\bibhang + \itemindent-\leftmargin + \itemsep\bibitemsep + \parsep\bibparsep}} + {\endlist + \global\togglefalse{reflist}}% + {\item} + +% Index names only. + +\renewbibmacro*{bibindex}{% + \ifbibindex + {\indexnames{labelname}}% + {}} + +\renewbibmacro*{citeindex}{% + \ifciteindex + {\indexnames{labelname}}% + {}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Field Formats for Names %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\DeclareNameAlias{author}{sortname} +\DeclareNameAlias{afterword}{sortname} +\DeclareNameAlias{bookauthor}{sortname} +\DeclareNameAlias{editor}{sortname} +\DeclareNameAlias{editora}{sortname} +\DeclareNameAlias{editorb}{sortname} +\DeclareNameAlias{editorc}{sortname} +\DeclareNameAlias{foreword}{sortname} +\DeclareNameAlias{introduction}{sortname} +\DeclareNameAlias{translator}{sortname} + +\DeclareIndexNameAlias{author}{default} +\DeclareIndexNameAlias{afterword}{default} +\DeclareIndexNameAlias{bookauthor}{default} +\DeclareIndexNameAlias{editor}{default} +\DeclareIndexNameAlias{editora}{default} +\DeclareIndexNameAlias{editorb}{default} +\DeclareIndexNameAlias{editorc}{default} +\DeclareIndexNameAlias{foreword}{default} +\DeclareIndexNameAlias{introduction}{default} +\DeclareIndexNameAlias{translator}{default} + +% Affixes like 'Jr.', should appear last, delimited with a comma, when +% inverted, as in a bibliography, but not otherwise, as in a note. See +% CMS, 17th ed., 6.43 and 16.41, as well as the example in 14.75. + +\renewbibmacro*{name:family-given}[4]{% + \ifuseprefix + {\usebibmacro{name:delim}{#3#1}% + \usebibmacro{name:hook}{#3#1}% + \ifdefvoid{#3}{}{% + \ifcapital + {\mkbibnameprefix{\MakeCapital{#3}}\isdot} + {\mkbibnameprefix{#3}\isdot}% + \ifprefchar{}{\bibnamedelimc}}% + \mkbibnamefamily{#1}\isdot + \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}% + \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{#2}\isdot}} + {\usebibmacro{name:delim}{#1}% + \usebibmacro{name:hook}{#1}% + \mkbibnamefamily{#1}\isdot + \ifboolexpe{% + test {\ifdefvoid{#2}} + and + test {\ifdefvoid{#3}}} + {} + {\revsdnamepunct}% + \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{#2}\isdot}% + \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% + \ifdefvoid{#4}{}{\revsdnamepunct\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}} + +\renewcommand*{\mkbibindexname}[4]{% + \ifuseprefix + {\ifdefvoid{#3}{}{#3 }% + \@firstofone #1% remove spurious braces + \ifdefvoid{#4}{}{ #4}% + \ifdefvoid{#2}{}{, #2}% + \actualoperator + \ifdefvoid{#3}{}{\MakeCapital{#3} }% + #1% + \ifdefvoid{#4}{}{ #4}% + \ifdefvoid{#2}{}{, #2}} + {\@firstofone #1% remove spurious braces + \ifboolexpe{% + test {\ifdefvoid{#2}} + and + test {\ifdefvoid{#3}}} + {} + {,}% + \ifdefvoid{#2}{}{ #2}% + \ifdefvoid{#3}{}{ #3}% + \ifdefvoid{#4}{}{, #4}}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Field Formats for Titles %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\DeclareFieldFormat{blogtitle}{\mkbibemph{#1}} +\DeclareFieldFormat{bookbooktitle}{\mkbibemph{#1}} +\DeclareFieldFormat{booktitle}{\mkbibemph{#1}} +\DeclareFieldFormat{journaltitle}{\mkbibemph{#1}} +\DeclareFieldFormat{labeltitle}{\mkbibemph{#1}} +\DeclareFieldFormat{maintitle}{\mkbibemph{#1}} +\DeclareFieldFormat{shortbooktitle}{\mkbibemph{#1}} +\DeclareFieldFormat{title}{\mkbibemph{#1}} + +\DeclareIndexFieldFormat{indextitle}{% + \usebibmacro{index:title}{\index}{\mkbibemph{#1}}} +\renewbibmacro*{index:title}[2]{% + \usebibmacro{index:field}{#1}{\thefield{indexsorttitle}}{#2}}% + +\DeclareFieldFormat{blogtitleaddon}{\mkbibparens{#1}} +\DeclareFieldFormat{titleaddon}{\mkbibbrackets{#1}} + +\DeclareFieldFormat[% + article,incollection,inreference,inproceedings,online,reference,review] + {title}{\mkbibquote{#1}} +\DeclareFieldFormat[% + article,incollection,inreference,inproceedings,online,reference,review] + {labeltitle}{\mkbibquote{#1}} +\DeclareIndexFieldFormat[% + article,incollection,inreference,inproceedings,online,reference,review] + {indextitle}{\usebibmacro{index:title}{\index}{\mkbibquote{#1}}} + +\DeclareFieldAlias[inbook]{title}{title} +\DeclareFieldAlias[inbook]{labeltitle}{labeltitle} +\DeclareIndexFieldAlias[inbook]{indextitle}{indextitle} +\DeclareFieldAlias[book]{origtitle}{title} + +\DeclareFieldFormat{chapter}{\bibstring{chapter}\space #1} +\DeclareFieldFormat{issuetitle}{\ifcapital{\MakeCapital{#1}}{#1}} +\DeclareFieldFormat[letter,misc,patent]{title}{#1} +\DeclareFieldFormat[letter,misc,patent]{labeltitle}{#1} +\DeclareFieldFormat[thesis,unpublished]{title}{% + \iftoggle{bibliography} + {\mkbibquote{#1}}% + {\iftoggle{cbx@short} + {\mkbibquote{#1}}% + {\mkbibquote{#1}\nopunct}}} +\DeclareFieldFormat[thesis]{labeltitle}{% + \iftoggle{bibliography} + {\mkbibquote{#1}}% + {\iftoggle{cbx@short} + {\mkbibquote{#1}}% + {\mkbibquote{#1}\nopunct}}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Other Field Formats %% +%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\DeclareFieldFormat{addendum}{\ifcapital{\MakeCapital{#1}}{#1}}% +\DeclareFieldFormat{annotation}{\\[\bibitemsep] #1} +\DeclareFieldAlias{doi}{url} +\DeclareFieldFormat{edition}{% + \ifinteger{#1} + {\mkbibordedition{#1}~\bibstring{edition}}% + {\ifcapital{\MakeCapital{#1}}{#1}}} +\DeclareFieldFormat{endmonth}{\mkbibmonth{#1}}% +\DeclareFieldFormat{howpublished}{\ifcapital{\MakeCapital{#1}}{#1}}% +\DeclareFieldFormat{issue}{\MakeCapital{#1}}% always capitalize +\DeclareFieldFormat{journum}{% + \ifnumeral{#1} + {no\adddotspace\printfield{number}}% + {nos\adddotspace\printfield{number}}} +\DeclareFieldFormat{labelyear}{% + \ifboolexpr{ test {\iffieldundef{year}} + and test {\iffieldundef{bookyear}}} + {\biblcstring{#1}}% + {\ifbibstring{#1}{\bibstring{#1}}{\stripzeros{#1}}}} +\DeclareListFormat{location}{#1}% +\DeclareFieldFormat{month}{\mkbibmonth{#1}}% +\DeclareFieldFormat{note}{\ifcapital{\MakeCapital{#1}}{#1}}% +\DeclareFieldFormat{pages}{#1} +\DeclareFieldFormat{part}{\bibstring{part}\space#1} +\DeclareFieldFormat{postnote}{#1} +\DeclareListFormat{publisher}{#1} +\DeclareFieldFormat{season}{\MakeCapital{#1}}% always capitalize + +% A shorthand should be italicized if the title that it abbreviates is +% also italicized. See CMS, 17th ed., 14.60. Set this in the +% bibliography database with '\emph{}' or '\mkbibemph{}'. + +\DeclareFieldFormat{shorthand}{#1} +\DeclareFieldFormat{shorthandintro}{% + \ifcapital{\MakeCapital{#1}}{#1}}% +\DeclareFieldFormat{shorthandwidth}{#1} +\DeclareFieldFormat{type}{\ifcapital{\MakeCapital{#1}}{#1}}% +\DeclareFieldFormat{url}{\url{#1}} +\DeclareFieldFormat{urldate}{\bibstring{urlseen}\space#1} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Bibliography Aliases %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\DeclareBibliographyAlias{periodical}{article} +\DeclareBibliographyAlias{cite:periodical}{cite:article} + +\DeclareBibliographyAlias{booklet}{book} +\DeclareBibliographyAlias{collection}{book} +\DeclareBibliographyAlias{manual}{book} +\DeclareBibliographyAlias{proceedings}{book} +\DeclareBibliographyAlias{report}{book} +\DeclareBibliographyAlias{techreport}{book} +\DeclareBibliographyAlias{cite:booklet}{cite:book} +\DeclareBibliographyAlias{cite:collection}{cite:book} +\DeclareBibliographyAlias{cite:manual}{cite:book} +\DeclareBibliographyAlias{cite:proceedings}{cite:book} +\DeclareBibliographyAlias{cite:report}{cite:book} +\DeclareBibliographyAlias{cite:techreport}{cite:book} + +\DeclareBibliographyAlias{bookinbook}{incollection} +\DeclareBibliographyAlias{conference}{incollection} +\DeclareBibliographyAlias{inbook}{incollection} +\DeclareBibliographyAlias{inproceedings}{incollection} +\DeclareBibliographyAlias{inreference}{reference} +\DeclareBibliographyAlias{letter}{incollection} +\DeclareBibliographyAlias{suppbook}{incollection} +\DeclareBibliographyAlias{suppcollection}{incollection} +\DeclareBibliographyAlias{cite:bookinbook}{cite:incollection} +\DeclareBibliographyAlias{cite:inbook}{cite:incollection} +\DeclareBibliographyAlias{cite:inproceedings}{cite:incollection} +\DeclareBibliographyAlias{cite:inreference}{cite:reference} +\DeclareBibliographyAlias{cite:suppbook}{cite:incollection} +\DeclareBibliographyAlias{cite:suppcollection}{cite:incollection} + +\DeclareBibliographyAlias{mastersthesis}{thesis} +\DeclareBibliographyAlias{phdthesis}{thesis} +\DeclareBibliographyAlias{unpublished}{thesis} +\DeclareBibliographyAlias{cite:mastersthesis}{cite:thesis} +\DeclareBibliographyAlias{cite:phdthesis}{cite:thesis} +\DeclareBibliographyAlias{cite:unpublished}{cite:thesis} + +\DeclareBibliographyAlias{*}{book} +\DeclareBibliographyAlias{cite:*}{cite:book} + +%%%%%%%%%%%%%%%%%%%%%%%% +%% Author's Position %% +%%%%%%%%%%%%%%%%%%%%%%%% + +\renewcommand*{\revsdnamedelim}{% + \iftoggle{bibliography} + {\addcomma}% + {}} + +\newbibmacro*{author+bookauthor+etc}{% + \iftoggle{noauth}% true by entry option or citation command + {\usebibmacro{authpos+deflabel}}% + {\usebibmacro{author+bookauthor}% + \ifnameundef{\cbx@namelist} + {\usebibmacro{a:authpos+edtrans}% + \ifnameundef{\cbx@namelist} + {\toggletrue{noauth}% + \usebibmacro{journalfirst}}% + {\usebibmacro{b:authpos+edtrans}% + \usebibmacro{namehash+etc}}}% + {\usebibmacro{namehash+etc}}}} + +\newbibmacro*{authpos+deflabel}{% + \global\togglefalse{authposition}% + \renewcommand*{\cbx@deflabel}{default}}% + +\newbibmacro*{author+bookauthor}{% + \ifboolexpr{ togl {swapauth} + and ( test {\ifentrytype{book}} + or test {\ifentrytype{bookinbook}} + or test {\ifentrytype{collection}} + or test {\ifentrytype{inbook}} + or test {\ifentrytype{incollection}} )} + {} + {\ifboolexpr{ togl {collection:inbook} + and togl {swapvol}} + {\usebibmacro{bookauthor+namelist}}% + {\ifnameundef{author} + {\usebibmacro{bookauthor+namelist}}% + {\usebibmacro{author+namelist}}}}} + +\newbibmacro*{author+namelist}{% + \ifboolexpr{ test {\ifnameundef{shortauthor}} + or togl {bibliography}} + {\renewcommand*{\cbx@namelist}{author}}% + {\renewcommand*{\cbx@namelist}{shortauthor}}} + +\newbibmacro*{bookauthor+namelist}{% + \ifboolexpr{ test {\ifnameundef{shortbookauthor}} + or togl {bibliography}} + {\renewcommand*{\cbx@namelist}{bookauthor}}% + {\renewcommand*{\cbx@namelist}{shortbookauthor}}} + +% When 'journaltitle' or 'blogtitle' goes in the author's position. + +\newbibmacro*{journalfirst}{% + \usebibmacro{authpos+deflabel}% + \ifboolexpr{ test {\ifentrytype{article}} + and togl {bibliography}} + {\toggletrue{journalfirst}% + \usebibmacro{bibjournaldash}% + \setunit{\space}% + \usebibmacro{journallocation}% + \clearlist{location}% + \usebibmacro{labeldate+extradate}% + \newunit}% + {\ifboolexpr{ test {\ifentrytype{online}} + and togl {bibliography}} + {\toggletrue{journalfirst}% + \usebibmacro{bibblogdash}% + \setunit{\space}% + \usebibmacro{labeldate+extradate}% + \newunit}% + {}}} + +\newbibmacro*{namehash+etc}{% + \usebibmacro{printnames+etc}% + \iftoggle{authposition}% false in 'crossref' macro + {\savefield{namehash}{\bbx@lasthash}% + \usebibmacro{authpos+deflabel}% + \newunit}% + {\setunit{\addcomma\space}}} + +\newbibmacro*{aft+fore+intro}{% + \ifnameundef{afterword} + {\ifnameundef{foreword} + {\renewcommand*{\cbx@namelist}{introduction}% + \renewcommand*{\cbx@bibstring}{introduction}}% + {\renewcommand*{\cbx@namelist}{foreword}% + \renewcommand*{\cbx@bibstring}{foreword}}} + {\renewcommand*{\cbx@namelist}{afterword}% + \renewcommand*{\cbx@bibstring}{afterword}}% + \usebibmacro{printnames+etc}% + \savefield{namehash}{\bbx@lasthash}% + \usebibmacro{authpos+deflabel}% + \newunit + \bibstring{\cbx@bibstring}\space}% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Editors and Translators %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newbibmacro*{a:authpos+edtrans}{% + \usebibmacro{test:edtrans}% + \iftoggle{noed} + {\usebibmacro{transcombos}}% + {\iftoggle{swaptrans} + {\usebibmacro{transcombos}}% + {\usebibmacro{edcombos}}}} + +\newbibmacro*{test:edtrans}{% + \global\togglefalse{noed}% + \global\togglefalse{notrans}% + \usebibmacro{test:trans}% + \usebibmacro{test:notrans}% + \usebibmacro{test:ed}}% + +\newbibmacro*{test:trans}{% + \usebibmacro{test:transdupes}% + \iftoggle{edshift} + {\ifnameundef{translator} + {\renewcommand*{\yeditor}{translatora}}% + {\renewcommand*{\yeditor}{translator}}} + {\renewcommand*{\yeditor}{translator}}} + +\newbibmacro*{test:transdupes}{% + \ifnamesequal{translator}{translatora} + {\clearname{translatora}}% + {}} + +\newbibmacro*{test:notrans}{% + \ifnameundef{\yeditor} + {\global\toggletrue{notrans}}% + {\ifboolexpr{ test {\ifdefstring{\yeditor}{translator}} + and togl {collection} + and togl {swapvol} + and ( test {\ifdefstring{\xtitle}{book}} + or test {\ifdefstring{\xtitle}{main}} )} + {\global\toggletrue{notrans}}% + {}}} + +\newbibmacro*{test:ed}{% + \usebibmacro{test:eddupes}% + \iftoggle{edshift} + {\usebibmacro{eda+edb+edc}}% + {\ifnameundef{editor} + {\usebibmacro{editora+noed}}% + {\usebibmacro{editor+noed}% + \iftoggle{noed} + {\global\togglefalse{noed}% + \usebibmacro{editora+noed}}% + {}}}} + +\newbibmacro*{test:eddupes}{% + \ifnamesequal{editor}{editora} + {\ifboolexpr{ test {\iffieldundef{editoratype}} + or test {\iffieldsequal{editortype}{editoratype}}} + {\clearname{editora}}% + {}} + {}} + +\newbibmacro*{eda+edb+edc}{% + \ifnameundef{editor} + {\ifnameundef{editora} + {\ifnameundef{editorb} + {\renewcommand*{\xeditor}{editorc}}% + {\renewcommand*{\xeditor}{editorb}}% + \iffieldequalstr{\xeditor type}{maintitle} + {\global\toggletrue{noed}}% + {\usebibmacro{test:noed:a}}}% + {\usebibmacro{editora+noed}}} + {\usebibmacro{editor+noed}% + \iftoggle{noed} + {\global\togglefalse{noed}% + \usebibmacro{editora+noed}}% + {}}} + +\newbibmacro*{editora+noed}{% + \renewcommand*{\xeditor}{editora}% + \usebibmacro{test:noed:a}% + \iftoggle{noed} + {} + {\usebibmacro{test:noed:b}% + \ifboolexpr{ test {\ifdefempty{\xtitle}} + and not togl {authposition} + and ( togl {collection:inbook} + or test {\ifentrytype{incollection}} + or test {\ifentrytype{letter}} )} + {\global\toggletrue{noed}}% + {}}} + +\newbibmacro*{editor+noed}{% + \renewcommand*{\xeditor}{editor}% + \usebibmacro{test:noed:a}% + \iftoggle{noed} + {} + {\usebibmacro{test:noed:b}% + \iftoggle{authposition} + {\ifboolexpr{ togl {collection:inbook} + and togl {swapvol} + and not test {\ifnameundef{editora}}} + {\global\toggletrue{noed}}% + {}} + {\ifdefstring{\xtitle}{book} + {\global\toggletrue{noed}}% + {}}}} + +\newbibmacro*{test:noed:a}{% + \ifboolexpr{ test {\iffieldequalstr{\xeditor type}{issuetitle}} + or test {\iffieldequalstr{\xeditor type}{series}} + or test {\ifnameundef{\xeditor}}} + {\global\toggletrue{noed}}% + {}} + +\newbibmacro*{test:noed:b}{% + \iftoggle{authposition} + {\iffieldequalstr{\xeditor type}{maintitle} + {\iftoggle{collection:book} + {\iftoggle{swapvol} + {} + {\global\toggletrue{noed}}} + {\global\toggletrue{noed}}} + {\ifboolexpr{ togl {collection:book} + and togl {swapvol}} + {\global\toggletrue{noed}}% + {}}} + {\ifboolexpr{ test {\iffieldequalstr{\xeditor type}{maintitle}} + and not test {\ifdefstring{\xtitle}{main}}} + {\global\toggletrue{noed}}% + {\ifboolexpr{ not test {\iffieldequalstr{\xeditor type}{maintitle}} + and test {\ifdefstring{\xtitle}{main}}} + {\global\toggletrue{noed}}% + {\ifdefempty{\xtitle} + {\ifboolexpr{ test {\iffieldequalstr{\xeditor type}{compiler}} + or test {\iffieldequalstr{\xeditor type}{title}} + or test {\iffieldundef{\xeditor type}}} + {} + {\global\toggletrue{noed}}} + {}}}}} + +\newbibmacro*{transcombos}{% + \renewcommand*{\cbx@namelist}{\yeditor}% + \ifnamesequal{\xeditor}{\yeditor} + {\clearname{\xeditor}% + \iffieldequalstr{\xeditor type}{compiler} + {\renewcommand*{\cbx@bibstring}{transcomp}}% + {\renewcommand*{\cbx@bibstring}{transed}}} + {\renewcommand*{\cbx@bibstring}{translator}}} + +\newbibmacro*{edcombos}{% + \renewcommand*{\cbx@namelist}{\xeditor}% + \ifnamesequal{\xeditor}{\yeditor} + {\clearname{\yeditor}% + \iffieldequalstr{\xeditor type}{compiler} + {\renewcommand*{\cbx@bibstring}{comptrans}}% + {\renewcommand*{\cbx@bibstring}{edtrans}}}% + {\iffieldequalstr{\xeditor type}{compiler} + {\renewcommand*{\cbx@bibstring}{compiler}}% + {\renewcommand*{\cbx@bibstring}{editor}}}} + +\newbibmacro*{b:authpos+edtrans}{% + \iftoggle{cbx@short} + {} + {\usebibmacro{eds+comps}% + \renewcommand*{\plugb}{% + \addcomma\space\bibsstring{\cbx@bibstring}}}} + +\newbibmacro*{eds+comps}{% + \iftoggle{swaptrans} + {} + {\ifnameundef{editor} + {\ifnumgreater{\value{editora}}{1} + {\edef\cbx@bibstring{\cbx@bibstring +}}% + {}} + {\ifnumgreater{\value{editor}}{1} + {\edef\cbx@bibstring{\cbx@bibstring +}}% + {}}}} + +\newbibmacro*{a:edtrans}{% + \iftoggle{swaptrans} + {\usebibmacro{transcombos+etc}% + \usebibmacro{edcombos+etc}}% + {\usebibmacro{edcombos+etc}% + \usebibmacro{transcombos+etc}}} + +\newbibmacro*{transcombos+etc}{% + \usebibmacro{test:edtrans}% + \iftoggle{notrans} + {} + {\usebibmacro{transcombos}% + \usebibmacro{pluga+etc}}} + +\newbibmacro*{edcombos+etc}{% + \usebibmacro{test:edtrans}% + \iftoggle{noed} + {} + {\usebibmacro{edcombos}% + \usebibmacro{pluga+etc}}} + +\newbibmacro*{b:edtrans}{% + \global\toggletrue{edshift}% + \usebibmacro{a:edtrans}% + \global\togglefalse{edshift}% + \usebibmacro{editoraddon}}% + +\newbibmacro*{pluga+etc}{% + \usebibmacro{a:edtranspunct}% + \usebibmacro{pluga+printnames}% + \usebibmacro{b:edtranspunct}}% + +\newbibmacro*{a:edtranspunct}{% + \ifboolexpr{ togl {authposition} + or togl {edshift}} + {} + {\newunit}}% + +\newbibmacro*{pluga+printnames}{% + \renewcommand*{\pluga}{% + \bibstring{\cbx@bibstring}\space}% + \usebibmacro{printnames+etc}}% + +\newbibmacro*{b:edtranspunct}{% + \ifboolexpr{ test {\ifdefstring{\xtitle}{book}} + and not test {\iffieldundef{title}}} + {\setunit{\addcomma\space}}% + {\newunit}}% + +% For editors and translators whose names belong after 'issuetitle', +% 'maintitle', or 'series'. + +\newbibmacro*{xeditor+yeditor}[1]{% + \ifboolexpr{ test {\iffieldequalstr{editortype}{#1}} + or test {\iffieldequalstr{editoratype}{#1}} + or test {\iffieldequalstr{editorbtype}{#1}} + or test {\iffieldequalstr{editorctype}{#1}}} + {\setunit{\addcomma\space}% + \renewcommand*{\cbx@bibstring}{editor}% + \usebibmacro{editorlists}{#1}% + \usebibmacro{pluga+printnames}}% + {}} + +\newbibmacro*{editorlists}[1]{% + \iffieldequalstr{editortype}{#1} + {\renewcommand*{\cbx@namelist}{editor}}% + {\iffieldequalstr{editoratype}{#1} + {\renewcommand*{\cbx@namelist}{editora}}% + {\iffieldequalstr{editorbtype}{#1} + {\renewcommand*{\cbx@namelist}{editorb}}% + {\renewcommand*{\cbx@namelist}{editorc}}}}} + +% A catchall for additional editorial information about a 'title'. + +\newbibmacro*{editoraddon}{% + \iffieldundef{editoraddon} + {} + {\nopunct\printfield{editoraddon}% + \clearfield{editoraddon}}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Printing Names and Dashes %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newbibmacro*{printnames+etc}{% + \ifboolexpr{ togl {authposition} + and togl {bibliography}} + {\usebibmacro{bibnamedash+printnames}}% + {\usebibmacro{printnames}}% + \usebibmacro{handle}% + \usebibmacro{nameaddon}% + \usebibmacro{a:labeldate+extradate}% + \usebibmacro{clearnames+empty}}% + +\newbibmacro*{bibnamedash+printnames}{% + \ifboolexpr{ test {\iffieldequals{namehash}{\bbx@lasthash}} + and not test \iffirstonpage} + {\ifboolexpr{ test {\ifnameundef{author}} + and test {\ifnameundef{bookauthor}}} + {\bibstring{bibnamedash}\plugb}% + {\bibstring{bibnamedash}}} + {\usebibmacro{printnames}}} + +\newbibmacro*{printnames}{% + \ifnameundef{\cbx@namelist} + {} + {\anona\pluga\printnames[\cbx@deflabel]{% + \cbx@namelist}\plugb\anonb}}% + +% A screen name should precede 'nameaddon'. See CMS, 17th ed., 14.208. + +\newbibmacro*{handle}{% + \iffieldundef{handle} + {} + {\space + \printfield[parens]{handle}% + \clearfield{handle}}} + +\newbibmacro*{nameaddon}{% + \iffieldundef{nameaddon} + {} + {\space + \printfield[brackets]{nameaddon}% + \clearfield{nameaddon}}} + +\newbibmacro*{clearnames+empty}{% + \clearname{\cbx@namelist}% + \let\cbx@namelist\empty + \let\anona\empty + \let\anonb\empty + \let\pluga\empty + \let\plugb\empty}% + +% When 'journaltitle' goes in the author's position. + +\newbibmacro*{bibjournaldash}{% + \ifboolexpr{ test {\iffieldequals{journaltitle}{\bbx@lasthash}} + and not test \iffirstonpage} + {\bibstring{bibnamedash}% + \clearfield{journaltitle}% + \clearlist{location}% + \newunit}% + {\savefield{journaltitle}{\bbx@lasthash}% + \renewcommand*{\xtitle}{journal}% + \usebibmacro{longtitle+titleaddon}% + \let\xtitle\empty}}% + +% When 'blogtitle' goes in the author's position. This should only +% apply when a blog has changed urls or host organizations. + +\newbibmacro*{bibblogdash}{% + \ifboolexpr{ test {\iffieldequals{blogtitle}{\bbx@lasthash}} + and not test \iffirstonpage} + {\bibstring{bibnamedash}% + \clearfield{blogtitle}% + \newunit}% + {\savefield{blogtitle}{\bbx@lasthash}% + \renewcommand*{\xtitle}{blog}% + \usebibmacro{longtitle+titleaddon}% + \let\xtitle\empty}}% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Titles and Subtitles %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\renewcommand*{\subtitlepunct}{\ifterm{\space}{:\space}}% + +\newbibmacro*{longtitle+titleaddon}{% + \iffieldundef{\xtitle title} + {} + {\usebibmacro{longtitle}% + \usebibmacro{titleaddon}% + \usebibmacro{test:titledupes}% + \clearfield{\xtitle title}}} + +\newbibmacro*{longtitle}{% + \printtext[\xtitle title]{% + \printfield[noformat]{\xtitle title}% + \iffieldundef{\xtitle subtitle} + {} + {\subtitlepunct + \printfield[noformat]{\xtitle subtitle}}}} + +\newbibmacro*{test:titledupes}{% + \iffieldsequal{title}{booktitle} + {\ifboolexpr{ test {\iffieldundef{subtitle}} + or test {\iffieldsequal{subtitle}{booksubtitle}}} + {\clearfield{booktitle}}% + {}} + {}} + +\newbibmacro*{titleaddon}{% + \iffieldundef{\xtitle titleaddon} + {} + {\addspace% '\space' has issues with quotation marks + \printfield{\xtitle titleaddon}}} + +\newbibmacro*{title+labelyear}{% + \iftoggle{bibliography} + {\usebibmacro{longtitle+titleaddon}% + \usebibmacro{b:labeldate+extradate}}% + {\ifboolexpr{ test {\ifciteseen} + or togl {firstshort}} + {\usebibmacro{shorttitle}}% + {\usebibmacro{longtitle+titleaddon}}}} + +\newbibmacro*{shorttitle}{% + \ifboolexpr{ togl {collection} + and togl {swapvol}} + {\iftoggle{collection:book} + {\iffieldundef{shortmaintitle} + {\printfield[title]{maintitle}}% + {\printfield[title]{shortmaintitle}}} + {\iffieldundef{shortbooktitle} + {\printfield[title]{booktitle}}% + {\printfield[title]{shortbooktitle}}}} + {\printfield[\thefield{entrytype}]{labeltitle}}} + +\newbibmacro*{test:title+booktitle}{% + \ifboolexpr{ test {\iffieldundef{title}} + and test {\iffieldundef{booktitle}}} + {\renewcommand*{\xtitle}{bookbook}}% + {\iffieldundef{title} + {\renewcommand*{\xtitle}{book}}% + {\ifboolexpr{ togl {collection} + and togl {swapvol}} + {\iftoggle{collection:book} + {\renewcommand*{\xtitle}{main}}% + {\renewcommand*{\xtitle}{book}}} + {}}}} + +\newbibmacro*{bookbooktitle}{% + \iffieldundef{bookbooktitle} + {} + {\bibstring{in}\space + \renewcommand*{\xtitle}{bookbook}% + \usebibmacro{longtitle+titleaddon}% + \midsentence\setunit{\addcomma\space}}} + +\newbibmacro*{maintitle+editor}{% + \iffieldundef{maintitle} + {} + {\renewcommand*{\xtitle}{main}% + \usebibmacro{longtitle+titleaddon}% + \usebibmacro{xeditor+yeditor}{maintitle}}} + +\newbibmacro*{issuetitle}{% + \iffieldundef{issuetitle} + {} + {\iffieldequalstr{issuetitle}{special issue} + {} + {\bibstring{in}\space + \renewcommand*{\xtitle}{issue}% + \usebibmacro{longtitle+titleaddon}% + \usebibmacro{xeditor+yeditor}{issuetitle}}% + \newunit\bibstring{special}% + \setunit{\addcomma\space}}} + +\newbibmacro*{origtitle}{% + \iffieldundef{origtitle} + {} + {\newunit + \bibstring{origpub}% + \space + \renewcommand*{\xtitle}{orig}% + \usebibmacro{longtitle+titleaddon}% + \setunit{\addspace}% not '\setunit{\space}' + \printtext[parens]{% + \usebibmacro{origlocation}% + \usebibmacro{origpublisher}% + \iftoggle{reflist} + {} + {\usebibmacro{origyear+origendyear}}}}} + +%%%%%%%%%%%%%%%%%%%%%%% +%% Dates and Times %% +%%%%%%%%%%%%%%%%%%%%%%% + +\newbibmacro*{issue+month+etc}{% + \iffieldundef{year} + {\iffieldundef{month} + {} + {\setunit{\space}% + \printtext[parens]{\usebibmacro{month+endmonth}}}} + {\ifboolexpr{ test {\iffieldundef{volume}} + and test {\iffieldundef{number}}} + {\iffieldundef{journal} + {} + {\setunit{\addcomma\space}}% + \iffieldundef{month} + {\usebibmacro{issue+season+year}}% + {\usebibmacro{month+day+year}}} + {\setunit{\space}% + \iffieldundef{month} + {\usebibmacro{reflist+issue+season+year}}% + {\printtext[parens]{% + \usebibmacro{month+day+year}}}}}} + +\newbibmacro*{month+day+year}{% + \usebibmacro{month+endmonth}% + \usebibmacro{reflist+day+year}}% + +\newbibmacro*{month+endmonth}{% + \iffieldundef{month} + {} + {\printfield{month}% + \ifboolexpr{ test {\iffieldundef{endmonth}} + or test {\iffieldsequal{month}{endmonth}}} + {} + {\addslash\printfield{endmonth}}}} + +\newbibmacro*{reflist+day+year}{% + \ifboolexpr{ togl {bibliography} + and togl {reflist}} + {\iffieldundef{day} + {} + {\usebibmacro{day+endday+year}}} + {\iffieldundef{day} + {\addspace + \printfield{year}}% + {\usebibmacro{day+endday+year}}}} + +\newbibmacro*{day+endday+year}{% + \usebibmacro{day+endday}% + \addcomma\space + \printfield{year}% + \usebibmacro{hour+minute+timezone}}% + +\newbibmacro*{day+endday}{% + \iffieldundef{day} + {} + {\addspace + \stripzeros{\thefield{day}}% + \iffieldundef{endday} + {} + {\textendash\stripzeros{\thefield{endday}}}}} + +\newbibmacro*{hour+minute+timezone}{% + \iffieldundef{hour} + {} + {\addcomma\space + \printtime}}% + +\newbibmacro*{reflist+issue+season+year}{% + \ifboolexpr{ togl {bibliography} + and togl {reflist} + and test {\iffieldundef{issue}} + and test {\iffieldundef{season}}} + {} + {\setunit{\space}% + \printtext[parens]{\usebibmacro{issue+season+year}}}} + +% Treat 'season' as an alternative for 'issue'. + +\newbibmacro*{issue+season+year}{% + \ifboolexpr{ test {\iffieldundef{issue}} + and test {\iffieldundef{season}}} + {\printfield{year}}% + {\iffieldundef{issue} + {\printfield{season}% + \space + \printfield{year}}% + {\printfield{issue}% + \space + \printfield{year}}}} + +% Per CMS, 17th ed., 14.119, print the publication year of the +% last-mentioned title. + +\newbibmacro*{year+bookyear}{% + \ifboolexpr{ togl {bibliography} + and togl {reflist}} + {\ifboolexpr{ test {\iffieldundef{bookyear}} + or test {\iffieldundef{year}} + or test {\iffieldsequal{year}{bookyear}} + or not test {\iffieldequalstr{labeldatesource}{bookyear}}} + {} + {\printfield{bookyear}% + \usebibmacro{endbookyear}}} + {\ifboolexpr{ test {\iffieldundef{year}} + and test {\iffieldundef{bookyear}}} + {\bibstring{nodate}}% + {\iffieldundef{bookyear} + {\printfield{year}% + \usebibmacro{endyear}}% + {\ifboolexpr{ togl {collection} + and togl {swapvol} + and not test {\iffieldundef{year}}} + {\printfield{year}% + \usebibmacro{endyear}}% + {\printfield{bookyear}% + \usebibmacro{endbookyear}}}}}} + +\newbibmacro*{endyear}{% + \iffieldundef{endyear} + {} + {\iffieldsequal{year}{endyear} + {} + {\textendash\printfield{endyear}}}} + +\newbibmacro*{endbookyear}{% + \iffieldundef{endbookyear} + {} + {\iffieldsequal{bookyear}{endbookyear} + {} + {\textendash\printfield{endbookyear}}}} + +\newbibmacro*{origyear+origendyear}{% + \iffieldundef{origyear} + {} + {\printfield{origyear}% + \ifboolexpr{ test {\iffieldundef{endorigyear}} + or test {\iffieldsequal{origyear}{endorigyear}}} + {} + {\textendash\printfield{endorigyear}}}} + +% For reference lists. + +\newbibmacro*{a:labeldate+extradate}{% + \ifboolexpr{ togl {noauth} + or not togl {authposition}} + {} + {\usebibmacro{labeldate+extradate}}} + +\newbibmacro*{b:labeldate+extradate}{% + \ifboolexpr{ togl {noauth} + and not togl {journalfirst}} + {\usebibmacro{labeldate+extradate}}% + {}} + +\newbibmacro*{labeldate+extradate}{% + \ifboolexpr{ togl {reflist} + and not togl {skipdate}} + {\newunit + \usebibmacro{reflist:origyear}% + \usebibmacro{labeldate+endyear}% + \printfield{extradate}% + \ifboolexpr{ test {\iffieldundef{year}} + or test {\ifnumeral{\thefield{year}}}} + {\newunit}% + {\bibsentence\newunit}}% if year enclosed in brackets + {}} + +\newbibmacro*{reflist:origyear}{% + \iffieldundef{origyear} + {} + {\printtext[parens]{\usebibmacro{origyear+origendyear}}% + \space}}% + +% The next macro helps bib environments that use the 'reflist' toggle +% (see the 'reflist' bib environment set elsewhere in this file). +% Since they can't use the 'reflist' preamble option, they can't load +% the DeclareLabeldate for reference lists. The macro below makes the +% output consistent in those cases but can cause problems with +% sorting. Resolve them with '\sortyear'. Also, end dates go here. See +% CMS, 17th ed., 15.37 and 15.41. Although '\printlabeldate' prints +% them, the workaround needs to run 'endyear', which can cause +% problems not only with sorting but with 'extralabeldate'. + +\newbibmacro*{labeldate+endyear}{% + \iffieldequalstr{labeldatesource}{bookyear} + {\iffieldundef{year} + {\printlabeldate}% + {\printfield{year}% + \usebibmacro{endyear}}} + {\printlabeldate}}% + +%%%%%%%%%%%%%%%%% +%% Locations %% +%%%%%%%%%%%%%%%%% + +\newbibmacro*{loc+pub+year}{% + \usebibmacro{loc+pub}{1}% + \ifnumgreater{\value{publisher}}{1} + {\setunit{\addsemicolon\space}% + \usebibmacro{loc+pub}{2}}% + {} + \setunit{\addcomma\space}% + \usebibmacro{year+bookyear}}% + +\newbibmacro*{loc+pub}[1]{% + \usebibmacro{location}{#1}% + \setunit{\addcolon\space}% + \printlist[publisher][#1-#1]{publisher}}% + +\newbibmacro*{location}[1]{% + \ifboolexpr{ test {\iflistundef{location}} + and test {\iffieldundef{howpublished}} + and test {\iffieldundef{url}} + and test {\iffieldundef{doi}}} + {\bibstring{noplace}}% + {\printlist[location][#1-#1]{location}}} + +\newbibmacro*{origlocation}{% + \iflistundef{origlocation} + {} + {\printlist{origlocation}% + \iflistundef{origpublisher} + {\setunit{\addcomma\space}}% + {\setunit{\addcolon\space}}}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Bibliography Drivers %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\DeclareBibliographyDriver{shorthand}{% + \usedriver + {\DeclareNameAlias{author}{sortname}}% + {\thefield{entrytype}}% + \iftoggle{annotate} + {\global\togglefalse{annotate}% + \usebibmacro{pageref+finentry}% + \global\toggletrue{annotate}}% + {\usebibmacro{pageref+finentry}}} + +\DeclareBibliographyDriver{article}{% + \usebibmacro{bibindex}% + \usebibmacro{author+title+ed+note}% + \usebibmacro{articles}% + \usebibmacro{colon+pages+etc}% + \usebibmacro{doi+finentry+etc}}% + +\DeclareBibliographyDriver{book}{% + \usebibmacro{bibindex}% + \usebibmacro{author+collection+etc}% + \usebibmacro{doi+finentry+etc}}% + +\DeclareBibliographyDriver{incollection}{% + \usebibmacro{bibindex}% + \usebibmacro{test:collection}% + \usebibmacro{author+title+etc}% + \usebibmacro{crossref+incollections}% + \usebibmacro{doi+finentry+etc}}% + +\DeclareBibliographyDriver{misc}{% + \usebibmacro{bibindex}% + \usebibmacro{author+bookauthor+etc}% + \usebibmacro{title+labelyear}% + \newunit + \printfield{userb}% + \usebibmacro{doi+finentry+etc}}% + +\DeclareBibliographyDriver{online}{% + \usebibmacro{bibindex}% + \usebibmacro{author+title+ed+note}% + \newunit + \usebibmacro{websites}% + \usebibmacro{issue+month+etc}% + \usebibmacro{doi+finentry+etc}}% + +\DeclareBibliographyDriver{patent}{% + \usebibmacro{bibindex}% + \usebibmacro{author+title+ed+note}% + \newunit + \printfield{number}% + \newunit + \printfield{addendum}% + \usebibmacro{pageref+finentry}}% + +\DeclareBibliographyDriver{review}{% + \usebibmacro{bibindex}% + \usebibmacro{reviews}% + \usebibmacro{articles}% + \usebibmacro{colon+pages+etc}% + \usebibmacro{doi+finentry+etc}}% + +\DeclareBibliographyDriver{thesis}{% + \usebibmacro{bibindex}% + \usebibmacro{author+title+ed+note}% + \newunit + \usebibmacro{inst+loc+date}% + \usebibmacro{doi+finentry+etc}}% + +%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Second Tier Macros %% +%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newbibmacro*{pageref+finentry}{% + \newunit + \usebibmacro{pageref}% + \newunit + \usebibmacro{annotation}% + \finentry}% + +\newbibmacro*{author+title+ed+note}{% + \usebibmacro{author+bookauthor+etc}% + \usebibmacro{test:title+booktitle}% + \usebibmacro{title+labelyear}% + \usebibmacro{a:edtrans}% + \usebibmacro{note}}% + +\newbibmacro*{articles}{% + \newunit + \usebibmacro{part}% + \usebibmacro{issuetitle}% + \renewcommand*{\xtitle}{journal}% + \usebibmacro{longtitle+titleaddon}% + \usebibmacro{journalseries}% + \setunit{\space}% + \usebibmacro{journallocation}% + \printfield[noformat]{volume}% + \iftoggle{journalfirst} + {\newunit}% + {\setunit{\addcomma\space}}% + \usebibmacro{periodical:number}% + \usebibmacro{issue+month+etc}}% + +% If an article has an electronic article ID, don't print its page +% range in the bibliography. See CMS, 17th ed., 14.174. + +\newbibmacro*{colon+pages+etc}{% + \ifboolexpr{ test {\iffieldundef{pages}} + or not test {\iffieldundef{eid}}} + {} + {\iftoggle{reflist} + {\ifboolexpr{test {\iffieldundef{number}} + and test {\iffieldundef{month}} + and test {\iffieldundef{issue}} + and test {\iffieldundef{season}}} + {\setunit{\addcolon}% + \printfield{pages}}% + {\setunit{\addcolon\space}% + \printfield{pages}}} + {\usebibmacro{colon+pages}}}} + +\newbibmacro*{doi+finentry+etc}{% + \usebibmacro{doi+url+etc}% + \usebibmacro{isbn}% + \usebibmacro{pageref+finentry}}% + +\newbibmacro*{author+collection+etc}{% + \usebibmacro{test:collection}% + \usebibmacro{author+bookauthor+etc}% + \usebibmacro{test:title+booktitle}% + \usebibmacro{title+labelyear}% + \ifdefstring{\xtitle}{main} + {\usebibmacro{a:edtrans}% + \usebibmacro{pages+volume+etc}% + \let\xtitle\empty + \usebibmacro{longtitle+titleaddon}% + \midsentence\setunit{\addcomma\space}% + \usebibmacro{byauthor}{}% + \usebibmacro{b:edtrans}% + \usebibmacro{note}% + \usebibmacro{edition}% + \usebibmacro{volumes+series+etc}% + \usebibmacro{date+loc+etc}% + \usebibmacro{origtitle}}% + {\usebibmacro{byauthor}{newunit}% + \usebibmacro{a:edtrans}% + \usebibmacro{editoraddon}% + \usebibmacro{note}% + \usebibmacro{edition}% + \usebibmacro{volumes+series+etc}% + \usebibmacro{maintitle+editor}% + \usebibmacro{date+loc+etc}% + \usebibmacro{origtitle}}} + +% Check for entrytypes due to its use in 'cite' and 'parencite'. + +\newbibmacro*{test:collection}{% + \ifboolexpr{ test {\ifentrytype{book}} + or test {\ifentrytype{bookinbook}} + or test {\ifentrytype{collection}} + or test {\ifentrytype{inbook}}} + {\iffieldundef{volume} + {} + {\ifboolexpr{ ( test {\ifentrytype{book}} + or test {\ifentrytype{collection}} ) + and not test {\iffieldundef{maintitle}}} + {\global\toggletrue{collection}% + \global\toggletrue{collection:book}}% + {\ifboolexpr{ ( test {\ifentrytype{bookinbook}} + or test {\ifentrytype{inbook}} ) + and test {\iffieldundef{maintitle}} + and not test {\iffieldundef{title}} + and not test {\iffieldundef{booktitle}}} + {\global\toggletrue{collection}% + \global\toggletrue{collection:inbook}}% + {}}}} + {}} + +\newbibmacro*{author+title+etc}{% + \usebibmacro{test:bookauthor}% + \iftoggle{reprinted} + {} + {\ifboolexpr{ test {\ifnameundef{afterword}} + and test {\ifnameundef{foreword}} + and test {\ifnameundef{introduction}}} + {\usebibmacro{author+bookauthor+etc}% + \usebibmacro{test:title+booktitle}% + \usebibmacro{title+labelyear}% + \ifdefstring{\xtitle}{book} + {\usebibmacro{bybookauthor+pages}{newunit}% + \usebibmacro{a:edtrans}}% + {\ifboolexpr{ test {\ifentrytype{bookinbook}} + or test {\ifentrytype{inbook}}} + {\usebibmacro{byauthor+ed+in}}% + {\usebibmacro{ed+chapter+in}}}} + {\usebibmacro{aft+fore+intro}}}} + +\newbibmacro*{crossref+incollections}{% + \iffieldundef{crossref} + {\usebibmacro{incollections}}% + {\xifinlist{\thefield{crossref}}{\crossreflist} + {\ifnumgreater{\value{\thefield{crossref}}}{0} + {\usebibmacro{crossref}% + \usebibmacro{pages}}% + {\usebibmacro{incollections}}} + {\listxadd{\crossreflist}{\thefield{crossref}}% + \ifcsdef{c@\thefield{crossref}} + {\setcounter{\thefield{crossref}}{0}}% + {\newcounter{\thefield{crossref}}}% needs '%' + \usebibmacro{incollections}}}} + +\newbibmacro*{websites}{% + \ifboolexpr{ test {\iffieldundef{blogtitle}} + and test {\iffieldundef{journaltitle}} + and test {\iflistundef{organization}}} + {} + {\renewcommand*{\xtitle}{blog}% + \usebibmacro{longtitle+titleaddon}% + \newunit + \renewcommand*{\xtitle}{journal}% + \usebibmacro{longtitle+titleaddon}% + \newunit + \printlist{organization}% + \setunit{\addcomma\space}}} + +\newbibmacro*{reviews}{% +% Unsigned reviews have no plausible place for the publication year +% except where the default format would put it. Perhaps best to use +% the default format from here. + \ifnameundef{author} + {\toggletrue{noauth}% + \togglefalse{reflist}}% + {}% + \usebibmacro{author+bookauthor+etc}% + \usebibmacro{title+labelyear}% + \usebibmacro{note}% + \usebibmacro{review+title}% + \setunit{\addcomma\space}% + \iftoggle{firstshort} + {} + {\usebibmacro{b:edtrans}}} + +\newbibmacro*{inst+loc+date}{% + \printfield{type}% + \setunit{\addcomma\space}% + \iflistundef{institution} + {\printfield{venue}}% + {\printlist{institution}}% + \setunit{\addcomma\space}% + \printlist{location}% + \setunit{\addcomma\space}% + \usebibmacro{month+day+year}}% + +%%%%%%%%%%%%%%%%%%%%%%%%% +%% Third Tier Macros %% +%%%%%%%%%%%%%%%%%%%%%%%%% + +\renewbibmacro*{annotation}{% + \iftoggle{annotate} + {\printfield{annotation}}% + {}} + +\newbibmacro*{note}{% + \iffieldundef{note} + {} + {\newunit + \printfield{note}}} + +\newbibmacro*{part}{% + \iffieldundef{part} + {} + {\setunit{\addcomma\space}% + \iffieldnum{part} + {\printfield{part}}% + {\printfield[noformat]{part}}% + \setunit{\addcomma\space}% + \clearfield{part}}} + +\newbibmacro*{journalseries}{% + \iffieldundef{series} + {} + {\iflistundef{location} + {\setunit{\addcomma\space}% + \printfield{series}}% + {\setunit{\space}% + \printfield{series}}% + \isdot\addcomma + \usebibmacro{seriesaddon}% + \usebibmacro{xeditor+yeditor}{series}% + \newunit}}% + +\newbibmacro*{journallocation}{% + \iflistundef{location} + {} + {\nopunct\printtext[parens]{% + \printlist{location}}\space}}% + +% On how to format the issue number of periodicals, see CMS, 17th ed., +% 14.171 and 15.47. + +\newbibmacro*{periodical:number}{% + \iffieldundef{number} + {} + {\ifboolexpr{ togl {bibliography} + and togl {reflist} + and test {\iffieldundef{issue}} + and test {\iffieldundef{season}} + and test {\iffieldundef{month}} + and not test {\iffieldundef{volume}}} + {\setunit{\space}% + \printfield[parens]{number}}% + {\setunit{\addcomma\space}% + \printfield[journum]{number}}}} + +\newbibmacro*{colon+pages}{% + \ifboolexpr{ test {\iffieldundef{month}} + and test {\iffieldundef{year}} + and test {\iffieldundef{issue}}} + {\setunit{\addcolon}% + \printfield{pages}}% + {\ifboolexpr{ test {\iffieldundef{month}} + and test {\iffieldundef{year}}} + {\setunit{\addcolon\space}% + \printfield{pages}}% + {\ifboolexpr{ test {\iffieldundef{number}} + and test {\iffieldundef{volume}}} + {\setunit{\addcomma\space}% + \printfield{pages}}% + {\setunit{\addcolon\space}% + \printfield{pages}}}}} + +\newbibmacro*{doi+url+etc}{% + \ifboolexpr{ test {\iffieldundef{howpublished}} + and test {\iffieldundef{url}} + and test {\iffieldundef{doi}} + and test {\iffieldundef{addendum}} + or ( togl {firstshort} and not togl {bibliography} )} + {} + {\usebibmacro{eid}% + \newunit + \printfield{howpublished}% + \newunit + \printurldate + \newunit + \printfield[noformat]{version}% + \newunit + \printfield{url}% + \newunit + \printfield{doi}% + \newunit + \printfield{addendum}}} + +\newbibmacro*{isbn}{% + \iffieldundef{isbn} + {} + {\iftoggle{bibliography} + {\iftoggle{isbn} + {\newunit + \printfield{isbn}}% + {}} + {}}} + +\newbibmacro*{volumes+series+etc}{% + \usebibmacro{volumes}% + \usebibmacro{bookseries}% + \usebibmacro{pages+volume+etc}% + \usebibmacro{pages}% + \usebibmacro{book:number}% + \usebibmacro{part}}% + +\newbibmacro*{byauthor}[1]{% + \ifboolexpr{ test {\ifnameundef{author}} + or togl {noauth}} + {} + {\ifstrequal{#1}{newunit} + {\renewcommand*{\pluga}{\newunit\bibstring{by}\space}}% + {\renewcommand*{\pluga}{\bibstring{by}\space}}% + \renewcommand*{\cbx@namelist}{author}% + \usebibmacro{printnames+etc}}} + +\newbibmacro*{edition}{% + \iffieldundef{edition} + {} + {\newunit + \printfield{edition}}} + +\newbibmacro*{date+loc+etc}{% + \ifboolexpr{ test {\iflistundef{location}} + and test {\iflistundef{publisher}}} + {\newunit + \usebibmacro{month+day+year}}% + {\iffieldundef{origtitle} + {\iftoggle{bibliography} + {\newunit + \usebibmacro{orig+etc}}% + {\setunit{\addspace}% not '\setunit{\space}' + \printtext[parens]{\usebibmacro{orig+etc}}}} + {\newunit + \usebibmacro{loc+pub+year}}}} + +\newbibmacro*{test:bookauthor}{% + \ifboolexpr{ test {\ifnamesequal{author}{bookauthor}} + or test {\ifnamesequal{afterword}{bookauthor}} + or test {\ifnamesequal{foreword}{bookauthor}} + or test {\ifnamesequal{introduction}{bookauthor}}} + {\clearname{bookauthor}}% + {\iftoggle{noauth} + {\clearname{bookauthor}}% + {}}} + +\newbibmacro*{bybookauthor+pages}[1]{% + \ifnameundef{bookauthor} + {} + {\ifstrequal{#1}{newunit} + {\renewcommand*{\pluga}{\newunit\bibstring{by}\space}}% + {\renewcommand*{\pluga}{\bibstring{by}\space}}% + \renewcommand*{\cbx@namelist}{bookauthor}% + \usebibmacro{printnames+etc}% + \usebibmacro{pages}% + \ifdefstring{\xtitle}{book} + {\newunit}% + {}}} + +\newbibmacro*{byauthor+ed+in}{% + \usebibmacro{byauthor}{newunit}% + \usebibmacro{a:edtrans}% + \iftoggle{collection:inbook} + {} + {\newunit + \bibstring{in}\space}}% + +\newbibmacro*{ed+chapter+in}{% + \usebibmacro{a:edtrans}% + \newunit + \iffieldundef{chapter} + {\bibstring{in}\space}% + {\printfield{chapter}\space + \bibstring{in}\space}}% + +\newbibmacro*{incollections}{% + \ifdefstring{\xtitle}{book} + {\usebibmacro{pages+volume+etc}% + \let\xtitle\empty + \usebibmacro{longtitle+titleaddon}% + \midsentence\setunit{\addcomma\space}% + \usebibmacro{byauthor}{}% + \usebibmacro{b:edtrans}% + \usebibmacro{note}% + \usebibmacro{edition}}% + {\iftoggle{collection:inbook} + {\usebibmacro{note}% + \usebibmacro{edition}% + \usebibmacro{volumes}% + \usebibmacro{pages+volume+etc}}% + {}% needs '%' + \renewcommand*{\xtitle}{book}% + \usebibmacro{longtitle+titleaddon}% + \midsentence\setunit{\addcomma\space}% + \usebibmacro{bybookauthor+pages}{}% + \usebibmacro{bookbooktitle}% + \usebibmacro{b:edtrans}% + \iftoggle{collection:inbook} + {}% needs '%' + {\usebibmacro{note}% + \usebibmacro{edition}}}% needs '%' + \usebibmacro{volumes+series+etc}% + \usebibmacro{maintitle+editor}% + \usebibmacro{date+loc+etc}% + \usebibmacro{origtitle}}% + +\newbibmacro*{crossref}{% + \renewcommand*{\cbx@deflabel}{labelname}% + \global\toggletrue{cbx@short}% + \entrydata{\thefield{crossref}}{% + \iftoggle{reflist} + {\usebibmacro{parencite:long}}% + {\usebibmacro{author+bookauthor+etc}% + \usebibmacro{shorttitle}}% + \usebibmacro{cite:volume}}} + +\newbibmacro*{pages}{% + \iffieldundef{pages} + {} + {\iftoggle{bibliography} + {\setunit{\addcomma\space}% + \printfield{pages}% + \clearfield{pages}}% + {}}} + +\newbibmacro*{review+title}{% + \iftoggle{noauth} + {\bibcpstring{reviewnoauth}}% + {\bibstring{review}}% + \space + \usebibmacro{test:title+booktitle}% + \usebibmacro{title+labelyear}% + \iftoggle{firstshort} + {\clearfield{booktitle}} + {\setunit{\addcomma\space}% + \togglefalse{noauth}% + \renewcommand*{\pluga}{\bibstring{by}\space}% + \renewcommand*{\cbx@namelist}{bookauthor}% + \usebibmacro{printnames+etc}}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Fourth and Higher Tier Macros %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newbibmacro*{eid}{% + \iffieldundef{eid} + {} + {\iftoggle{bibliography} + {\setunit{\addcolon\space}}% + {\newunit}% + \printfield{eid}}} + +\newbibmacro*{volumes}{% + \iffieldundef{volumes} + {} + {\ifboolexpr{ not togl {bibliography} + and not test {\iffieldundef{postnote}} + and not togl {listvols}} + {} + {\newunit + \printfield{volumes}% + \clearfield{volumes}}}} + +\newbibmacro*{bookseries}{% + \iffieldundef{series} + {} + {\usebibmacro{pages}% + \newunit + \printfield{series}% + \usebibmacro{seriesaddon}% + \usebibmacro{xeditor+yeditor}{series}% + \setunit{\addcomma\space}}} + +\newbibmacro*{seriesaddon}{% + \iffieldundef{seriesaddon} + {} + {\addcomma\space + \printfield{seriesaddon}% + \isdot\addcomma}}% + +\newbibmacro*{pages+volume+etc}{% + \iffieldundef{volume} + {} + {\iftoggle{bibliography} + {\setunit{\addcomma\space}% + \printfield{pages}% + \clearfield{pages}% + \usebibmacro{volume+number+etc}}% + {\usebibmacro{volume+number+etc}}}} + +\newbibmacro*{volume+number+etc}{% + \iffieldundef{series} + {\newunit}% + {\setunit{\addcomma\space}}% + \iffieldnum{volume} + {\printfield{volume}% + \usebibmacro{volume:number}}% + {\bibstring{volumes}\space + \printfield[noformat]{volume}}% + \clearfield{volume}% + \usebibmacro{part}% + \iftoggle{collection} + {\iftoggle{swapvol} + {\addcomma\space}% + {\space\bibstring{of}\space}}% + {\iffieldundef{maintitle} + {} + {\space\bibstring{of}\space}}} + +\newbibmacro*{volume:number}{% + \iffieldundef{number} + {} + {\addcomma\space + \printfield[journum]{number}% + \clearfield{number}}} + +\newbibmacro*{book:number}{% + \iffieldundef{number} + {} + {\ifentrytype{letter} + {\usebibmacro{letter:number}}% + {\usebibmacro{other:number}}}} + +\newbibmacro*{letter:number}{% + \iftoggle{bibliography} + {\setunit{\addcomma\space}% + \printfield[journum]{number}}% + {}} + +\newbibmacro*{other:number}{% + \ifboolexpr{ test {\iffieldequalstr{editortype}{series}} + or test {\iffieldequalstr{editoratype}{series}} + or test {\iffieldequalstr{editorbtype}{series}} + or test {\iffieldequalstr{editorctype}{series}}} + {\setunit{\addcomma\space}% + \printfield{number}}% + {\setunit{\addspace}% not '\setunit{\space}' + \printfield{number}}} + +\newbibmacro*{orig+etc}{% + \usebibmacro{origlocation}% + \usebibmacro{origpublisher}% + \iftoggle{reflist} + {} + {\usebibmacro{origyear+origendyear}}% + \usebibmacro{reprint}% + \usebibmacro{loc+pub+year}}% + +\newbibmacro*{origpublisher}{% + \iflistundef{origpublisher} + {} + {\printlist{origpublisher}% + \setunit{\addcomma\space}}} + +\newbibmacro*{reprint}{% + \ifboolexpr{ test {\iffieldundef{origyear}} + and test {\iflistundef{origpublisher}}} + {} + {\iftoggle{bibliography} + {\newunit}% + {\setunit{\addsemicolon\space}}% + \bibstring{reprint}% + \addcomma\space}}% + +\endinput |