diff options
Diffstat (limited to 'macros/latex/contrib/biblatex-contrib/windycity/windycity.cbx')
-rw-r--r-- | macros/latex/contrib/biblatex-contrib/windycity/windycity.cbx | 245 |
1 files changed, 143 insertions, 102 deletions
diff --git a/macros/latex/contrib/biblatex-contrib/windycity/windycity.cbx b/macros/latex/contrib/biblatex-contrib/windycity/windycity.cbx index d5d0a342b5..3246927365 100644 --- a/macros/latex/contrib/biblatex-contrib/windycity/windycity.cbx +++ b/macros/latex/contrib/biblatex-contrib/windycity/windycity.cbx @@ -1,4 +1,4 @@ -% Last modified: Mon 07 Sep 2020 06:40:45 PM CDT +% Last modified: Tue 29 Sep 2020 06:29:14 PM CDT % Permission is granted to copy, distribute and/or modify this % software under the terms of the LaTeX Project Public License (LPPL), @@ -11,7 +11,7 @@ % implied warranties of merchantability and fitness for a particular % purpose. -\ProvidesFile{windycity.cbx}[2020/09/07 Windy City citation style for +\ProvidesFile{windycity.cbx}[2020/09/29 Windy City citation style for biblatex] \@ifpackagelater{biblatex}{2019/08/17} {} @@ -22,39 +22,32 @@ This is a fatal error. I'm aborting now.}% \endinput}% -% This file contains material only for formatting notes and -% parenthetical citations. For content that is also used for -% bibliographies and reference lists, see windycity.bbx. +%%%%%%%%%%%%%% +%% Basics %% +%%%%%%%%%%%%%% -%%%%%%%%%%%%%%%%%%% -%% Preliminary %% -%%%%%%%%%%%%%%%%%%% - -\InitializeCitationStyle{\let\crossreflist\empty}% -\DeclareAutoPunctuation{.,;:!?} -\DeclareCitePunctuationPosition{cite}{r} \AtEveryCite{% \global\togglefalse{bibliography}% + \global\togglefalse{cbx:first}% + \global\togglefalse{ibid:loccit}% \global\togglefalse{multicite}% - \global\togglefalse{cbx@first}% - \global\togglefalse{cbx@loccit}% \AtEveryItem}% \AtEveryMultiCite{\toggletrue{multicite}}% +\DeclareAutoPunctuation{.,;:!?} +\DeclareCitePunctuationPosition{cite}{r} +\InitializeCitationStyle{\let\crossreflist\empty}% \renewcommand{\bibfootnotewrapper}[1]{% \bibsentence#1}% \renewcommand{\bibendnotewrapper}[1]{% \bibsentence#1}% -\providetoggle{cite:collection} -\providetoggle{cite:long} - -% Protect commas against abbreviation dots and terminal punctuation -% marks. Note '\addspace'. Using '\space' there causes problems. +% Protect commas against abbreviation dots and terminal punctuation. +% Note '\addspace'. Using '\space' there causes problems. \renewcommand*{\newunitpunct}{\ifterm{,\addspace}{\addcomma\space}}% -% Prevents errant space after a colon. +% Prevent errant space after a colon. \renewcommand*{\multicitedelim}{\setunit{\addsemicolon\space}}% @@ -128,7 +121,6 @@ \DeclareCiteCommand{\textcite} {\usebibmacro{prenote}}% {\usebibmacro{citeindex}% - \usebibmacro{test:multicite}% \usebibmacro{cite}}% {\multicitedelim}% {\usebibmacro{postnote}}% @@ -137,7 +129,6 @@ {\usebibmacro{prenote}}% {\usebibmacro{citeindex}% \toggletrue{noauth}% - \usebibmacro{test:multicite}% \usebibmacro{cite}}% {\multicitedelim}% {\usebibmacro{postnote}}% @@ -149,27 +140,32 @@ \newbibmacro*{parencite}{% \ifboolexpr{ test \ifciteibid and not test \iffirstonpage} - {\iffieldundef{postnote} + {\usebibmacro{test:collection}% + \iffieldundef{postnote} {\printtext[bibhyperref]{% \usebibmacro{parencite:date}% \usebibmacro{cite:volume}}} {}} - {\ifboolexpr{ test {\ifentrytype{book}} - or test {\ifentrytype{collection}} - or test {\ifentrytype{incollection}} - or test {\ifentrytype{inbook}} - or test {\ifentrytype{letter}}} - {\usebibmacro{test:crossref}}% - {}% needs '%' - \printtext[bibhyperref]{% - \usebibmacro{parencite:long}% - \usebibmacro{cite:volume}}}} + {\usebibmacro{test:collection}% + \usebibmacro{parencite:crossref}% + \usebibmacro{parencite:multicite}}} \newbibmacro*{parencite:date}{% \iffieldundef{labelyear} {} {\usebibmacro{parencite:origyear}% - \ifboolexpr{ test {\iffieldundef{year}} + \iffieldnums{labelyear} + {}% needs '%' + {\addcomma}% + \usebibmacro{labeldate+endyear}% + \printfield{extradate}}} + +\newbibmacro*{parencite:date+old}{% + \iffieldundef{labelyear} + {} + {\usebibmacro{parencite:origyear}% + \ifboolexpr{ ( test {\iffieldundef{year}} + and test {\iffieldundef{urlyear}} ) or test {\iffieldequalstr{year}{forthcoming}}} {\addcomma}% {}% needs '%' @@ -182,7 +178,29 @@ {\printfield[brackets]{origyear}% \space}}% -\newbibmacro*{parencite:long}{% +\newbibmacro*{parencite:crossref}{% + \ifboolexpr{ test {\ifentrytype{book}} + or test {\ifentrytype{collection}} + or test {\ifentrytype{incollection}} + or test {\ifentrytype{inbook}} + or test {\ifentrytype{letter}}} + {\usebibmacro{test:crossref}}% + {}} + +\newbibmacro*{parencite:multicite}{% + \ifboolexpr{ test {\iffieldequals{namehash}{\bbx@lasthash}} + and togl {multicite}} + {\iffieldundef{postnote} + {\newunit}% + {}% needs '%' + \printtext[bibhyperref]{% + \usebibmacro{parencite:date}% + \usebibmacro{cite:volume}}} + {\printtext[bibhyperref]{% + \usebibmacro{parencite:new}% + \usebibmacro{cite:volume}}}} + +\newbibmacro*{parencite:new}{% \iffieldundef{shorthand} {\usebibmacro{parencite:auth+title}}% {\printfield{shorthand}}% @@ -197,7 +215,7 @@ {\iffieldundef{label} {\usebibmacro{parencite:journal}}% {\printfield{label}}} - {\global\toggletrue{cbx@short}% + {\global\toggletrue{cbx:short}% \renewcommand*{\cbx@deflabel}{labelname}% \clearfield{handle}% \clearfield{nameaddon}% @@ -221,7 +239,6 @@ %%%%%%%%%%%%%%%%%%%%%%%%%% \newbibmacro*{cite}{% - \usebibmacro{test:multicite}% \ifciteseen {\usebibmacro{test:collection}% \renewcommand*{\cbx@deflabel}{labelname}% @@ -229,13 +246,6 @@ {\printtext[bibhyperref]{\usebibmacro{cite:new}}}% needs '%' \usebibmacro{savefields}}% -\newbibmacro*{test:multicite}{% - \ifboolexpr{ test {\iffieldequals{namehash}{\bbx@lasthash}} - and togl {multicite} - and togl {short}} - {\toggletrue{noauth}}% - {}} - \newbibmacro*{cite:seen}{% \iffieldundef{shorthand} {\ifboolexpr{ test \ifciteibid @@ -250,9 +260,9 @@ \iftoggle{ibid} {\bibcpstring{ibidem}% \ifloccit - {\global\toggletrue{cbx@loccit}}% + {\global\toggletrue{ibid:loccit}}% {\usebibmacro{cite:volume}}} - {\global\toggletrue{cbx@short}% + {\global\toggletrue{cbx:short}% \ifentrytype{review} {\usebibmacro{ibid:review}}% {\usebibmacro{author+bookauthor+etc}% @@ -270,13 +280,21 @@ \usebibmacro{cite:volume}}% \newbibmacro*{cite:short}{% - \global\toggletrue{cbx@short}% + \global\toggletrue{cbx:short}% + \usebibmacro{short:multicite}% \ifentrytype{review} {\usebibmacro{short:review}}% {\usebibmacro{author+bookauthor+etc}% \usebibmacro{title+labelyear}% \usebibmacro{cite:volume}}} +\newbibmacro*{short:multicite}{% + \ifboolexpr{ test {\iffieldequals{namehash}{\bbx@lasthash}} + and togl {multicite} + and togl {short}} + {\toggletrue{noauth}}% + {}} + \newbibmacro*{short:review}{% \ifnameundef{author} {\bibcpstring{reviewnoauth}}% @@ -291,7 +309,7 @@ \usebibmacro{cite:volume}}% \newbibmacro*{cite:volume}{% - \newunit + \usebibmacro{cite:punctuation}% \iftoggle{swapvol} {\ifboolexpr{ togl {collection:bk} or togl {collection:ib}} @@ -299,6 +317,27 @@ {}} {}} +\newbibmacro*{cite:punctuation}{% + \iffieldstart{postnote}{;} + {} + {\newunit}}% + +% Thanks to David Fussner's biblatex-chicago for pointing me to this +% command by Philipp Lehman. Source: +% https://groups.google.com/forum/#!topic/comp.text.tex/kG003fkZK1I + +\newrobustcmd*{\iffieldstart}[2]{% + \iffieldundef{#1} + {\@gobbletwo}% + {\begingroup + \edef\@tempa{% + \long\def\noexpand\iffieldstart@i####1\detokenize{#2}####2}% + \@tempa\@nil{\endgroup\ifblank{##1}}% + \savefield*{#1}{\@tempa}% + \expandafter\iffieldstart@i\detokenize + \expandafter\expandafter\expandafter{% + \expandafter\@tempa\detokenize{#2}}\@nil}}% + \newbibmacro*{volume+page}{% \iffieldundef{volume} {} @@ -308,8 +347,8 @@ {\printfield{volume}}}} \newbibmacro*{cite:new}{% - \global\toggletrue{cbx@first}% - \usebibmacro{deflabel}% + \global\toggletrue{cbx:first}% + \usebibmacro{idem+short+multicite}% \iftoggle{firstshort} {\usebibmacro{cite:short}}% {\printtext{% @@ -322,11 +361,14 @@ % 'true') the test below will print 'labelname' if it matches that of % the previous citation. -\newbibmacro*{deflabel}{% +\newbibmacro*{idem+short+multicite}{% \ifboolexpr{ test {\ifciteidem} or togl {firstshort}} {\renewcommand*{\cbx@deflabel}{labelname}}% - {\renewcommand*{\cbx@deflabel}{default}}} + {\ifboolexpr{ test {\iffieldequals{namehash}{\bbx@lasthash}} + and togl {multicite}} + {\renewcommand*{\cbx@deflabel}{labelname}}% + {\renewcommand*{\cbx@deflabel}{default}}}} % Checking for 'title' below helps if you cross-reference volumes to a % collection with entries containing just 'volume' and 'crossref' @@ -335,22 +377,15 @@ \newbibmacro*{test:crossref}{% \ifboolexpr{ test {\iffieldundef{crossref}} or test {\iffieldundef{title}}} - {\toggletrue{cite:long}}% + {} {\xifinlist{\thefield{crossref}}{\crossreflist} - {\toggletrue{cite:collection}% + {\toggletrue{cbx:collection}% \stepcounter{\thefield{crossref}}} - {\toggletrue{cite:long}% - \listxadd{\crossreflist}{\thefield{crossref}}% + {\listxadd{\crossreflist}{\thefield{crossref}}% \ifcsdef{c@\thefield{crossref}} {\setcounter{\thefield{crossref}}{0}}% {\newcounter{\thefield{crossref}}}}}} -\newbibmacro*{cite:long}{% - \printtext{% - \usedriver - {\DeclareNameAlias{sortname}{default}}% - {cite:\thefield{entrytype}}}} - \newbibmacro*{savefields}{% \iffieldundef{crossref} {\let\cbx@keyhash\empty}% @@ -371,6 +406,30 @@ {\newunit}% {\setunit{\addcolon\space}}}}} +\newbibmacro*{reference:authpos}{% + \iflistundef{organization} + {\ifnameundef{bookauthor} + {\renewcommand*{\cbx@namelist}{author}}% + {\renewcommand*{\cbx@namelist}{bookauthor}}% + \usebibmacro{printnames+etc}}% + {\printlist{organization}% + \clearlist{organization}}} + +\newbibmacro*{reference:howpublished+etc}{% + \ifboolexpr{ test {\iffieldundef{howpublished}} + and test {\iffieldundef{year}}} + {} + {\setunit{\addspace}% + \iffieldundef{howpublished} + {\printtext[parens]{\printfield{year}}} + {\global\togglefalse{cbx:first}% + \printtext[parens]{% + \printfield{howpublished}% + \newunit + \printfield{version}% + \newunit + \printfield{year}}}}} + %%%%%%%%%%%%%%%% %% Postnote %% %%%%%%%%%%%%%%%% @@ -379,11 +438,13 @@ \usebibmacro{postnote+etc}% \usebibmacro{postpunct+etc}}% +% In this context, '\ifloccit' is always true. Run it earlier, in +% 'cite:ibid', and record the state with 'ibid:loccit'. + \newbibmacro*{postnote+etc}{% - \ifboolexpr{ togl {cbx@loccit} - and togl {ibid}} + \iftoggle{ibid:loccit} {} - {\iftoggle{cbx@first} + {\iftoggle{cbx:first} {\usebibmacro{postnote:first}% \usebibmacro{shorthand+intro}}% {\usebibmacro{postnote}}}} @@ -400,10 +461,10 @@ % If the postnote is empty, print the page ranges of journal and % review articles. See CMOS, 17th ed., 14.153, 14.167, and 14.174. As % for incollection and inbook entries, 14.106 seems to suggest the -% same, but the example in 14.30 suggests otherwise. The examples in -% 14.108 don't help. For magazines, CMOS is clear that the range can -% be left out. To do so, simply omit it from your bibliography -% database. +% same, but the example in 14.30 suggests otherwise, while the +% examples in 14.108 don't help. For magazines, CMOS is clear that the +% range can be left out. To do so, simply omit it from your +% bibliography database. \newbibmacro*{cite:pages}{% \iffieldundef{pages} @@ -438,21 +499,6 @@ {}} {}} -\newbibmacro*{refworks}{% - \ifboolexpr{ test {\iffieldundef{howpublished}} - and test {\iffieldundef{year}}} - {} - {\setunit{\addspace}% - \iffieldundef{howpublished} - {\printtext[parens]{\printfield{year}}} - {\global\togglefalse{cbx@first}% - \printtext[parens]{% - \printfield{howpublished}% - \newunit - \printfield{version}% - \newunit - \printfield{year}}}}} - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Bibliography Drivers for Notes %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -464,29 +510,25 @@ \DeclareBibliographyDriver{cite:book}{% \usebibmacro{test:crossref}% - \iftoggle{cite:long} + \iftoggle{cbx:collection} + {\usebibmacro{author+incollection+etc}% + \usebibmacro{crossref}}% {\usebibmacro{author+collection+etc}% - \newunit - \usebibmacro{volume+page}}% - {\iftoggle{cite:collection} - {\usebibmacro{author+incollection+etc}% - \usebibmacro{crossref}}% - {}}} + \usebibmacro{cite:punctuation}% + \usebibmacro{volume+page}}} \DeclareBibliographyDriver{cite:incollection}{% \ifentrytype{letter} {\toggletrue{noauth}}% {}% needs '%' \usebibmacro{test:crossref}% - \iftoggle{cite:long} + \iftoggle{cbx:collection} + {\usebibmacro{author+incollection+etc}% + \usebibmacro{crossref}}% {\usebibmacro{author+incollection+etc}% \usebibmacro{incollections}% - \newunit - \usebibmacro{volume+page}}% - {\iftoggle{cite:collection} - {\usebibmacro{author+incollection+etc}% - \usebibmacro{crossref}}% - {}}} + \usebibmacro{cite:punctuation}% + \usebibmacro{volume+page}}} \DeclareBibliographyDriver{cite:misc}{% \usebibmacro{author+bookauthor+etc}% @@ -509,16 +551,15 @@ \newunit}% \DeclareBibliographyDriver{cite:reference}{% - \printlist{organization}% + \usebibmacro{reference:authpos}% \usebibmacro{edition}{}% - \usebibmacro{refworks}% + \usebibmacro{reference:howpublished+etc}% \newunit \bibstring{subverbo}\space \usebibmacro{longtitle+titleaddon}% \newunit \renewcommand*{\pluga}{\bibstring{by}\space}% - \renewcommand*{\cbx@namelist}{author}% - \usebibmacro{printnames+etc}}% + \usebibmacro{reference:authpos}}% \DeclareBibliographyDriver{cite:review}{% \usebibmacro{reviews}% |