1

In 2014 I wrote a CV that used the following template for citations.

The idea was to download a publication list from google scholar, "google.bib" and then reverse sort by year and category. Then when I needed to apply for a job again, the only step would be to download my google.bib. However, the old template does not seem to work properly. I can see that the reverse year is still working, but the counters seem not to work. Has LateX changed, or have I missed something? I tried other bibtex files with the same effect.

\documentclass[12pt,titlepage]{article}

%%%%%%%%%%%%%%%%%%%%%% BIBLATEX CV STUFF   %
\usepackage[style=nature,
                      maxnames=200,
                      sorting=ydnt,
                      defernumbers=true,
                      backend=biber]{biblatex}%% BIBLATEX CV STUFF  %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Script for separating publication types and labels.
\DeclareFieldFormat{labelnumber}{\mkbibdesc{#1}}
\makeatletter

% Print labelnumber as actual number, plus item total, minus one
\newrobustcmd{\mkbibdesc}[1]{%
  \number\numexpr\csuse{bbx@itemtotal}+1-#1\relax}

% Initialize category counters
\def\bbx@initcategory#1{\csnumgdef{bbx@count@#1}{0}}
\forlistloop{\bbx@initcategory}{\blx@categories}

% Increment category counters
\def\bbx@countcategory#1{%
  \ifentrytype{#1}
    {\csnumgdef{bbx@count@#1}{\csuse{bbx@count@#1}+1}%
     \addtocategory{#1}{\thefield{entrykey}}%
     \listbreak}
    {}}
\AtDataInput{\forlistloop{\bbx@countcategory}{\blx@categories}}

%Modify \bibbycategory to set item total
\patchcmd{\blx@bibcategory}
  {\blx@key@heading{#1}}
  {\blx@key@heading{#1}%
   \csnumdef{blx@labelnumber@\the\c@refsection}{0}%
   \csnumgdef{bbx@itemtotal}{\csuse{bbx@count@#1}}}
  {}{}
\makeatother

\DeclareBibliographyCategory{article}
\DeclareBibliographyCategory{inproceedings}
%\DeclareBibliographyCategory{report}
%\DeclareBibliographyCategory{unpublished}
\DeclareBibliographyCategory{book}

\defbibheading{bibliography}{\subsection{SCHOLARSHIP}}
\defbibheading{article}{\subsubsection{Peer-Reviewed Journal Publications}}
\defbibheading{inproceedings}{\subsubsection{Peer-Reviewed Conference Proceedings}}
%\defbibheading{report}{\subsubsection{Technical Reports, Proposals \& Theses}}
%\defbibheading{unpublished}{\subsubsection{Invited Talks}}
\defbibheading{book}{\subsubsection{Books}}
%%%%%%%%%%%%%%%%%%%END% BIBLATEX CV STUFF   %

\title{McNamerson CV}
\author{Namey McNamerson}
\date{\today}

\addbibresource{google.bib}% my google scholar bib  

\begin{document}

\nocite{*}
\printbibheading\label{scholar}
The following represent my scholarly output over the timeframe from 1965--Present.

\bibbycategory

\end{document}

Here is a sample bib file --

%%%https://services.math.duke.edu/computing/tex/templates/database.bib



@inproceedings{GMP81,
   author = "Mark Goresky and Robert MacPherson",
    title = "On the topology of complex algebraic maps",
booktitle = "Algebraic Geometry Proceedings, La R\'abida,
             Lecture Notes in Mathematics",
   number = 961,
     year = 1981}    

@inproceedings{Kwi97,
   author = "Micha{\l} Kwieci\'nski",
    title = "Mac{P}herson's graph construction",
booktitle = "Algebraic Geometry, 
             Lecture Notes in Pure and Applied Mathematics",
   editor = "Sinan Sert{\"o}z",
   volume = 193,
     year = 1987}

@inproceedings{MP81,
   author = "Robert MacPherson",
    title = "Singularities of vector bundle maps",
booktitle = "Proceedings of Liverpool Singularities, 
             Lecture Notes in Mathematics",
   number = 192,
     year = 1981} 

@inproceedings{Shi84,
   author = "Theodore Shifrin",
    title = "Curvature integrals and {C}hern classes of singular varieties",
booktitle = "Integral Geoemetry, Proceedings,
             Contemporary Mathematics",
   volume = 63,
     year = 1984}

@inproceedings{Sul81,
   author = "D. Sullivan",
    title = "Combinatorical invariants of analytic spaces",
booktitle = "Proceedings of Liverpool Singularities, 
             Lecture Notes in Mathematics",
   number = 192,
     year = 1981}


@article{TM83,
  author = "L\^e D{\~u}ng Trang and Zoghman Mebkhout",
   title = "Vari\'et\'es caract\'er\-istiques et vari\'et\'es polaires",
 journal = "C. R. Acad. Sc. Paris",
  volume = 296,
    year = 1983,
   pages = "129--132"}

@article{BMM94,
  author = "Jo{\"e}l Biran{\c c}on and Philippe Maisonobe and Michel Merle",
   title = "Localisation de syst\`emes diff\'erentiels, stratifications
            de {W}hitney et condition de {T}hom",
 journal = "Invent. Math.",
  volume = 117,
    year = 1994,
   pages = "531--550"}

@article{PP95,
  author = "Adam Parusi\'nski and Piotr Pragacz",
   title = "A formula for the {E}uler characteristic of singular hypersurfaces",
 journal = "J. Alg. Geom.",
  volume = 4,
    year = 1995,
   pages = "337-351"}

@article{Bry82,
  author = "Jean--Luc Brylinski",
   title = "({C}o)--{H}omologie d'intersection et faisceaux pervers",
 journal = "S\'eminaire Bourbaki",
  volume = 585,
    year = 1982,
   pages = "129--157"}

@article{Ken90x,
  author = "Gary Kennedy",
   title = "Specialization of {M}ac{P}herson's {C}hern classes",
 journal = "Math. Scand.",
  volume = 66,
    year = 1990,
   pages = "12--16"}

Can anyone see where to fix the numbering issue? I believe that the origin of this idea was the post:

biblatex: Reverse numbering (i.e., count down)

Fink
  • 13

1 Answers1

1

There was a change to the internals of \blx@bibcategory, which you patch (see https://github.com/plk/biblatex/commit/b22f1578d64436de57858f9c05a3a13c3ca0e49c and https://github.com/plk/biblatex/commit/4ae3ccc43cf003a0fe61f83a22991d4905e9bdf9). Unfortunately, the exact command you use to patch the macro was changed, so your patch no longer applied. The new patch command needs to look like this

\patchcmd{\blx@bibcategory}
  {\blx@key@heading{\blx@theheading}{#1}}
  {\blx@key@heading{\blx@theheading}{#1}%
   \csnumdef{blx@labelnumber@\the\c@refsection}{0}%
   \csnumgdef{bbx@itemtotal}{\csuse{bbx@count@#1}}}
  {}
  {\blx@error
     {Failed to patch \string\blx@bibcategory}
     {Maybe its definition has changed}}

I've built in an error message in case the patch breaks again, so it is easier to diagnose an issue like this in the future.

\documentclass[12pt]{article}
\usepackage[style=nature,
            maxnames=200,
            sorting=ydnt,
            defernumbers=true,
            backend=biber]{biblatex}


\DeclareFieldFormat{labelnumber}{\mkbibdesc{#1}}

\makeatletter

\newrobustcmd{\mkbibdesc}[1]{%
  \number\numexpr\csuse{bbx@itemtotal}+1-#1\relax}

\def\bbx@initcategory#1{\csnumgdef{bbx@count@#1}{0}}
\forlistloop{\bbx@initcategory}{\blx@categories}

\def\bbx@countcategory#1{%
  \ifentrytype{#1}
    {\csnumgdef{bbx@count@#1}{\csuse{bbx@count@#1}+1}%
     \addtocategory{#1}{\thefield{entrykey}}%
     \listbreak}
    {}}
\AtDataInput{\forlistloop{\bbx@countcategory}{\blx@categories}}

\patchcmd{\blx@bibcategory}
  {\blx@key@heading{\blx@theheading}{#1}}
  {\blx@key@heading{\blx@theheading}{#1}%
   \csnumdef{blx@labelnumber@\the\c@refsection}{0}%
   \csnumgdef{bbx@itemtotal}{\csuse{bbx@count@#1}}}
  {}
  {\blx@error
     {Failed to patch \string\blx@bibcategory}
     {Maybe its definition has changed}}
\makeatother

\DeclareBibliographyCategory{article}
\DeclareBibliographyCategory{inproceedings}
\DeclareBibliographyCategory{book}

\defbibheading{bibliography}{\subsection{SCHOLARSHIP}}
\defbibheading{article}{\subsubsection{Peer-Reviewed Journal Publications}}
\defbibheading{inproceedings}{\subsubsection{Peer-Reviewed Conference Proceedings}}
\defbibheading{book}{\subsubsection{Books}}


\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@inproceedings{GMP81,
   author = "Mark Goresky and Robert MacPherson",
    title = "On the topology of complex algebraic maps",
booktitle = "Algebraic Geometry Proceedings, La R\'abida,
             Lecture Notes in Mathematics",
   number = 961,
     year = 1981}    

@inproceedings{Kwi97,
   author = "Micha{\l} Kwieci\'nski",
    title = "Mac{P}herson's graph construction",
booktitle = "Algebraic Geometry, 
             Lecture Notes in Pure and Applied Mathematics",
   editor = "Sinan Sert{\"o}z",
   volume = 193,
     year = 1987}

@inproceedings{MP81,
   author = "Robert MacPherson",
    title = "Singularities of vector bundle maps",
booktitle = "Proceedings of Liverpool Singularities, 
             Lecture Notes in Mathematics",
   number = 192,
     year = 1981} 

@inproceedings{Shi84,
   author = "Theodore Shifrin",
    title = "Curvature integrals and {C}hern classes of singular varieties",
booktitle = "Integral Geoemetry, Proceedings,
             Contemporary Mathematics",
   volume = 63,
     year = 1984}

@inproceedings{Sul81,
   author = "D. Sullivan",
    title = "Combinatorical invariants of analytic spaces",
booktitle = "Proceedings of Liverpool Singularities, 
             Lecture Notes in Mathematics",
   number = 192,
     year = 1981}


@article{TM83,
  author = "L\^e D{\~u}ng Trang and Zoghman Mebkhout",
   title = "Vari\'et\'es caract\'er\-istiques et vari\'et\'es polaires",
 journal = "C. R. Acad. Sc. Paris",
  volume = 296,
    year = 1983,
   pages = "129--132"}

@article{BMM94,
  author = "Jo{\"e}l Biran{\c c}on and Philippe Maisonobe and Michel Merle",
   title = "Localisation de syst\`emes diff\'erentiels, stratifications
            de {W}hitney et condition de {T}hom",
 journal = "Invent. Math.",
  volume = 117,
    year = 1994,
   pages = "531--550"}

@article{PP95,
  author = "Adam Parusi\'nski and Piotr Pragacz",
   title = "A formula for the {E}uler characteristic of singular hypersurfaces",
 journal = "J. Alg. Geom.",
  volume = 4,
    year = 1995,
   pages = "337-351"}

@article{Bry82,
  author = "Jean-Luc Brylinski",
   title = "({C}o)--{H}omologie d'intersection et faisceaux pervers",
 journal = "S\'eminaire Bourbaki",
  volume = 585,
    year = 1982,
   pages = "129--157"}

@article{Ken90x,
  author = "Gary Kennedy",
   title = "Specialization of {M}ac{P}herson's {C}hern classes",
 journal = "Math. Scand.",
  volume = 66,
    year = 1990,
   pages = "12--16"}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

\nocite{*}
\printbibheading\label{scholar}
The following represent my scholarly output over the timeframe from 1965--Present.

\bibbycategory

\end{document}

Two reverse-numbered bibs.

moewe
  • 175,683
  • I tried the patch on my TexShop-Mac system, and unfortunately all it did was trigger the error message. And the numbers counted down Papers: 0, -1, -2, -3, -4, then skip to Proceedings: -5, -6, -7, -8, -9. Can I just manually set the initial numbers for each category? If so could you point out how to achieve that? --Best Regards, Fink – Fink Sep 08 '19 at 16:01
  • @Fink Check your biblatex version. The code works in the MWE when run with the most recent biblatex 3.13(a). If possible update your system. – moewe Sep 08 '19 at 16:03
  • According to my Logfile, Biblatex 3.0. However, TexShop was updated this morning. So it must think that is the current version from TeXLive. Overleaf gives the same negative counting as well. So at least that agrees with my local version. – Fink Sep 08 '19 at 16:21
  • @Fink 3.0? That's from almost four and a half years ago (2015-04-20). The TeXShop version is irrelevant here. TeX live/MacTeX decides your biblatex version. Note that TeX live/MacTeX is released yearly and does not let you upgrade easily between versions, usually you just install the new one, see https://tex.stackexchange.com/q/107017/35864, https://tex.stackexchange.com/q/55437/35864. Overleaf also run an outdated version of biblatex, so my code is too new for it, but the code you posted in the question should actually run there. – moewe Sep 08 '19 at 16:27
  • Yes, that 04-20 definitely explains the confusion! Updates fixed the issues on my local install. My only regret is that I have but one Checkmark to give to this answer! Thanks. – Fink Sep 08 '19 at 17:07