diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/biblatex-chicago/chicago-authordate-trad.cbx')
-rw-r--r-- | Master/texmf-dist/tex/latex/biblatex-chicago/chicago-authordate-trad.cbx | 255 |
1 files changed, 200 insertions, 55 deletions
diff --git a/Master/texmf-dist/tex/latex/biblatex-chicago/chicago-authordate-trad.cbx b/Master/texmf-dist/tex/latex/biblatex-chicago/chicago-authordate-trad.cbx index 34c817312f4..8360287b050 100644 --- a/Master/texmf-dist/tex/latex/biblatex-chicago/chicago-authordate-trad.cbx +++ b/Master/texmf-dist/tex/latex/biblatex-chicago/chicago-authordate-trad.cbx @@ -1,10 +1,10 @@ -% $Id: chicago-authordate-trad.cbx,v 0.8.1.42 2013/10/29 14:03:58 dfussner Exp $ +% $Id: chicago-authordate-trad.cbx,v 0.8.2.3 2014/08/15 09:44:56 dfussner Exp $ % This is a biblatex citation style file, adapted from Lehman's % authoryear-comp.cbx. It is heavily modified, with the intention of % providing inline citations (and a reference list) for the % author-date style of the Chicago Manual of Style, 16th edition. -\ProvidesFile{chicago-authordate-trad.cbx}[2013/10/29 v 2.8 biblatex +\ProvidesFile{chicago-authordate-trad.cbx}[2014/08/15 v 2.9a biblatex citation style] %%%% Biblatex initialization + Chicago options + Toggles %%%% @@ -26,6 +26,8 @@ citation style] \providetoggle{cms@ordate} \providetoggle{cms@nodates} \providetoggle{cms@authorparens} +\providetoggle{cms@datedash} +\providetoggle{cms@modpostnote} \providetoggle{cms@url}% These are for the field-exclusion options \providetoggle{cms@doi} @@ -35,6 +37,7 @@ citation style] \providetoggle{cms@numbermonth} \providetoggle{cms@bookpages} \providetoggle{cms@hidevolumes}% Modify Volume fix +\providetoggle{cms@comprange} \providetoggle{cms@jrcomma}% Comma after Jr./Sr. @@ -147,6 +150,25 @@ citation style] \DeclareBibliographyOption{noibid}[true]{% \global\toggletrue{cms@noibid}} +\DeclareBibliographyOption{compresspages}[true]{% + \ifcsdef{cms@opt@crange@#1}% + {\csuse{cms@opt@crange@#1}}% + {\blx@err@invopt{compresspages=#1}{}}}% +\def\cms@opt@crange@true{% + \global\toggletrue{cms@comprange}% + \setcounter{mincomprange}{100}% + \setcounter{mincompwidth}{10}% +}% +\def\cms@opt@crange@false{}% + +\DeclareBibliographyOption{postnotepunct}[true]{% + \ifcsdef{cms@opt@ppunct@#1}% + {\csuse{cms@opt@ppunct@#1}}% + {\blx@err@invopt{postnotepunct=#1}{}}}% +\def\cms@opt@ppunct@true{% + \global\toggletrue{cms@modpostnote}}% +\def\cms@opt@ppunct@false{}% + \DeclareBibliographyOption{usecompiler}[true]{% \settoggle{cms@usecompiler}{#1}} @@ -268,6 +290,10 @@ citation style] {\ExecuteBibliographyOptions{labeldate=true}}% {\ExecuteBibliographyOptions{labelyear=true}}% +\@ifpackagelater{biblatex}{2014/02/20}% For biblatex 2.9 ff. +{\global\toggletrue{cms@datedash}}% +{\global\togglefalse{cms@datedash}}% + \DeclareDataInheritance{collection}{suppcollection}{% \inherit{title}{title} \inherit{subtitle}{subtitle} @@ -283,6 +309,16 @@ citation style] \noinherit{indexsorttitle} } +\DeclareDataInheritance{book}{incollection}{% + \inherit{title}{booktitle} + \inherit{subtitle}{booksubtitle} + \inherit{titleaddon}{booktitleaddon} + \noinherit{shorttitle} + \noinherit{sorttitle} + \noinherit{indextitle} + \noinherit{indexsorttitle} +} + \DeclareDataInheritance{book,collection}{letter}{% \inherit{title}{booktitle} \inherit{subtitle}{booksubtitle} @@ -440,6 +476,11 @@ citation style] \global\undef\cbx@lasthash \global\undef\cbx@lastyear} +\newbibmacro*{backref+check}{% + \ifbibliography% + {\backtrackerfalse}% + {}} + \newbibmacro*{cite}{% \ifthenelse{\ifciteibid\AND\NOT\iffirstonpage} {\usebibmacro{cite:ibid}}% @@ -671,7 +712,7 @@ citation style] \iffieldundef{postnote}% {}% {\savefield{namehash}{\cbx@lastyear}% - \setunit{\postnotedelim}% + \setunit{\postnotewrapper}% \printfield{postnote}}% \ifthenelse{\value{multicitecount}=\value{multicitetotal}}% {\setunit{}% @@ -743,15 +784,15 @@ citation style] \ifthenelse{\iffieldundef{labelyear}\OR% \iffieldequalstr{labelyear}{nodate}}% {\ifboolexpr{ - test {\ifentrytype{misc}} + test {\ifentrytype{misc}}% or - test {\ifentrytype{inreference}} + test {\ifentrytype{inreference}}% or - test {\ifentrytype{reference}} + test {\ifentrytype{reference}}% or - test {\ifentrytype{mvreference}} + test {\ifentrytype{mvreference}}% or - not togl {cms@nodates} + not togl {cms@nodates}% }% {}% {\printtext[bibhyperref]{\bibstring{nodate}}}}% For CMS? @@ -766,7 +807,11 @@ citation style] \printfield{extrayear}}% \iffieldundef{urlendyear}% {}% - {\iffieldequalstr{urlendyear}{}% + {\ifboolexpr{ + test {\iffieldequalstr{urlendyear}{}}% + and + not togl {cms@datedash}% + } {\mbox{\bibdatedash}}% {}}}% {\printfield{labelyear}% @@ -776,7 +821,11 @@ citation style] \printfield{extrayear}}% \iffieldundef{origendyear}% {}% - {\iffieldequalstr{origendyear}{}% + {\ifboolexpr{ + test {\iffieldequalstr{origendyear}{}}% + and + not togl {cms@datedash}% + } {\mbox{\bibdatedash}}% {}}}} {\printfield{labelyear}% @@ -786,7 +835,11 @@ citation style] \printfield{extrayear}}% \iffieldundef{eventendyear}% {}% - {\iffieldequalstr{eventendyear}{}% + {\ifboolexpr{ + test {\iffieldequalstr{eventendyear}{}}% + and + not togl {cms@datedash}% + } {\mbox{\bibdatedash}}% {}}}} {\printfield{labelyear}% @@ -796,7 +849,11 @@ citation style] \printfield{extrayear}}% \iffieldundef{endyear}% DATE FIX {}% - {\iffieldequalstr{endyear}{}% + {\ifboolexpr{ + test {\iffieldequalstr{endyear}{}}% + and + not togl {cms@datedash}% + } {\mbox{\bibdatedash}}% {}}}}}} @@ -804,15 +861,15 @@ citation style] \ifthenelse{\iffieldundef{labelyear}\OR% \iffieldequalstr{labelyear}{nodate}}% {\ifboolexpr{ - test {\ifentrytype{misc}} + test {\ifentrytype{misc}}% or - test {\ifentrytype{inreference}} + test {\ifentrytype{inreference}}% or - test {\ifentrytype{reference}} + test {\ifentrytype{reference}}% or - test {\ifentrytype{mvreference}} + test {\ifentrytype{mvreference}}% or - not togl {cms@nodates} + not togl {cms@nodates}% }% {}% {\printtext[bibhyperref]{\bibstring{nodate}}}}% For CMS? @@ -827,7 +884,11 @@ citation style] \printfield{extrayear}}% \iffieldundef{urlendyear}% {}% - {\iffieldequalstr{urlendyear}{}% + {\ifboolexpr{ + test {\iffieldequalstr{urlendyear}{}}% + and + not togl {cms@datedash}% + } {\mbox{\bibdatedash}}% {}}}% {\printfield{labelyear}% @@ -837,7 +898,11 @@ citation style] \printfield{extrayear}}% \iffieldundef{eventendyear}% {}% - {\iffieldequalstr{eventendyear}{}% + {\ifboolexpr{ + test {\iffieldequalstr{eventendyear}{}}% + and + not togl {cms@datedash}% + } {\mbox{\bibdatedash}}% {}}}} {\printfield{labelyear}% @@ -847,7 +912,11 @@ citation style] \printfield{extrayear}}% \iffieldundef{endyear}% {}% - {\iffieldequalstr{endyear}{}% + {\ifboolexpr{ + test {\iffieldequalstr{endyear}{}}% + and + not togl {cms@datedash}% + } {\mbox{\bibdatedash}}% {}}}} {\printfield{labelyear}% @@ -857,7 +926,11 @@ citation style] \printfield{extrayear}}% \iffieldundef{origendyear}% DATE FIX {}% - {\iffieldequalstr{origendyear}{}% + {\ifboolexpr{ + test {\iffieldequalstr{origendyear}{}}% + and + not togl {cms@datedash}% + } {\mbox{\bibdatedash}}% {}}}}}} @@ -865,15 +938,15 @@ citation style] \ifthenelse{\iffieldundef{labelyear}\OR% \iffieldequalstr{labelyear}{nodate}}% {\ifboolexpr{ - test {\ifentrytype{misc}} + test {\ifentrytype{misc}}% or - test {\ifentrytype{inreference}} + test {\ifentrytype{inreference}}% or - test {\ifentrytype{reference}} + test {\ifentrytype{reference}}% or - test {\ifentrytype{mvreference}} + test {\ifentrytype{mvreference}}% or - not togl {cms@nodates} + not togl {cms@nodates}% }% {}% {\printtext[bibhyperref]{\bibstring{nodate}}}}% For CMS? @@ -888,7 +961,11 @@ citation style] \printfield{extrayear}}% \iffieldundef{urlendyear}% {}% - {\iffieldequalstr{urlendyear}{}% + {\ifboolexpr{ + test {\iffieldequalstr{urlendyear}{}}% + and + not togl {cms@datedash}% + } {\mbox{\bibdatedash}}% {}}}% {\printfield{labelyear}% @@ -898,7 +975,11 @@ citation style] \printfield{extrayear}}% \iffieldundef{endyear}% {}% - {\iffieldequalstr{endyear}{}% + {\ifboolexpr{ + test {\iffieldequalstr{endyear}{}}% + and + not togl {cms@datedash}% + } {\mbox{\bibdatedash}}% {}}}} {\printfield{labelyear}% @@ -908,7 +989,11 @@ citation style] \printfield{extrayear}}% \iffieldundef{origendyear}% {}% - {\iffieldequalstr{origendyear}{}% + {\ifboolexpr{ + test {\iffieldequalstr{origendyear}{}}% + and + not togl {cms@datedash}% + } {\mbox{\bibdatedash}}% {}}}} {\printfield{labelyear}% @@ -918,22 +1003,26 @@ citation style] \printfield{extrayear}}% \iffieldundef{eventendyear}% DATE FIX {}% - {\iffieldequalstr{eventendyear}{}% + {\ifboolexpr{ + test {\iffieldequalstr{eventendyear}{}}% + and + not togl {cms@datedash}% + } {\mbox{\bibdatedash}}% {}}}}}} \newbibmacro*{cmscitesortdate}{% Attempt to solve date-related problems \ifboolexpr{% - test {\iffieldundef{origyear}} + test {\iffieldundef{origyear}}% or - not test {\iffieldint{origyear}} + not test {\iffieldint{origyear}}% }% {\usebibmacro{cmsciteyear}}% {\iffieldint{year}% {\ifboolexpr{% Needed for date ranges test {\iffieldundef{endyear}}% or - not test {\iffieldnum{endyear}} + not test {\iffieldnum{endyear}}% }% {\ifthenelse{\thefield{origyear}>\thefield{year}}% {\toggletrue{cms@switchdates}% @@ -1138,7 +1227,8 @@ citation style] {\footcitetext}{\setunit{\multicitedelim}} \DeclareCiteCommand{\bibxrefcite} - {\usebibmacro{cite:init}}%\usebibmacro{clearalmostall}} (?) +{\usebibmacro{cite:init}% + \usebibmacro{backref+check}}%\usebibmacro{clearalmostall}} (?) {\usebibmacro{xref-in:}% \blx@ibidreset% For authordate style \usebibmacro{cite}} @@ -1146,27 +1236,31 @@ citation style] {} \DeclareCiteCommand{\origfullcite} - {\nopunct\unspace% +{\usebibmacro{backref+check}% + \nopunct\unspace% \savebibmacro{cmsbibsortdate}% \renewbibmacro*{cmsbibsortdate}{}}% {\usedriver {\DeclareNameAlias{sortname}{default}\clearfield{postnote} \clearname{author}\clearfield{userf}%\toggletrue{cms@fullnote}% \toggletrue{cms@headlessnote}\frenchspacing}% - {\thefield{entrytype}}}% + {\thefield{entrytype}}% + \iflistundef{pageref}{}{\newunit\usebibmacro{pageref}}}% {\multicitedelim}% {\restorebibmacro{cmsbibsortdate}} \DeclareCiteCommand{\origpublcite}% Similar to above, w/o title. - {\nopunct\unspace% - \savebibmacro{cmsbibsortdate}% - \renewbibmacro*{cmsbibsortdate}{}}% +{\usebibmacro{backref+check}% + \nopunct\unspace% + \savebibmacro{cmsbibsortdate}% + \renewbibmacro*{cmsbibsortdate}{}}% {\usedriver {\DeclareNameAlias{sortname}{default}\clearfield{postnote}% \usebibmacro{clearpublin}% \toggletrue{cms@headlessnote}%\toggletrue{cms@fullnote}% \toggletrue{cms@origpublished}\frenchspacing}% - {\thefield{entrytype}}}% + {\thefield{entrytype}}% + \iflistundef{pageref}{}{\newunit\usebibmacro{pageref}}}% {\multicitedelim}% {\restorebibmacro{cmsbibsortdate}} @@ -1267,20 +1361,43 @@ citation style] \DeclareFieldFormat{prenote}{\ifcapital{\MakeCapital{#1}}{#1}} -\DeclareFieldFormat{postnote}{% Removed \isdots -- required - \iffieldundef{pagination}% elsewhere also? - {#1}% - {\mkpageprefix[pagination]{#1}}} +\iftoggle{cms@comprange}% Audrey Boruvka's code from StackExchange +{\patchcmd{\blx@comprange@check}% + {\blx@comprange@comp{#1}{#2}}% + {\blx@tempcnta=#1% + \divide\blx@tempcnta100% + \multiply\blx@tempcnta100% + \ifnumequal{\blx@tempcnta}{#1}% + {\blx@range@out@value{#1\bibrangedash#2}}% + {\blx@comprange@comp{#1}{#2}}}% + {}{}}{}% + +\DeclareFieldFormat{postnote}{% Changed for page compression option + \iftoggle{cms@comprange}% + {\iffieldundef{pagination}% + {\mkcomprange{#1}}% + {\mkcomprange[{\mkpageprefix[pagination]}]{#1}}}% + {\iffieldundef{pagination}% + {#1}% + {\mkpageprefix[pagination]{#1}}}}% \DeclareFieldFormat[inreference]{postnote}{% - \iffieldundef{pagination}% - {s\adddot v\adddot\addspace\mkbibquote{#1}} - {\mkpageprefix[pagination]{#1}}}% Removed \isdots here, also. + \iftoggle{cms@comprange}% + {\iffieldundef{pagination}% + {s\adddot v\adddot\addspace\mkbibquote{#1}}% + {\mkcomprange[{\mkpageprefix[pagination]}]{#1}}}% + {\iffieldundef{pagination}% + {s\adddot v\adddot\addspace\mkbibquote{#1}}% + {\mkpageprefix[pagination]{#1}}}}% \DeclareFieldFormat{pages}{% - \iffieldundef{bookpagination}% - {#1\isdot}% - {\mkpageprefix[bookpagination]{#1}}} + \iftoggle{cms@comprange}% + {\iffieldundef{bookpagination}% + {\mkcomprange{#1}\isdot}% + {\mkcomprange[{\mkpageprefix[bookpagination]}]{#1}}}% + {\iffieldundef{bookpagination}% + {#1\isdot}% + {\mkpageprefix[bookpagination]{#1}}}}% \DeclareFieldFormat{bibnote}{\MakeCapital{#1}} @@ -1483,9 +1600,9 @@ citation style] \DeclareFieldFormat{journum}{% Revised for 0.9.5 \ifboolexpr{% - test {\ifnumerals{#1}} + test {\ifnumerals{#1}}% and - not test {\ifnumeral{#1}} + not test {\ifnumeral{#1}}% }% {\bibstring{numbers}\addspace #1}% {\bibstring{number}\addspace #1}} @@ -1601,6 +1718,34 @@ citation style] {\addcomma\addspace}}% {\addcomma\addspace}}} +\newcommand*{\postnotewrapper}{% + \iftoggle{cms@modpostnote}% + {\ifboolexpr{% + test {\iffieldstart{postnote}{,}}% + or + test {\iffieldstart{postnote}{\bibrangessep}}% + }% + {\addcomma}% w/ or w/o \addspace? + {\ifboolexpr{% + test {\iffieldstart{postnote}{;}}% + or + test {\iffieldstart{postnote}{:}}% + or + test {\iffieldstart{postnote}{.}}% + }% + {}{\postnotedelim}}}% + {\postnotedelim}}% + +\newrobustcmd*{\iffieldstart}[2]{% Philipp Lehman's code, from + \begingroup% comp.text.tex + \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} + \newcommand*{\editordelim}{% Otherwise you get an inaccurate comma. \iffieldequalstr{editortype}{none}% {\addperiod\addspace}% @@ -1773,9 +1918,9 @@ citation style] {\iflistundef{organization}% {\let\bbx@lasthash\undefined}% {\ifboolexpr{ - test {\iflistequals{organization}{\bbx@lasthash}} + test {\iflistequals{organization}{\bbx@lasthash}}% and - not test {\iffirstonpage} + not test {\iffirstonpage}% }% {\bibnamedash\addperiod\addspace}% {\iftoggle{cms@authorparens}% @@ -2337,7 +2482,7 @@ citation style] \renewbibmacro*{postnote}{% \iffieldundef{postnote}% {}% - {\setunit{\postnotedelim}% + {\setunit{\postnotewrapper}% \printfield{postnote}}} \newbibmacro*{part+editor+translator}{% |