%% %% This is file `oxyear.bbx', %% generated with the docstrip utility. %% %% The original source files were: %% %% oxref.dtx (with options: `bbx,y') %% ---------------------------------------------------------------- %% biblatex-oxref --- Biblatex styles inspired by the Oxford Guide to Style %% Author: Alex Ball %% E-mail: a.j.ball@bath.ac.uk %% License: Released under the LaTeX Project Public License v1.3c or later %% See: http://www.latex-project.org/lppl.txt %% ---------------------------------------------------------------- %% \def\Version{2019/09/20 v2.0} \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesFile{oxyear.bbx} [\Version\space Author-year bibliography style inspired by the Oxford Guide to Style] \RequireBibliographyStyle{oxref} \ExecuteBibliographyOptions{giveninits,labeldateparts,sorting=nyt,pagetracker,maxcitenames=2} \DeclareBiblatexOption{global,type,entry}{mergedate}[true]{% \ifcsdef{bbx@opt@mergedate@#1} {\csuse{bbx@opt@mergedate@#1}} {\PackageError{biblatex-oxref} {Invalid option 'mergedate=#1'} {Valid values are 'maximum', 'compact', 'basic', 'minimum',\MessageBreak 'year', 'true' (=year), and 'false'.}}} \providebibmacro*{date+extradate}{} \DeclareFieldFormat{datelabel}{\mkbibparens{#1}} \DeclareFieldFormat{labeldate}{% \iflabeldateisdate{% \def\currentfield{date}% }{% \iflabeldateisanydate{% \def\currentfield{\thefield{labeldatesource}date}% }{% \def\currentfield{\thefield{labeldatesource}}}}% \iffieldannotation{inferred}{\mkbibbrackets{#1}}{#1}% \undef\currentfield} \DeclareLabeldate{% \field{origdate} \field{date} \field{year} \field{eventdate} \field{pubstate} \literal{nodate} } \DeclareFieldFormat{extradate}{% \iffieldundef{\thefield{labeldatesource}}{% \iffieldnums{\thefield{labeldatesource}year}{}{~}% }{% \iffieldnums{\thefield{labeldatesource}}{}{~}% }% \mkbibemph{\mknumalph{#1}}}% \def\iflabeldateisanydate{% \ifboolexpr{% togl {blx@labeldateparts} and not test {\iffieldundef{labeldatesource}} and ( test {\iffieldequalstr{labeldatesource}{year}} or not test {\iffieldundef{\thefield{labeldatesource}year}} )}} \def\iflabeldateispubstate{% \ifboolexpr{% not test {\iffieldundef{labeldatesource}} and test {\iffieldequalstr{labeldatesource}{pubstate}}}} \newtoggle{blx@ox@nonodate} \DeclareBibliographyOption{nonodate}[true]{% \settoggle{blx@ox@nonodate}{#1}} \DeclareTypeOption{nonodate}[true]{% \settoggle{blx@ox@nonodate}{#1}} \DeclareEntryOption{nonodate}[true]{% \settoggle{blx@ox@nonodate}{#1}} \newbibmacro*{labeldate}{% \ifboolexpr{ test {\iffieldequalstr{labeldatesource}{nodate}} and togl {blx@ox@nonodate} }{}{\printtext[datelabel]{\printlabeldateextra}}} \def\bbx@opt@mergedate@true{\bbx@opt@mergedate@year} \def\bbx@opt@mergedate@maximum{% \renewbibmacro*{date+extradate}{% \iffieldundef{labelyear}{}{% \iflabeldateisdate{% \printtext[datelabel]{% \printfield{issue}\clearfield{issue}% \setunit*{\addspace}% \printdateextra}% \clearfield{year}\clearfield{season}\clearfield{month}\clearfield{day}% }{% \iflabeldateisanydate{% \printtext[datelabel]{% \csuse{print\thefield{labeldatesource}dateextra}}% \clearfield{\thefield{labeldatesource}year}% \clearfield{\thefield{labeldatesource}season}% \clearfield{\thefield{labeldatesource}month}% \clearfield{\thefield{labeldatesource}day}% }{% \usebibmacro{labeldate}% \iflabeldateispubstate{}{\clearfield{\thefield{labeldatesource}}}}}}}} \def\bbx@opt@mergedate@compact{% \renewbibmacro*{date+extradate}{% \iffieldundef{labelyear}{}{% \iflabeldateisdate{% \printtext[datelabel]{\printdateextra}% \clearfield{year}\clearfield{season}\clearfield{month}\clearfield{day}% }{% \iflabeldateisanydate{% \printtext[datelabel]{% \csuse{print\thefield{labeldatesource}dateextra}}% \clearfield{\thefield{labeldatesource}year}% \clearfield{\thefield{labeldatesource}season}% \clearfield{\thefield{labeldatesource}month}% \clearfield{\thefield{labeldatesource}day}% }{% \usebibmacro{labeldate}% \iflabeldateispubstate{}{\clearfield{\thefield{labeldatesource}}}}}}}} \def\bbx@opt@mergedate@year{% \renewbibmacro*{date+extradate}{% \iffieldundef{labelyear}{}{% \usebibmacro{labeldate}% \iflabeldateisdate{% \clearfield{year} }{% \iflabeldateisanydate{% \clearfield{\thefield{labeldatesource}year}% }{% \iflabeldateispubstate{}{\clearfield{\thefield{labeldatesource}}}% }}}}} \def\bbx@opt@mergedate@basic{% \renewbibmacro*{date+extradate}{% \iffieldundef{labelyear}{}{% \usebibmacro{labeldate}% \iflabeldateisdate{% \ifboolexpr{ test {\ifdateshavedifferentprecision{label}{}} or not test {\iffieldundef{issue}} }{}{% \clearfield{year}}% }{% \iflabeldateisanydate{% \ifdateshavedifferentprecision{label}{\thefield{labeldatesource}}{}{% \clearfield{\thefield{labeldatesource}year}}% }{% \iflabeldateispubstate{}{\clearfield{\thefield{labeldatesource}}}% }}}}} \def\bbx@opt@mergedate@minimum{% \renewbibmacro*{date+extradate}{% \iffieldundef{labelyear}{}{% \usebibmacro{labeldate}% \iflabeldateisdate{% \ifboolexpr{ test {\ifdateshavedifferentprecision{label}{}} or not test {\iffieldundef{extradate}} or not test {\iffieldundef{issue}} }{}{% \clearfield{year}}% }{% \iflabeldateisanydate{% \ifboolexpr{ test {\ifdateshavedifferentprecision{label}{\thefield{labeldatesource}}} or not test {\iffieldundef{extradate}} }{}{% \clearfield{\thefield{labeldatesource}year}}% }{% \iflabeldateispubstate{}{\clearfield{\thefield{labeldatesource}}}% }}}}} \def\bbx@opt@mergedate@false{% \renewbibmacro*{date+extradate}{% \iffieldundef{labelyear}{}{% \usebibmacro{labeldate}% \iflabeldateisanydate{}{% \iflabeldateispubstate{}{\clearfield{\thefield{labeldatesource}}}% }}}} \ExecuteBibliographyOptions{mergedate} \newrobustcmd*{\mknoyeardaterangefull}[2]{% \iffieldundef{#2month}{}{% \datecircaprint \printtext[#2date]{% \iffieldundef{#2season}{% \csuse{mkbibdate#1}{}{#2month}{#2day}% \blx@printtime{#2}{}% }{% \csuse{mkbibseasondate#1}{}{#2season}}% \dateuncertainprint \iffieldundef{#2endmonth}{}{% \iffieldequalstr{#2endmonth}{}{% \mbox{\bibdaterangesep}% }{% \bibdaterangesep \enddatecircaprint \iffieldundef{#2season}{% \csuse{mkbibdate#1}{}{#2endmonth}{#2endday}% \blx@printtime{#2}{end}% }{% \csuse{mkbibseasondate#1}{}{#2endseason}}% \enddateuncertainprint}}}}} \newrobustcmd*{\mknoyeardaterangetrunc}[2]{% \iffieldundef{#2month}{}{% \datecircaprint \printtext[#2date]{% \iffieldundef{#2season}{% \ifboolexpr{ test {\iffieldsequal{labelyear}{labelendyear}} and test {\iffieldsequal{#2month}{#2endmonth}} }{% \csuse{mkbibdate#1}{}{}{#2day}% }{% \csuse{mkbibdate#1}{}{#2month}{#2day}}% }{% \csuse{mkbibseasondate#1}{}{#2season}}% \dateuncertainprint \iffieldundef{#2endmonth}{}{% \iffieldequalstr{#2endmonth}{}{% \mbox{\bibdaterangesep}% }{% \bibdaterangesep \enddatecircaprint \iffieldundef{#2season}{% \csuse{mkbibdate#1}{}{#2endmonth}{#2endday}% }{% \csuse{mkbibseasondate#1}{}{#2endseason}}% \enddateuncertainprint}}}}} \xpatchcmd{\mkdaterangefull}{% \iffieldundef{#2year} {\blx@nounit}% }{% \iffieldundef{#2year} {\mknoyeardaterangefull{#1}{#2}}% }{}{\wlog{WARNING: biblatex-oxref (oxyear) failed to patch mkdaterangefull}} \xpatchcmd{\mkdaterangetrunc@i}{% \iffieldundef{#2year} {\blx@nounit}% }{% \iffieldundef{#2year} {\mknoyeardaterangetrunc{#1}{#2}}% }{}{\wlog{WARNING: biblatex-oxref (oxyear) failed to patch mkdaterangetrunc@i}} \xpatchcmd{\mkdaterangefullextra}{% \iffieldundef{#2year} {\blx@nounit}% }{% \iffieldundef{#2year} {\mknoyeardaterangefull{#1}{#2}}% }{}{\wlog{WARNING: biblatex-oxref (oxyear) failed to patch mkdaterangefullextra}} \xpatchcmd{\mkdaterangetruncextra@i}{% \iffieldundef{#2year} {\blx@nounit}% }{% \iffieldundef{#2year} {\mknoyeardaterangetrunc{#1}{#2}}% }{}{\wlog{WARNING: biblatex-oxref (oxyear) failed to patch mkdaterangetruncextra@i}} \DeclareFieldFormat{shorthandwidth}{#1} \xpretonameformat{family-given}{% \iffieldannotation{inferred}{\ifnumequal{\value{listcount}}{1}{\bibopenbracket}{}}{}% \ifitemannotation{inferred}{\bibopenbracket}{}% }{}{\wlog{WARNING: biblatex-oxref (oxyear) failed to prepend to family-given}} \xpatchnameformat{family-given}{% \usebibmacro{name:andothers}% }{% \ifitemannotation{pseudo}{% \addspace\printtext[parens]{\bibsstring{pseudo}}% }{}% \ifitemannotation{inferred}{\bibclosebracket}{}% \usebibmacro{name:andothers}% \iffieldannotation{inferred}{% \ifboolexpr{ test {\ifnumequal{\value{listcount}}{\value{maxnames}}} or test {\ifnumequal{\value{listcount}}{\value{listtotal}}} or ( test {\ifnumequal{\value{listcount}}{\value{minnames}}} and test {\ifnumgreater{\value{listtotal}}{\value{maxnames}}} ) }{\bibclosebracket}{}% }{}% }{}{\wlog{WARNING: biblatex-oxref (oxyear) failed to patch family-given}} \DeclareNameAlias{shortauthor}{family-given} \DeclareNameAlias{shorteditor}{family-given} \DeclareNameAlias{sortname}{family-given} \DeclareNameAlias{author}{family-given} \DeclareNameAlias{editor}{family-given} \DeclareNameAlias{translator}{family-given} \defbibenvironment{bibliography} {\list {} {\setlength{\leftmargin}{\bibhang}% \setlength{\itemindent}{-\leftmargin}% \setlength{\itemsep}{\bibitemsep}% \setlength{\parsep}{\bibparsep}}} {\endlist} {\item} \defbibenvironment{shorthand} {\list {\printfield[shorthandwidth]{shorthand}} {\setlength{\labelwidth}{\shorthandwidth}% \setlength{\leftmargin}{\labelwidth}% \setlength{\labelsep}{\biblabelsep}% \addtolength{\leftmargin}{\labelsep}% \setlength{\itemsep}{\bibitemsep}% \setlength{\parsep}{\bibparsep}% \renewcommand*{\makelabel}[1]{##1\hss}}} {\endlist} {\item} \InitializeBibliographyStyle{\global\undef\bbx@lasthash} \xapptobibmacro{begrelated}{% \booltrue{bbx@inset}}% {}{\wlog{WARNING: biblatex-oxref (oxyear) failed to append to begrelated}} \xapptobibmacro{endrelated}{% \usebibmacro*{bbx:savehash}}% {}{\wlog{WARNING: biblatex-oxref (oxyear) failed to append to endrelated}} \xpatchbibmacro{author}{% \iffieldundef{authortype}% }{% \usebibmacro{date+extradate}% \setunit*{\addspace}% \iffieldundef{authortype}% }{}{\wlog{WARNING: biblatex-oxref (oxyear) failed to patch author (authortype)}}% \xpatchbibmacro{author}{% \global\undef\bbx@lasthash }{% \global\undef\bbx@lasthash \usebibmacro{labeltitle}% \setunit*{\addspace}% \usebibmacro{date+extradate}% }{}{\wlog{WARNING: biblatex-oxref (oxyear) failed to patch author (lasthash)}}% \xpatchbibmacro{namepairs}{% \printnames[by#1]% }{% \printnames[#1]% }{}{\wlog{WARNING: biblatex-oxref (oxyear) failed to patch namepairs}} \xpatchbibmacro{author+altauthor}{% \printnames{author}% }{% \ifboolexpr{% ( not test {\ifnameundef{shortauthor}} ) and test {\ifnumequal{\value{shortauthor}}{\value{author}}} }{% \usebibmacro{namepairs}{author}{shortauthor}% }{% \printnames{author}% }% }{}{\wlog{WARNING: biblatex-oxref (oxyear) failed to patch author+altauthor}}% \xpatchbibmacro{bbx:editor}{% \usebibmacro{#1}% }{% \usebibmacro{date+extradate}% \setunit*{\addspace}% \usebibmacro{#1}% }{}{\wlog{WARNING: biblatex-oxref (oxyear) failed to patch bbx:editor}}% \xpatchbibmacro{bbx:editor}{% \global\undef\bbx@lasthash }{% \global\undef\bbx@lasthash \usebibmacro{labeltitle}% \setunit*{\addspace}% \usebibmacro{date+extradate}% }{}{\wlog{WARNING: biblatex-oxref (oxyear) failed to patch bbx:editor (lasthash)}}% \xpatchbibmacro{editor+alteditor}{% \printnames[byeditor]% }{% \printnames[editor]% }{}{\wlog{WARNING: biblatex-oxref (oxyear) failed to patch editor+alteditor}} \xpatchbibmacro{editor+alteditor}{% \printnames{editor}% }{% \ifboolexpr{% ( not test {\ifnameundef{shorteditor}} ) and test {\ifnumequal{\value{shorteditor}}{\value{editor}}} }{% \usebibmacro{namepairs}{editor}{shorteditor}% }{% \printnames{editor}% }% }{}{\wlog{WARNING: biblatex-oxref (oxyear) failed to patch editor+alteditor (shorteditor)}}% \xpatchbibmacro{bbx:translator}{% \global\undef\bbx@lasthash }{% \global\undef\bbx@lasthash \usebibmacro{labeltitle}% \setunit*{\addspace}% \usebibmacro{date+extradate}% }{}{\wlog{WARNING: biblatex-oxref (oxyear) failed to patch bbx:translator (lasthash)}}% \xpatchbibmacro{bbx:translator}{% \usebibmacro{#1}% }{% \usebibmacro{date+extradate}% \setunit*{\addspace}% \usebibmacro{#1}% }{}{\wlog{WARNING: biblatex-oxref (oxyear) failed to patch bbx:translator}}% \newtoggle{blx@ox@clearedtitle} \newbibmacro*{labeltitle}{% \iffieldundef{label}{% \iffieldundef{shorttitle}{% \ifboolexpr{ test {\iffieldundef{title}} and test {\iffieldundef{subtitle}} }{% \printfield{library}% \clearfield{library}% }{% \printtext[title]{% \printfield[titlecase]{title}% \setunit{\subtitlepunct}% \printfield[titlecase]{subtitle}}% \clearfield{title}% \clearfield{subtitle}% \toggletrue{blx@ox@clearedtitle}% \setunit{\addspace}% }% }{% \printtext[title]{\printfield[titlecase]{shorttitle}}% }% }{% \printfield{label}% }% } \xpretobibmacro{maintitle+title}{% \iftoggle{blx@ox@clearedtitle}{% \usebibmacro{maintitle+volume}% \clearfield{maintitle}% \clearfield{volume}% }{}% }{}{\wlog{WARNING: biblatex-oxref (oxyear) failed to prepend to maintitle+title}} \DeclareFieldFormat[mvbook,mvcollection,mvreference,proceedings,mvproceedings]{maintitle+volume}{#1} \xpatchbibdriver{online}{% \iffieldundef{year}% }{% \ifboolexpr{ test {\iffieldundef{season}} and test {\iffieldundef{month}} }% }{}{\wlog{WARNING: biblatex-oxref (oxyear) failed to patch online}} \DeclareFieldFormat[bookinbook]{citetitle}{% \ifboolexpr{ test {\iffieldequalstr{entrysubtype}{poem}} or test {\iffieldequalstr{entrysubtype}{play}} }{% \mkbibemph{#1}% }{% \mkbibquote{#1\isdot}}} \DeclareFieldFormat[suppperiodical,inaudio,inmusic,inmovie,invideo,online,% image,manuscript,unpublished]{citetitle}{% \def\currentfield{title}% \ifboolexpr{ test {\iffieldannotation{descriptor}} or ( test {\iffieldundef{shorttitle}} and test {\iffieldundef{title}} ) }{#1}{\mkbibquote{#1\isdot}}% \undef\currentfield} \DeclareFieldFormat[suppperiodical,inaudio,inmusic,inmovie,invideo,online,% image,manuscript,unpublished]{citetitle}{% \def\currentfield{title}% \ifboolexpr{ test {\iffieldannotation{descriptor}} or ( test {\iffieldundef{shorttitle}} and test {\iffieldundef{title}} ) }{#1}{\mkbibquote{#1\isdot}}% \undef\currentfield} \DeclareFieldFormat[audio,music]{citetitle}{% \def\currentfield{title}% \ifboolexpr{ test {\iffieldannotation{descriptor}} or ( test {\iffieldundef{shorttitle}} and test {\iffieldundef{title}} ) }{#1}{% \iffieldequalstr{entrysubtype}{podcast}{% \mkbibquote{#1\isdot}% }{% \mkbibemph{#1}}}% \undef\currentfield} \DeclareFieldFormat[movie,video]{citetitle}{% \def\currentfield{title}% \ifboolexpr{ test {\iffieldannotation{descriptor}} or ( test {\iffieldundef{shorttitle}} and test {\iffieldundef{title}} ) }{#1}{% \ifboolexpr{ test {\iffieldequalstr{entrysubtype}{episode}} or test {\iffieldequalstr{entrysubtype}{clip}} or test {\iffieldequalstr{entrysubtype}{webcast}} }{% \mkbibquote{#1\isdot}% }{% \mkbibemph{#1}}}% \undef\currentfield} \DeclareFieldFormat[legislation,legal]{citetitle}{#1} \DeclareFieldFormat[misc]% {citetitle}{% \def\currentfield{title}% \ifboolexpr{ test {\iffieldannotation{descriptor}} or ( test {\iffieldundef{shorttitle}} and test {\iffieldundef{title}} ) }{#1}{% \iffieldequalstr{relatedtype}{in}{% \mkbibquote{#1\isdot}% }{% \mkbibemph{#1}% }}% \undef\currentfield} \renewcommand*{\bibpagespunct}{% \ifboolexpr{ test {\ifentrytype{article}} or test {\ifentrytype{suppperiodical}} or test {\ifentrytype{review}} }{% \addcolon\space }{% \addcomma\space }% } \renewbibmacro{manuscript:date}{% \ifboolexpr{ test {\ifnameundef{author}} and not togl {blx@ox@clearedtitle} and test {\iffieldundef{label}} }{}{\usebibmacro{date}}} \DeclareLabeltitle{% \field{shorttitle} \field{title} \field{maintitle} \field{library} } \DeclareStyleSourcemap{% \maps[datatype=bibtex]{% \map[overwrite=true]{ \step[notmatch=\regexp{nonodate}, fieldsource=options, final] \step[fieldsource=sortyear, final] \step[fieldset=options, append, fieldvalue={,nonodate}] } \map[overwrite=true]{ \step[notfield=options, final] \step[fieldsource=sortyear, final] \step[fieldset=options, fieldvalue={nonodate}] } \map[overwrite=false]{ \pertype{standard} \step[notfield=author, fieldsource=number, fieldtarget=label] } }} %% %% Copyright (C) 2016–2019 Alex Ball %% %% End of file `oxyear.bbx'.