From f918c42692eb79e6a05d3c48e72c7b40a2edbb11 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 21 Sep 2020 21:05:16 +0000 Subject: biblatex-publist (21sep20) git-svn-id: svn://tug.org/texlive/trunk@56392 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/biblatex-publist/publist.bbx | 107 +++++++++++++++++---- .../tex/latex/biblatex-publist/publist.cbx | 49 +++++++++- 2 files changed, 134 insertions(+), 22 deletions(-) (limited to 'Master/texmf-dist/tex/latex') diff --git a/Master/texmf-dist/tex/latex/biblatex-publist/publist.bbx b/Master/texmf-dist/tex/latex/biblatex-publist/publist.bbx index 365cf8de429..59c81cfb227 100644 --- a/Master/texmf-dist/tex/latex/biblatex-publist/publist.bbx +++ b/Master/texmf-dist/tex/latex/biblatex-publist/publist.bbx @@ -25,8 +25,8 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\def\bpl@version{1.20} -\def\bpl@rdate{2020/09/15} +\def\bpl@version{1.21} +\def\bpl@rdate{2020/09/21} \ProvidesFile{publist.bbx}[\bpl@rdate\space v.\bpl@version\space biblatex bibliography style (JSP)] @@ -92,7 +92,8 @@ \ifstrequal{#1}{false}{\togglefalse{firstinit}}{\toggletrue{firstinit}} } -\newif\if@bplnumbered\@bplnumberedtrue +\newif\if@bpl@numbered\@bpl@numberedtrue +\newif\if@bpl@numberreset\@bpl@numberresetfalse \DeclareBibliographyOption{plnumbered}[true]{% \ifstrequal{#1}{false}{% 1. "false" \defbibenvironment{bibliography} @@ -106,6 +107,7 @@ {\endlist} {\item}}{% else: 2. "reset" \ifstrequal{#1}{reset}{% + \@bpl@numberresettrue% \defbibenvironment{bibliography} {\addtolength{\labelnumberwidth}{\extralabelnumberwidth}% \list @@ -180,6 +182,11 @@ }% } +\newif\if@bpl@reversenum\@bpl@reversenumfalse +\DeclareBibliographyOption{reversenumbering}[true]{% + \ifstrequal{#1}{true}{\@bpl@reversenumtrue}{\@bpl@reversenumfalse} +} + % Check if users have defined different base styles % If not, use authoryear. \newif\ifbpl@standardbasestyle\bpl@standardbasestylefalse @@ -387,9 +394,12 @@ % % Deal with numbering (resume numbers in refsections) % -\csnumgdef{bbx@itemtotal}{0} -\csnumgdef{bbx@currentitem}{0} -\csnumgdef{bbx@saverefsection}{0} +\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} \newbool{newsection} \preto\blx@refsection{\global\setbool{newsection}{true}} @@ -416,32 +426,85 @@ \renewcommand*{\makelabel}[1]{\hss##1}% }% {\endlist - \ifnumgreater{\c@refsection}{\bbx@saverefsection}% - {\csnumgdef{bbx@itemtotal}{\csuse{bbx@itemtotal}+\csuse{bbx@currentitem}}}{}% - \csnumgdef{bbx@saverefsection}{\c@refsection}% + \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}{}% + \csnumgdef{bpl@saverefsection}{\c@refsection}% } {\item} \DeclareFieldFormat{labelnumber}{% \ifbool{newsection}{% % Fix start counter value - \csnumgdef{bbx@itemtotal}{\csuse{bbx@itemtotal}-#1+1}% + \mkbibsecstart{#1}% \global\setbool{newsection}{false}% }{}% \mkbibdesc{#1}% - \csnumgdef{bbx@currentitem}{#1}% + \csnumgdef{bpl@currentitem}{#1}% } -% Print labelnumber as actual number, plus item total \newrobustcmd{\mkbibdesc}[1]{% - \number\numexpr\csuse{bbx@itemtotal}+#1\relax% + % Print labelnumber as actual number, plus item total + \number\numexpr\csuse{bpl@itemtotal}+#1\relax% +}% + +\newrobustcmd{\mkbibsecstart}[1]{% + \csnumgdef{bpl@itemtotal}{\csuse{bpl@itemtotal}-#1+1}% } -% Way to manual shift the numbering (undocumented) -\newcommand*\decreasebbxnumbering[1]{% - \csnumgdef{bbx@itemtotal}{\csuse{bbx@itemtotal}-#1}% +% Way to manually shift the numbering +\csnumgdef{bpl@shift@itemtotal}{0} +\newcommand*\shiftbplnum[1]{% + \csnumgdef{bpl@shift@itemtotal}{#1}% } +% +% Reverse numbering +% Inspired by moewew's approach at +% https://tex.stackexchange.com/a/563328/19291 +% +\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% + }% + }{}% + }% + \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 +}% + % % New environment for (foreign) reviews @@ -1281,21 +1344,25 @@ \step[fieldset=sortyear, origfieldval] } \map{ - \step[fieldsource=pubstate, match=\regexp{forthcoming}, final] + \step[fieldsource=pubstate, match=\regexp{prepublished}, final] \step[fieldset=sortyear, fieldvalue={2222}] } \map{ - \step[fieldsource=pubstate, match=\regexp{inpress}, final] + \step[fieldsource=pubstate, match=\regexp{forthcoming}, final] \step[fieldset=sortyear, fieldvalue={3333}] } \map{ - \step[fieldsource=pubstate, match=\regexp{submitted}, final] + \step[fieldsource=pubstate, match=\regexp{inpress}, final] \step[fieldset=sortyear, fieldvalue={4444}] } \map{ - \step[fieldsource=pubstate, match=\regexp{inpreparation}, final] + \step[fieldsource=pubstate, match=\regexp{submitted}, final] \step[fieldset=sortyear, fieldvalue={5555}] } + \map{ + \step[fieldsource=pubstate, match=\regexp{inpreparation}, final] + \step[fieldset=sortyear, fieldvalue={6666}] + } } } diff --git a/Master/texmf-dist/tex/latex/biblatex-publist/publist.cbx b/Master/texmf-dist/tex/latex/biblatex-publist/publist.cbx index 7a856b1111c..f0e9cd47c23 100644 --- a/Master/texmf-dist/tex/latex/biblatex-publist/publist.cbx +++ b/Master/texmf-dist/tex/latex/biblatex-publist/publist.cbx @@ -26,12 +26,57 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\def\bpl@version{1.20} -\def\bpl@rdate{2020/09/15} +\def\bpl@version{1.21} +\def\bpl@rdate{2020/09/21} \ProvidesFile{publist.cbx}[\bpl@rdate\space v.\bpl@version\space biblatex citation style (JSP)] \RequireCitationStyle{numeric} +\DeclareCiteCommand{\citeitem} + {\defcounter{maxnames}{999}% + \boolfalse{citetracker}% + \boolfalse{pagetracker}% + \usebibmacro{prenote}} + {\usebibmacro{bpl:cite:extern}} + {\multicitedelim} + {\usebibmacro{postnote}} + +\newbibmacro*{bpl:cite:extern}{% + \printtext[bibhyperref]{% + \printfield{labelprefix}% + \usebibmacro{bpl:cite:labelnumber}% + \ifbool{bbx:subentry} + {\printfield{entrysetcount}} + {}}} + +\newbibmacro*{bpl:cite:labelnumber}{% + \printtext[labelnumberwidth]{\mkrefdesc{\thefield{labelnumber}}}% +} + +% Manual way to adjust numbering +\csdef{bpl@secstartshift}{0} +\newcommand*\shiftciteitem[1]{\csdef{bpl@secstartshift}{#1}} + +% Print labelnumber as actual number, plus item total +% and probably a manual shift value +\newrobustcmd{\mkrefdesc}[1]{% + \number\numexpr#1+\csuse{bpl@itemtotal}+\csuse{bpl@secstartshift}\relax% +} + +\providebool{@bpl@reversenum} + +\AtEndOfPackage{% +\if@bpl@reversenum + \renewrobustcmd{\mkrefdesc}[1]{% + % Print the labelnumber as the total number of entries in the + % current refsection, minus the actual labelnumber, plus one + \number\numexpr\csuse{bpl@itemtotal}-#1+1% + +\csuse{bpl@secstartshift}\relax% + }% +\fi% +} + +%% \endinput -- cgit v1.2.3