diff options
Diffstat (limited to 'macros/latex/contrib/biblatex-contrib/biblatex-publist/publist.bbx')
-rw-r--r-- | macros/latex/contrib/biblatex-contrib/biblatex-publist/publist.bbx | 992 |
1 files changed, 764 insertions, 228 deletions
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-publist/publist.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-publist/publist.bbx index c89a6f821f..ab5d84b08a 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-publist/publist.bbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-publist/publist.bbx @@ -25,8 +25,8 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\def\bpl@version{1.27} -\def\bpl@rdate{2022/10/03} +\def\bpl@version{2.0} +\def\bpl@rdate{2022/10/24} \ProvidesFile{publist.bbx}[\bpl@rdate\space v.\bpl@version\space biblatex bibliography style (JSP)] @@ -45,159 +45,432 @@ % Bibliography Options and Base Style % -% Deprecated Options (as of v. 1.4) -\DeclareBibliographyOption{omitname}{% - \PackageWarning{biblatex-publist} - {The omitname option is deprecated!\MessageBreak - Please use plauthorname instead.}{}% - \def\bpl@osurname{#1}} -\DeclareBibliographyOption{omitfirstname}{% - \PackageWarning{biblatex-publist} - {The omitfirstname option is deprecated!\MessageBreak - Please use plauthorfirstname instead.}{}% - \def\bpl@ofirstname{#1}} -\DeclareBibliographyOption{omitnameprefix}{% - \PackageWarning{biblatex-publist} - {The omitnameprefix option is deprecated!\MessageBreak - Please use plauthornameprefix instead.}{}% - \def\bpl@ovonpart{#1}} - -% Valid options -\DeclareBibliographyOption{plauthorname}{\def\bpl@osurname{#1}} -\DeclareBibliographyOption{plauthorfirstname}{\def\bpl@ofirstname{#1}} -\DeclareBibliographyOption{plauthornameprefix}{\def\bpl@ovonpart{#1}} - +% Toggles and switches +% \newif\if@marginyear\@marginyearfalse -\DeclareBibliographyOption{marginyear}[true]{% - \ifstrequal{#1}{true}{\@marginyeartrue\reversemarginpar}{\@marginyearfalse} -} - -\newif\if@unboldyear\@unboldyearfalse -\DeclareBibliographyOption{boldyear}[true]{% - \ifstrequal{#1}{false}{\@unboldyeartrue}{\@unboldyearfalse} -} - +\newif\if@hlyear\@hlyeartrue \newif\if@pubstateextra\@pubstateextrafalse -\DeclareBibliographyOption{pubstateextra}[true]{% - \ifstrequal{#1}{true}{\@pubstateextratrue}{\@pubstateextrafalse} -} - \newif\if@hlauthor\@hlauthorfalse -\DeclareBibliographyOption{plauthorhandling}[omit]{% - \ifstrequal{#1}{highlight}{\@hlauthortrue}{\@hlauthorfalse} -} - \newif\if@givenfirst\@givenfirstfalse -\DeclareBibliographyOption{nameorder}[family-given]{% - \ifstrequal{#1}{given-family}{\@givenfirsttrue}{\@givenfirstfalse} -} - -\newtoggle{firstinit} -\DeclareBibliographyOption{plauthorfirstinit}[true]{% - \ifstrequal{#1}{false}{\togglefalse{firstinit}}{\toggletrue{firstinit}} -} - +\newtoggle{bpl@firstinit} \newif\if@bpl@numbered\@bpl@numberedtrue \newif\if@bpl@numberreset\@bpl@numberresetfalse -\DeclareBibliographyOption{plnumbered}[true]{% - \ifstrequal{#1}{false}{% 1. "false" - \defbibenvironment{bibliography} - {\list - {} - {\setlength{\leftmargin}{\bibhang}% - \setlength{\itemindent}{-\leftmargin}% - \setlength{\itemsep}{\bibitemsep}% - \setlength{\parsep}{\bibparsep}}% - } - {\endlist} - {\item}}{% else: 2. "reset" - \ifstrequal{#1}{reset}{% - \@bpl@numberresettrue% - \defbibenvironment{bibliography} - {\addtolength{\labelnumberwidth}{\extralabelnumberwidth}% - \list - {\printtext[labelnumberwidth]{% - \printfield{labelprefix}% - \printfield{labelnumber}}} - {\setlength{\labelwidth}{\labelnumberwidth}% - \setlength{\leftmargin}{\labelwidth}% - \setlength{\labelsep}{\biblabelsep}% - \addtolength{\leftmargin}{\labelsep}% - \setlength{\itemsep}{\bibitemsep}% - \setlength{\parsep}{\bibparsep}}}% - {\endlist - \csnumdef{blx@labelnumber@\the\c@refsection}{0}% - } - {\item} - }{% else: "true" (default: nothing to do here) - }% end of clause - } -} - \newtoggle{bpl@linktitle} \newtoggle{bpl@linktitleisbn} \newtoggle{bpl@linktitleissn} \newtoggle{bpl@linktitleurl} \newtoggle{bpl@linktitledoi} -\DeclareBibliographyOption{linktitleall}[true]{% - \ifstrequal{#1}{true}{ - \toggletrue{bpl@linktitleisbn} - \toggletrue{bpl@linktitleissn} - \toggletrue{bpl@linktitleurl} - \toggletrue{bpl@linktitledoi} - \toggletrue{bpl@linktitle} - }{% - \togglefalse{bpl@linktitleisbn} - \togglefalse{bpl@linktitleissn} - \togglefalse{bpl@linktitleurl} - \togglefalse{bpl@linktitledoi} - \togglefalse{bpl@linktitle} - }% -} -\DeclareBibliographyOption{linktitleurl}[true]{% - \ifstrequal{#1}{true}{% - \toggletrue{bpl@linktitleurl} - \toggletrue{bpl@linktitle} - }{% - \togglefalse{bpl@linktitleurl} - }% -} -\DeclareBibliographyOption{linktitledoi}[true]{% - \ifstrequal{#1}{true}{% - \toggletrue{bpl@linktitledoi} - \toggletrue{bpl@linktitle} - }{% - \togglefalse{bpl@linktitledoi} - }% -} -\DeclareBibliographyOption{linktitleisbn}[true]{% - \ifstrequal{#1}{true}{% - \toggletrue{bpl@linktitleisbn} - \toggletrue{bpl@linktitle} - }{% - \togglefalse{bpl@linktitleisbn} - }% +\newtoggle{bpl@jifinfo} +\newtoggle{bpl@prinfo} +\toggletrue{bpl@prinfo} +\newtoggle{bpl@oainfo} +\newtoggle{bpl@oainfosimple} +\newif\if@bpl@reversenum\@bpl@reversenumfalse + + +% Valid options +% + +% We use l3keys here since (1) LaTeX2e keys are rather +% new and (2) do not provide for choice keys yet. +\ExplSyntaxOn +\keys_define:nn { bpl } +{ + % plauthorname=<name> + % Store author family name + plauthorname.tl_set:N = \bpl@osurname, + % plauthorfirstname=<name> + % Store author first name + plauthorfirstname.tl_set:N = \bpl@ofirstname, + % plauthornameprefix=<name> + % Store author name prefix + plauthornameprefix.tl_set:N = \bpl@ovonpart, + % marginyear=<true|false> + % Print year in margin + marginyear.code:n = + { + \str_if_eq:nnTF { #1 } { true } + { + \@marginyeartrue + \reversemarginpar + }{ + \@marginyearfalse + } + }, + marginyear.default:n = { true }, + % hlyear=<true|false> + % Set year highlighted + hlyear.legacy_if_set:n = @hlyear, + % pubstateextra=<true|false> + % Extra label for pubstates + pubstateextra.legacy_if_set:n = @pubstateextra, + pubstateextra.usage:n = preamble, + % plauthorhandling=<highlight|omit> + % Highlight or omit pl author? + plauthorhandling.choice:, + % highlight + plauthorhandling / highlight.code:n = + { + \@hlauthortrue + \bpl@set@defsorting + }, + % omit + plauthorhandling / omit.code:n = + { + \@hlauthorfalse + \bpl@set@defsorting + }, + plauthorhandling.default:n = { omit }, + % nameorder=<family-given|given-family> + % Ordering of plauthor name + nameorder.choice:, + % given-family + nameorder / given-family.code:n = { \@givenfirsttrue }, + % family-given + nameorder / family-given.code:n = { \@givenfirstfalse }, + nameorder.default:n = { family-given }, + % plsorting=<sortingscheme> + % Set a sorting scheme + plsorting.code:n = + { + \bpl@set@defsorting[#1] + }, + plsorting.default:n = { ydt }, + % plauthorfirstinit=<true|false> + % Pass initial as first name + plauthorfirstinit.code:n = + { + \str_if_eq:nnTF { #1 } { true } + { + \toggletrue{bpl@firstinit} + }{ + \togglefalse{bpl@firstinit} + } + }, + plauthorfirstinit.default:n = { true }, + % plnumbering=<global|local|global-descending|local-descending|none> + % Select numbering scheme + plnumbering .choice:, + % global: use default consecutive numbering + plnumbering / global .code:n = + { \@bpl@numberresetfalse }, + % local: use local numbering + plnumbering / local .code:n = + { \@bpl@numberresettrue }, + % global-descending: use default consecutive numbering + plnumbering / global-descending .code:n = + { + \@bpl@numberresetfalse + \@bpl@reversenumtrue + }, + % local-descending: use local numbering + plnumbering / local-descending .code:n = + { + \@bpl@numberresettrue + \@bpl@reversenumtrue + }, + % none: no numbering at all + plnumbering / none .code:n = + { + \defbibenvironment{bibliography} + {\list + {} + {\setlength{\leftmargin}{\bibhang}% + \setlength{\itemindent}{-\leftmargin}% + \setlength{\itemsep}{\bibitemsep}% + \setlength{\parsep}{\bibparsep}}% + } + {\endlist} + {\item}% + }, + plnumbering.default:n = { global }, + plnumbering.usage:n = preamble, + % linktitles=<all|url|doi|isbn|issn|none> + linktitles .multichoice:, + % Link all titles + linktitles / all.code:n = + { + \toggletrue{bpl@linktitleisbn} + \toggletrue{bpl@linktitleissn} + \toggletrue{bpl@linktitleurl} + \toggletrue{bpl@linktitledoi} + \toggletrue{bpl@linktitle} + }, + % Link no titles + linktitles / none.code:n = + { + \togglefalse{bpl@linktitleisbn} + \togglefalse{bpl@linktitleissn} + \togglefalse{bpl@linktitleurl} + \togglefalse{bpl@linktitledoi} + \togglefalse{bpl@linktitle} + }, + % Link titles with URL + linktitles / url.code:n = + { + \toggletrue{bpl@linktitleurl} + \toggletrue{bpl@linktitle} + }, + % Link titles with DOI + linktitles / doi.code:n = + { + \toggletrue{bpl@linktitledoi} + \toggletrue{bpl@linktitle} + }, + % Link titles with ISBN + linktitles / isbn.code:n = + { + \toggletrue{bpl@linktitleisbn} + \toggletrue{bpl@linktitle} + }, + % Link titles with ISSN + linktitles / issn.code:n = + { + \toggletrue{bpl@linktitleissn} + \toggletrue{bpl@linktitle} + }, + linktitles.default:n = { all }, + % jifinfo=<true|false> + % Impact factor information + jifinfo.code:n = + { + \str_if_eq:nnTF { #1 } { true } + { + \toggletrue{bpl@jifinfo} + }{ + \togglefalse{bpl@jifinfo} + } + }, + jifinfo.default:n = { true }, + % oainfo=<verbose|simple|nonr> + % Output OpenAccess information + oainfo .choice:, + oainfo / verbose.code:n = + { + \toggletrue{bpl@oainfo} + \togglefalse{bpl@oainfosimple} + }, + oainfo / simple.code:n = + { + \toggletrue{bpl@oainfo} + \toggletrue{bpl@oainfosimple} + }, + oainfo / none.code:n = + { + \togglefalse{bpl@oainfo} + \togglefalse{bpl@oainfosimple} + }, + oainfo.default:n = { simple }, + % prinfo=<true|false> + % Output peer-review information + prinfo.code:n = + { + \str_if_eq:nnTF { #1 } { true } + { + \toggletrue{bpl@prinfo} + }{ + \togglefalse{bpl@prinfo} + } + }, + prinfo.default:n = { true } } -\DeclareBibliographyOption{linktitleissn}[true]{% - \ifstrequal{#1}{true}{% - \toggletrue{bpl@linktitleissn} - \toggletrue{bpl@linktitle} - }{% - \togglefalse{bpl@linktitleissn} - }% + +% +% Deprecated options +% +\keys_define:nn { bpl-deprecated } +{ + % plnumbered=<true|false|reset> + % Select numbering scheme + plnumbered .choice:, + % false: no numbering at all + plnumbered / false .code:n = + { + \defbibenvironment{bibliography} + {\list + {} + {\setlength{\leftmargin}{\bibhang}% + \setlength{\itemindent}{-\leftmargin}% + \setlength{\itemsep}{\bibitemsep}% + \setlength{\parsep}{\bibparsep}}% + } + {\endlist} + {\item}% + }, + % true: use default consecutive numbering + plnumbered / true .code:n = + { + \@bpl@numberresetfalse + }, + % reset: use local numbering + plnumbered / reset .code:n = + { + \@bpl@numberresettrue + }, + plnumbered.default:n = { true }, + plnumbered.usage:n = preamble, + % reversenumbering=<true|false> + % Use descending numbers + reversenumbering.code:n = + { + \str_if_eq:nnTF { #1 } { true } + { + \@bpl@reversenumtrue + }{ + \@bpl@reversenumfalse + } + }, + reversenumbering.usage:n = preamble, + % boldyear=<true|false> + % Set year bold + boldyear.legacy_if_set:n = @hlyear, + % linktitleall=<true|false> + % Link all titles + linktitleall.code:n = + { + \str_if_eq:nnTF { #1 } { true } + { + \toggletrue{bpl@linktitleisbn} + \toggletrue{bpl@linktitleissn} + \toggletrue{bpl@linktitleurl} + \toggletrue{bpl@linktitledoi} + \toggletrue{bpl@linktitle} + }{ + \togglefalse{bpl@linktitleisbn} + \togglefalse{bpl@linktitleissn} + \togglefalse{bpl@linktitleurl} + \togglefalse{bpl@linktitledoi} + \togglefalse{bpl@linktitle} + } + }, + linktitleall.default:n = { true }, + % linktitleurl=<true|false> + % Link titles with URL + linktitleurl.code:n = + { + \str_if_eq:nnTF { #1 } { true } + { + \toggletrue{bpl@linktitleurl} + \toggletrue{bpl@linktitle} + }{ + \togglefalse{bpl@linktitleurl} + } + }, + linktitleurl.default:n = { true }, + % linktitledoi=<true|false> + % Link titles with DOI + linktitledoi.code:n = + { + \str_if_eq:nnTF { #1 } { true } + { + \toggletrue{bpl@linktitledoi} + \toggletrue{bpl@linktitle} + }{ + \togglefalse{bpl@linktitledoi} + } + }, + linktitledoi.default:n = { true }, + % linktitledoi=<true|false> + % Link titles with ISBN + linktitleisbn.code:n = + { + \str_if_eq:nnTF { #1 } { true } + { + \toggletrue{bpl@linktitleisbn} + \toggletrue{bpl@linktitle} + }{ + \togglefalse{bpl@linktitleisbn} + } + }, + linktitleisbn.default:n = { true }, + % linktitledoi=<true|false> + % Link titles with ISSN + linktitleissn.code:n = + { + \str_if_eq:nnTF { #1 } { true } + { + \toggletrue{bpl@linktitleissn} + \toggletrue{bpl@linktitle} + }{ + \togglefalse{bpl@linktitleissn} + } + }, + linktitleissn.default:n = { true } } -\newtoggle{bpl@prinfo} -\toggletrue{bpl@prinfo} -\DeclareBibliographyOption{prinfo}[true]{% - \ifstrequal{#1}{true}{\toggletrue{bpl@prinfo}}{\togglefalse{bpl@prinfo}} +% Command to set options +\NewDocumentCommand { \ExecutePublistOptions } { m } +{ + \keys_set:nn { bpl } { #1 } } -\newif\if@bpl@reversenum\@bpl@reversenumfalse -\DeclareBibliographyOption{reversenumbering}[true]{% - \ifstrequal{#1}{true}{\@bpl@reversenumtrue}{\@bpl@reversenumfalse} +% Command to set deprecated options +\NewDocumentCommand { \ExecuteDepPublistOptions } { m m } +{ + \keys_set:nn { bpl-deprecated } { #1 } + + \PackageWarning{biblatex-publist}% + {The~ option~ `#1'~ is~ deprecated!\MessageBreak + Please~ use~ the~ option~ `#2'~ instead.} } +\ExplSyntaxOff + +% Biblatex options directly feed into the l3 options +% +\DeclareBibliographyOption{plauthorname}{\ExecutePublistOptions{plauthorname=#1}} +\DeclareBibliographyOption{plauthorfirstname}{\ExecutePublistOptions{plauthorfirstname=#1}} +\DeclareBibliographyOption{plauthornameprefix}{\ExecutePublistOptions{plauthornameprefix=#1}} +\DeclareBibliographyOption{plauthorfirstinit}[true]{\ExecutePublistOptions{plauthorfirstinit=#1}} +\DeclareBibliographyOption{plauthorhandling}[omit]{\ExecutePublistOptions{plauthorhandling=#1}} +\DeclareBibliographyOption{nameorder}[family-given]{\ExecutePublistOptions{nameorder=#1}} +\DeclareBibliographyOption{plsorting}[ydt]{\ExecutePublistOptions{plsorting=#1}} + +\DeclareBibliographyOption{plnumbering}[global]{\ExecutePublistOptions{plnumbering=#1}} +\DeclareBibliographyOption{marginyear}[true]{\ExecutePublistOptions{marginyear=#1}} +\DeclareBibliographyOption{hlyear}[true]{\ExecutePublistOptions{hlyear=#1}} +\DeclareBibliographyOption{pubstateextra}[true]{\ExecutePublistOptions{pubstateextra=#1}} +\DeclareBibliographyOption{jifinfo}[true]{\ExecutePublistOptions{jifinfo=#1}} +\DeclareBibliographyOption{oainfo}[simple]{\ExecutePublistOptions{oainfo=#1}} +\DeclareBibliographyOption{prinfo}[true]{\ExecutePublistOptions{prinfo=#1}} + +\DeclareBibliographyOption{linktitles}[all]{\ExecutePublistOptions{linktitles={#1}}}% Extra braces needed (multichoice) + + + +% Deprecated Options +% +% Deprecated as of v. 1.4 +\DeclareBibliographyOption{omitname}{% + \PackageWarning{biblatex-publist} + {The omitname option is deprecated!\MessageBreak + Please use plauthorname instead.}{}% + \def\bpl@osurname{#1}} +\DeclareBibliographyOption{omitfirstname}{% + \PackageWarning{biblatex-publist} + {The omitfirstname option is deprecated!\MessageBreak + Please use plauthorfirstname instead.}{}% + \def\bpl@ofirstname{#1}} +\DeclareBibliographyOption{omitnameprefix}{% + \PackageWarning{biblatex-publist} + {The omitnameprefix option is deprecated!\MessageBreak + Please use plauthornameprefix instead.}{}% + \def\bpl@ovonpart{#1}} +% +% Deprecated as of v. 2.0 +\DeclareBibliographyOption{plnumbered}[true]{\ExecuteDepPublistOptions{plnumbered=#1}{plnumbering}} +\DeclareBibliographyOption{reversenumbering}[true]{\ExecuteDepPublistOptions{reversenumbering=#1}{plnumbering}} +\DeclareBibliographyOption{boldyear}[true]{\ExecuteDepPublistOptions{boldyear=#1}{hlyear}} +\DeclareBibliographyOption{linktitleall}[true]{\ExecuteDepPublistOptions{linktitleall=#1}{linktitles}} +\DeclareBibliographyOption{linktitleurl}[true]{\ExecuteDepPublistOptions{linktitleurl=#1}{linktitles}} +\DeclareBibliographyOption{linktitledoi}[true]{\ExecuteDepPublistOptions{linktitledoi=#1}{linktitles}} +\DeclareBibliographyOption{linktitleisbn}[true]{\ExecuteDepPublistOptions{linktitleisbn=#1}{linktitles}} +\DeclareBibliographyOption{linktitleissn}[true]{\ExecuteDepPublistOptions{linktitleissn=#1}{linktitles}} + + +% Base style +% + % Check if users have defined different base styles % If not, use authoryear. \newif\ifbpl@standardbasestyle\bpl@standardbasestylefalse @@ -211,14 +484,28 @@ pagetracker=true, labelnumber, useprefix=false, - defernumbers=true} + defernumbers=true% +} + +\newcommand*\bpl@set@defsorting[1][\empty]{% + \edef\bpl@scheme{#1}% + \ifx#1\empty + % Default sorting depends on plauthorhandling + \if@hlauthor% + \edef\bpl@scheme{ydnt}% + \else + \edef\bpl@scheme{ydt}% + \fi + \fi + \ifx\@onlypreamble\@notprerr + \newrefcontext[sorting=\bpl@scheme] + \else + \ExecuteBibliographyOptions{sorting=\bpl@scheme} + \fi +} -% Default sorting depends on plauthorhandling -\if@hlauthor% - \ExecuteBibliographyOptions{sorting=ydnt} -\else - \ExecuteBibliographyOptions{sorting=ydt} -\fi +% Initialize +\bpl@set@defsorting % Execute these options only with the standard base style \ifbpl@standardbasestyle @@ -237,6 +524,20 @@ % Helper functions % +% Only provided by biblatex 3.19ff., so we roll our own +\@ifundefined{AtNextRefsection}{% + \newrobustcmd*{\AtNextRefsection}{% + \ifundef\blx@hook@refsection@next + {\gdef\blx@hook@refsection@next{\global\undef\blx@hook@refsection@next}} + {}% + \gappto\blx@hook@refsection@next% + } + \patchcmd{\blx@refsection@i}% + {\csuse{blx@hook@refsectioninit}}% + {\csuse{blx@hook@refsectioninit}\csuse{blx@hook@refsection@next}} + {}{\PackageWarning{biblatex-publist}{Patching refsection failed!}} +}{} + % % Removing braces from names (courtesy of egreg at % http://tex.stackexchange.com/a/79583/19291) @@ -294,13 +595,13 @@ \def\bpl@lsurname{} \def\bpl@lfirstname{} \def\bpl@lvonpart{} -\def\jsp@splitpllist#1{% +\def\bpl@splitpllist#1{% \begingroup \protected@edef\@tempa{#1}% \expandafter\endgroup - \expandafter\jsp@@splitpllist\@tempa\relax% + \expandafter\bpl@@splitpllist\@tempa\relax% } -\def\jsp@@splitpllist#1,#2,#3\relax{% +\def\bpl@@splitpllist#1,#2,#3\relax{% \global\def\bpl@lfirstname{#1}% \global\def\bpl@lvonpart{#2}% \global\def\bpl@lsurname{#3}% @@ -322,7 +623,7 @@ test { \bpl@ifstreq{\bpl@esurname}{\bpl@tsurname} } and ( test { \bpl@ifstreq{\bpl@efirstname}{\bpl@tfirstname} } or test { \ifdefstring{\bpl@ofirstname}{} } - or ( test { \iftoggle{firstinit} } and test{ \bpl@iffirstcharequal{\bpl@efirstname}{\bpl@tfirstname} } ) + or ( test { \iftoggle{bpl@firstinit} } and test{ \bpl@iffirstcharequal{\bpl@efirstname}{\bpl@tfirstname} } ) ) and ( test { \bpl@ifstreq{\bpl@evonpart}{\bpl@tvonpart} } or test { \ifdefstring{\bpl@ovonpart}{} }) } @@ -332,7 +633,7 @@ \def\bpl@lfirstname{}% \def\bpl@lvonpart{}% \renewcommand*{\do}[1]{% - \jsp@splitpllist{##1}% + \bpl@splitpllist{##1}% \bpl@normalize{\bpl@lsurname}{\bpl@elsurname}% \bpl@normalize{\bpl@lfirstname}{\bpl@elfirstname}% \bpl@normalize{\bpl@lvonpart}{\bpl@elvonpart}% @@ -340,7 +641,7 @@ test { \bpl@ifstreq{\bpl@elsurname}{\bpl@tsurname} } and ( test { \bpl@ifstreq{\bpl@elfirstname}{\bpl@tfirstname} } or test { \ifdefstring{\bpl@lfirstname}{} } - or ( test { \iftoggle{firstinit} } and test{ \bpl@iffirstcharequal{\bpl@lfirstname}{\bpl@tfirstname} } ) + or ( test { \iftoggle{bpl@firstinit} } and test{ \bpl@iffirstcharequal{\bpl@lfirstname}{\bpl@tfirstname} } ) ) and ( test { \bpl@ifstreq{\bpl@elvonpart}{\bpl@tvonpart} } or test { \ifdefstring{\bpl@lvonpart}{} }) } @@ -388,7 +689,13 @@ } % -% Highlighting auf publist author with plauthorhandling=highlight +% Highlighting of the year with hlyear=true +\providecommand*\plyearhl[1]{% + \mkbibbold{#1}% +} + +% +% Highlighting of publist author with plauthorhandling=highlight \providecommand*\plauthorhl[1]{% \mkbibbold{#1}% } @@ -407,6 +714,7 @@ % % Omission of names in truncated autor list \newcommand*\plnameomission{\bibellipsis\addcomma\addspace} +\newcommand*\plextrainfosep{\addsemicolon\addspace} % @@ -415,12 +723,41 @@ \csnumgdef{bpl@itemtotal}{0} \csnumgdef{bpl@currentitem}{0} \csnumgdef{bpl@saverefsection}{0} -\csnumgdef{bpl@currentitem}{0} -\csnumgdef{bpl@all@entrycount}{0} -\csnumgdef{bpl@comp@entrycount:0}{0} +\csnumgdef{bpl@secitems:0}{0} +\csnumgdef{bpl@savesecitems}{0} +\newcounter{bplitems} +\setcounter{bplitems}{0} +\newcounter{bplsecitems} +\setcounter{bplsecitems}{0} +\newcounter{bplbgitems} +\setcounter{bplbgitems}{0} +\newcounter{plnumgroup} +\setcounter{plnumgroup}{0} \newbool{newsection} +\newbool{needbpxrerun} +\newbool{plnumgroup} +\def\resetplnumgroup{} + +\newenvironment{plnumgroup}% + {% + \global\booltrue{plnumgroup}% + \stepcounter{plnumgroup}% + \setcounter{bplbgitems}{0}% + \csnumgdef{bpl@numgroup@done}{0}% + \if@bpl@numberreset% + \ifbool{@bpl@reversenum}{% + \csnumgdef{bpl@itemtotal}{\csuse{bpl@savesecitems:\theplnumgroup}}% + }{}% + \fi% + }{% + \AtNextRefsection{% + \global\boolfalse{plnumgroup}% + \stepcounter{plnumgroup}% + \resetplnumgroup% + }% + }% -\preto\blx@refsection{\global\setbool{newsection}{true}} +\preto\blx@refsection{\global\booltrue{newsection}} % Possibility to manually make the space occupied by the label wider \newlength\extralabelnumberwidth @@ -429,6 +766,10 @@ \defbibenvironment{bibliography} {% \addtolength{\labelnumberwidth}{\extralabelnumberwidth}% + \setcounter{bplsecitems}{0}% + \ifcsundef{bpl@savesecitems:\theplnumgroup}{% + \csnumgdef{bpl@savesecitems:\theplnumgroup}{0}% + }{}% \list {\printtext[labelnumberwidth]{% \printfield{labelprefix}% @@ -444,21 +785,80 @@ \renewcommand*{\makelabel}[1]{\hss##1}% }% {\endlist - \ifnumgreater{\c@refsection}{\bpl@saverefsection}% - {\if@bpl@reversenum - \csnumgdef{bpl@itemtotal}{\csuse{bpl@itemtotal}}% - \else - \csnumgdef{bpl@itemtotal}{\csuse{bpl@itemtotal}+\csuse{bpl@currentitem}}% - \fi}{}% + \if@bpl@numberreset + \ifbool{manitemreset}{% + % Set back start number after manually set section + \global\csnumgdef{bpl@set@itemtotal}{0}% + \global\boolfalse{manitemreset}% + }{}% + \ifnumgreater{\c@refsection}{\bpl@saverefsection}% + {% + \csnumdef{blx@labelnumber@\the\c@refsection}{0}% + \ifbool{@bpl@reversenum}{% + \ifbool{plnumgroup}{% + \csnumgdef{bpl@numgroup@done}{\csuse{bpl@numgroup@done}+\csuse{bpl@savesecitems}}% + \csnumgdef{bpl@itemtotal}{\csuse{bpl@savesecitems:\theplnumgroup}-\csuse{bpl@numgroup@done}}% + \gdef\resetplnumgroup{\csnumgdef{bpl@itemtotal}{\csuse{bpl@set@itemtotal}}}% + }{% + \csnumgdef{bpl@itemtotal}{\csuse{bpl@set@itemtotal}}% + } + }{% + \ifbool{plnumgroup}{% + \csnumgdef{bpl@itemtotal}{\csuse{bpl@itemtotal}+\csuse{bpl@savesecitems}}% + \gdef\resetplnumgroup{\csnumgdef{bpl@itemtotal}{\csuse{bpl@set@itemtotal}}}% + }{% + \csnumgdef{bpl@itemtotal}{\csuse{bpl@set@itemtotal}}% + } + }% + }{}% + \else + \ifnumgreater{\c@refsection}{\bpl@saverefsection}% + {\if@bpl@reversenum + \csnumgdef{bpl@itemtotal}{\csuse{bpl@itemtotal}}% + \else + \csnumgdef{bpl@itemtotal}{\csuse{bpl@itemtotal}+\csuse{bpl@currentitem}}% + \fi% + }{}% + \fi \csnumgdef{bpl@saverefsection}{\c@refsection}% + \if@bpl@reversenum% + % Write item count to the bpx file + \global\boolfalse{needbpxrerun}% + \if@filesw% + % Check if we have a changed value + \ifcsdef{bpl@items:\therefsection}{% + \ifnumequal{\value{bplitems}}{\numexpr\csuse{bpl@items:\therefsection}\relax}{}{% + \global\booltrue{needbpxrerun} + } + }{\global\booltrue{needbpxrerun}} + \protected@write\bpl@bpxfile{}{% + \protect\csdef{bpl@items:\therefsection}{\thebplitems}% + \protect\csdef{bpl@items}{\thebplitems}% + \protect\csdef{bpl@secitems:\therefsection}{\thebplsecitems}% + \protect\csdef{bpl@savesecitems:\theplnumgroup}{\thebplbgitems}% + }% + \fi + \fi + } + {% + \if@bpl@reversenum% + % We count all really output items for proper reverse numbering + % (global and per section) + \stepcounter{bplitems}% + \fi% + \stepcounter{bplsecitems}% + \ifbool{plnumgroup}{% + \stepcounter{bplbgitems}% + \csnumgdef{bpl@savesecitems}{\thebplsecitems}% + }{}% + \item% } - {\item} \DeclareFieldFormat{labelnumber}{% \ifbool{newsection}{% % Fix start counter value \mkbibsecstart{#1}% - \global\setbool{newsection}{false}% + \global\boolfalse{newsection}% }{}% \mkbibdesc{#1}% \csnumgdef{bpl@currentitem}{#1}% @@ -466,61 +866,123 @@ \newrobustcmd{\mkbibdesc}[1]{% % Print labelnumber as actual number, plus item total - \number\numexpr\csuse{bpl@itemtotal}+#1\relax% + \number\numexpr\csuse{bpl@itemtotal}+#1+\csuse{bpl@shift@itemtotal}\relax% }% -\newrobustcmd{\mkbibsecstart}[1]{% - \csnumgdef{bpl@itemtotal}{\csuse{bpl@itemtotal}-#1+1}% -} - % Way to manually shift the numbering \csnumgdef{bpl@shift@itemtotal}{0} -\newcommand*\shiftbplnum[1]{% +\newcommand*\shiftplnum[1]{% \csnumgdef{bpl@shift@itemtotal}{#1}% } +% Way to manually set the numbering +\newbool{manitemset} +\newbool{manitemreset} +\csnumgdef{bpl@set@itemtotal}{0} +\newcommand*\setplnum[1]{% + \csnumgdef{bpl@set@itemtotal}{#1-1}% + \global\booltrue{manitemset}% +} + +\newrobustcmd{\mkbibsecstart}[1]{% + \ifbool{manitemset}{% + \csnumgdef{bpl@itemtotal}{\csuse{bpl@set@itemtotal}}% + \global\boolfalse{manitemset}% + \if@bpl@numberreset + \global\booltrue{manitemreset}% + \fi + }{% + \csnumgdef{bpl@itemtotal}{\csuse{bpl@itemtotal}-#1+1}% + } +} + % % Reverse numbering -% Inspired by moewew's approach at -% https://tex.stackexchange.com/a/563328/19291 % +\AtBeginDocument{% + \if@bpl@reversenum + \newread\bpl@read@bpxfile + \immediate\openin\bpl@read@bpxfile=\jobname.bpx + \loop\unless\ifeof\bpl@read@bpxfile + \read\bpl@read@bpxfile to\bpx@data + \ifeof\bpl@read@bpxfile% + \else + \bpx@data + \fi + \repeat + \immediate\closein\bpl@read@bpxfile + \newwrite\bpl@bpxfile + \immediate\openout\bpl@bpxfile=\jobname.bpx + \if@filesw% + \protected@write\bpl@bpxfile{}{\@percentchar\space biblatex-publist auxiliary file: + count of items for reverse numbering}% + \fi + \AtEndDocument{% + \ifbool{needbpxrerun}{% + \PackageWarning{biblatex-publist}{Please rerun LaTeX!\MessageBreak + Still counting items}% + }{} + } + \fi +} + \AtEndOfPackage{% -\newcounter{prevrefsection}% -\if@bpl@reversenum - % Count total number of entries in each refsection - \AtDataInput{% - \ifcategory{filtered}{% - \csnumgdef{bpl@entrycount:\therefsection}{% - \csuse{bpl@entrycount:\therefsection}+1% - }% - \setcounter{prevrefsection}{\therefsection}% - \addtocounter{prevrefsection}{-1}% - \csnumgdef{bpl@comp@entrycount:\therefsection}{% - \csuse{bpl@comp@entrycount:\theprevrefsection}+\csuse{bpl@entrycount:\therefsection}% - }% - \csnumgdef{bpl@all@entrycount}{% - \csuse{bpl@all@entrycount}+1% + \newcounter{prevrefsection}% + \if@bpl@reversenum + \renewrobustcmd{\mkbibdesc}[1]{% + \ifbool{@bpl@numberreset}{% + % Print the labelnumber as the total number of entries in the + % current refsection, minus the actual labelnumber, plus one + \ifbool{plnumgroup}{% + \number\numexpr\csuse{bpl@itemtotal}-#1+1\relax% + }{% + \ifcsdef{bpl@secitems:\therefsection}{% + \number\numexpr\csuse{bpl@secitems:\therefsection}-#1+1% + +\csuse{bpl@shift@itemtotal}\relax% + }{% + \number\numexpr\csuse{bpl@itemtotal}-#1+1\relax% + }% + }% + }{% + % Use decreasing counter + \ifcsdef{bpl@items:\theprevrefsection}{% + \number\numexpr\csuse{bpl@itemtotal}-#1+1-\csuse{bpl@items:\theprevrefsection}\relax% + }{% + \number\numexpr\csuse{bpl@itemtotal}-#1+1\relax% + }% + }% + }% + \renewrobustcmd{\mkbibsecstart}[1]{% + \setcounter{prevrefsection}{\therefsection}% + \addtocounter{prevrefsection}{-1}% + \ifbool{@bpl@numberreset}{% + \ifbool{manitemset}{% + % Start from manually set value and count down + \csnumgdef{bpl@secitems:\therefsection}{\csuse{bpl@set@itemtotal}+1}\relax% + \global\boolfalse{manitemset}% + }{% + \ifbool{plnumgroup}{% + \csnumgdef{bpl@itemtotal}{\csuse{bpl@itemtotal}+\csuse{bpl@shift@itemtotal}}% + }{% + \csnumgdef{bpl@itemtotal}{\csuse{bpl@shift@itemtotal}}% + } + }% + }{% + \ifbool{manitemset}{% + % Start from manually set value and count down + \csnumgdef{bpl@itemtotal}{\csuse{bpl@set@itemtotal}+1+\csuse{bpl@items:\theprevrefsection}}\relax% + \csnumgdef{bpl@set@itemtotal}{\csuse{bpl@set@itemtotal}-\csuse{bpl@secitems:\therefsection}}% + }{% + \ifcsundef{bpl@items}{% + \PackageWarning{biblatex-publist}{Please rerun LaTeX!\MessageBreak + Still counting items in ref section \therefsection}% + }{% + \csnumgdef{bpl@itemtotal}{\csuse{bpl@items}+\csuse{bpl@shift@itemtotal}}% + }% + }% }% - }{}% - }% - \renewrobustcmd{\mkbibdesc}[1]{% - % Print the labelnumber as the total number of entries in the - % current refsection, minus the actual labelnumber, plus one - \number\numexpr\csuse{bpl@entrycount:\therefsection}+\csuse{bpl@itemtotal}-#1+1\relax% - }% - \renewrobustcmd{\mkbibsecstart}[1]{% - \setcounter{prevrefsection}{\therefsection}% - \addtocounter{prevrefsection}{-1}% - \if@bpl@numberreset - \csnumgdef{bpl@itemtotal}{#1-1+\csuse{bpl@shift@itemtotal}}% - \else - \csnumgdef{bpl@itemtotal}{\csuse{bpl@all@entrycount}% - -\csuse{bpl@comp@entrycount:\theprevrefsection}% - -\csuse{bpl@entrycount:\therefsection}-#1+1% - +\csuse{bpl@shift@itemtotal}}% - \fi% - }% -\fi + }% + \fi }% @@ -537,18 +999,41 @@ % +% OpenAccess type +% +\DeclareFieldFormat{openaccess}{% + \iftoggle{bpl@oainfosimple}{% + \ifbibstring{openaccess:true}% + {\bibstring{openaccess:true}}% + {#1}% + }{% + \ifbibstring{openaccess:#1}% + {\bibstring{openaccess:#1}}% + {\ifbibstring{openaccess:true}% + {\bibstring{openaccess:true}}% + {#1}% + }% + }% +} + +% % Peer-review type % -\newcommand\printprinfo[1]{% - \ifbibstring{peerreview:#1}% +\DeclareFieldFormat{peerreview}{% + \ifbibstring{peerreview:#1}% {\bibstring{peerreview:#1}}% {#1}% } -\DeclareFieldFormat{peerreview}{% - \printtext[brackets]{\printprinfo{#1}}% +% +% Impact factor +% +\DeclareFieldFormat{impactfactor}{% + \bibstring{impactfactor}\addcolon\addspace#1% } +\DeclareFieldFormat{plextrainfo}{\mkbibbrackets{#1}} + % % Bibliography filter % @@ -1015,15 +1500,11 @@ } \newbibmacro*{bpl:date:labeldate+extradate}{% - \mkbibbold{\usebibmacro{bpl:date:makedate}}% -} - -\AtBeginDocument{% - \if@unboldyear - \renewbibmacro*{bpl:date:labeldate+extradate}{% - \usebibmacro{bpl:date:makedate}% - } - \fi + \if@hlyear + \plyearhl{\usebibmacro{bpl:date:makedate}}% + \else + \usebibmacro{bpl:date:makedate}% + \fi% } \newbibmacro*{bpl:marginyear}{% @@ -1114,14 +1595,51 @@ }% } +\newtoggle{bpl@have@extrainfo} + \renewbibmacro*{addendum+pubstate}{% + \togglefalse{bpl@have@extrainfo}% \printfield{addendum}% \newunit\newblock \printfield{pubstate}% - \iftoggle{bpl@prinfo}{% - \newunit\newblock - \printfield{peerreview}% - }{}% + \ifboolexpr{ ( + not test {\iffieldundef{peerreview}} + and test {\iftoggle{bpl@prinfo}} + ) + or + ( + not test {\iffieldundef{openaccess}} + and test {\iftoggle{bpl@oainfo}} + ) + or + ( + not test {\iffieldundef{impactfactor}} + and test {\iftoggle{bpl@jifinfo}} + ) + }{% + \newunit\newblock% + \printtext[plextrainfo]{% + \ifboolexpr{ not test {\iffieldundef{peerreview}} + and test {\iftoggle{bpl@prinfo}} + }{% + \toggletrue{bpl@have@extrainfo}% + \printfield{peerreview}% + }{}% + \ifboolexpr{ not test {\iffieldundef{openaccess}} + and test {\iftoggle{bpl@oainfo}} + }{% + \iftoggle{bpl@have@extrainfo}{\plextrainfosep}{}% + \printfield{openaccess}% + \toggletrue{bpl@have@extrainfo}% + }{}% + \ifboolexpr{ not test {\iffieldundef{impactfactor}} + and test {\iftoggle{bpl@jifinfo}} + }{% + \iftoggle{bpl@have@extrainfo}{\plextrainfosep}{}% + \printfield{impactfactor}% + }{}% + }% + }{}% } % @@ -1129,6 +1647,10 @@ % \NewBibliographyString{with} \NewBibliographyString{parttranslationof} +\NewBibliographyString{impactfactor} +\NewBibliographyString{openaccess:true} +\NewBibliographyString{openaccess:gold} +\NewBibliographyString{openaccess:green} \NewBibliographyString{peerreview:sb} \NewBibliographyString{peerreview:db} \NewBibliographyString{peerreview:op} @@ -1140,6 +1662,10 @@ \DefineBibliographyStrings{english}{% parttranslationof = {partial translation of}, with = {with}, + impactfactor = {impact factor}, + openaccess:true = {OpenAccess}, + openaccess:gold = {OpenAccess (gold)}, + openaccess:green = {OpenAccess (green)}, peerreview:sb = {single blind peer review}, peerreview:db = {double blind peer review}, peerreview:op = {open peer review}, @@ -1152,6 +1678,10 @@ \DefineBibliographyStrings{french}{% parttranslationof = {traduction partielle de}, with = {avec}, + impactfactor = {facteur d'impact}, + openaccess:true = {libre acc\`es}, + openaccess:gold = {libre acc\`es (dorée)}, + openaccess:green = {libre acc\`es (verte)}, peerreview:sb = {\'{e}valuation par des pairs anonymis\'{e}s}, peerreview:db = {\'{e}valuation par les pairs en double aveugle}, peerreview:op = {\'{e}valuation par les pairs ouverte}, @@ -1164,6 +1694,10 @@ \DefineBibliographyStrings{german}{% parttranslationof = {Teil\"ubersetzung von}, with = {mit}, + impactfactor = {Impactfaktor}, + openaccess:true = {OpenAccess}, + openaccess:gold = {OpenAccess (gold)}, + openaccess:green = {OpenAccess (gr\"un)}, peerreview:sb = {Blindbegutachtung}, peerreview:db = {Doppelblindbegutachtung}, peerreview:op = {Offene Begutachtung}, @@ -1469,12 +2003,12 @@ \let\abx@name@shortauthor\abx@name@namea \ifdefstring\abx@field@labelnamesource{shortauthor} {\ifundef\abx@name@shortauthor - {\ifundef\abx@name@author - {\def\abx@field@labelnamesource{editor}} - {\def\abx@field@labelnamesource{author}}% + {\ifundef\abx@name@author + {\def\abx@field@labelnamesource{editor}} + {\def\abx@field@labelnamesource{author}}% }% - {}% - }% + {}% + }% {}% }% }% @@ -1541,5 +2075,7 @@ }% } +% Renamed in v. 2.0 +\let\shiftbplnum\shiftplnum \endinput |