summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/biblatex-contrib/biblatex-publist/publist.cbx
blob: b005d71c5105ee6bdef42466c38f2cb700aa45d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
% publist.cbx, biblatex citation style by Juergen Spitzmueller
% requires biblatex >= 3.4
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2003/12/01 or later.
%
% This work has the LPPL maintenance status "maintained".
% 
% This Current Maintainer of this work is Jürgen Spitzmüller.
%
% This work consists of the file publist.cbx and publist.bbx.
%
%
% This is a simple portmanteau file that just loads the standard
% "numeric" citation style. This file is provided to allow the loading
% of biblatex-publist via the "style=" (alternatively to "bibstyle=")
% option.
%
% Please send suggestions and bug reports to 
% https://github.com/jspitz/biblatex-publist
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\bpl@version{1.23}
\def\bpl@rdate{2021/09/01}

\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