jspitz / biblatex-publist

BibLaTeX bibliography support for publication lists
40 stars 4 forks source link

Possible feature - counts within each section #46

Closed ccaprani closed 1 year ago

ccaprani commented 1 year ago

Thank you for the wonderful work!

Is it possible to expose the internal counters to yield the total count within each \refsection?

I had a go with defining

\makeatletter
\newcommand{\accessbpl}[1]{%
  \csname bpl@#1\endcsname%
}
\makeatother

and trying

     Count is \accessbpl{itemtotal} or is it \theplnumgroup or even \accessbpl{savesecitems}

but no joy.

jspitz commented 1 year ago

No, it's not possible currently. We'd need to write the counter values to an aux file, which we currently only do on reverse numbering. What is your use case?

ccaprani commented 1 year ago

Interesting. I've seen some resumes with counts of various publication types in an intro or section heading. Just wondered if it could be pulled from those counters. It's no big deal. Cheers!

jspitz commented 1 year ago

Proof of concept: With either plnumbering=global-descending or plnumbering=local-descending (where we write that aux file), you can try:

\makeatletter
\newcommand*\GetSectionCount[1]{%
  \csuse{bpl@secitems:#1}%
}
\makeatother

and in the body e.g.:

\GetSectionCount{1}

for the respective section (here: first one).

Is that principally what you are looking for?

jspitz commented 1 year ago

I have now added \GetTotalCount and \GetSectionCount[section] (with an optional argument; if this is omitted, the current section is used). This should work in all cases. Please test if you can.

ccaprani commented 1 year ago

That's awesome! It just works; both commands. Thank you! It's such a great package :-)

jspitz commented 1 year ago

Thanks for testing! It'll be in the next release.

jspitz commented 1 year ago

V. 2.5 has been submitted to CTAN.