Bibliography counters, reverse order numbering and keywords
I use an additional counter to count the entries, this requires two compilations.
The filecontents package is obsolete, I replaced this with the [overwrite] option.
\NeedsTeXFormat{LaTeX2e}
\documentclass[12pt]{article}
\usepackage{refcount}
\usepackage[backend=biber,%
isbn=false,%
style=numeric,%
sorting=ydnt,%
giveninits=true,% initials of first names
maxbibnames=20,%
defernumbers,%
labeldateparts,% for academic cv
locallabelwidth% for academic cv
]{biblatex}
\begin{filecontents}{\jobname_a.bib}
@Article{Fabulous2016a,
author = {Fabulous, Jason},
title = {How to be fabulous - The Story of My Life},
journal = {Fancy Journal},
year = {2016},
volume = {56},
number = {3},
pages = {1-99},
keywords = {include},
}
@Article{FabulousFaulkner2019a,
author = {Fabulous, Jason and Faulkner, Trent},
title = {One Fabulous Moment after Another - A chat with my buddy Trent},
journal = {Journal},
year = {2018},
volume = {56},
number = {3},
pages = {1-99},
keywords = {},
}
\end{filecontents}
\begin{filecontents}{\jobname_b.bib}
@Article{Fuca2019a,
author = {Fuca, Wanda},
title = {Ridges, Plates and Seamounts},
journal = {Journal 2},
year = {2019},
volume = {56},
number = {3},
pages = {1-99},
keywords = {include},
}
@Article{Fuca2015a,
author = {Fuca, Wanda},
title = {How to truly know whether your parents were Hippies},
journal = {Journal},
year = {2015},
volume = {56},
number = {3},
pages = {1-99},
keywords = {include},
}
\end{filecontents}
\newcounter{mybibcount}
\begin{filecontents}[overwrite]{cvsectionnum.tex}
% define a bibenvironment for an numbered bib entry
\defbibenvironment{bibenvcvsectionnum}%
{\setcounter{mybibcount}{-1}\list%
{\stepcounter{mybibcount}\printtext[labelnumberwidth]{%
\printfield{labelprefix}%
\printfield{labelnumber}}}%
{\setlength{\leftmargin}{\bibhang}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}}}%
{\refstepcounter{mybibcount}\label{bibcount\therefsection}\endlist}%
{\item}%
% cvsectionnum
\newcommand\cvsectionnum[3]{%
\section*{#1}%
\begin{refsection}[#2]%
\nocite{*}%
\printbibliography[heading=none,env=bibenvcvsectionnum,#3]%
\end{refsection}%
}%
\end{filecontents}
\begin{filecontents}[overwrite]{reverse_order_bib_entry_numbering.tex}
\AtDataInput{%
\csnumgdef{entrycount:\therefsection}{%
\getrefnumber{bibcount\therefsection}}}%
%
\DeclareFieldFormat{labelnumber}{\mkbibdesc{#1}}%
\newrobustcmd*{\mkbibdesc}[1]{%
\number\numexpr\csuse{entrycount:\therefsection}+1-#1\relax}%
\end{filecontents}
\addbibresource{\jobname_a.bib}%
\addbibresource{\jobname_b.bib}%
% declare section names
\def\sectiona{J's Publications}%
\def\sectionb{Wanda's Pulications}%
% definition of `cvsectionnum'
\input{cvsectionnum.tex}
% reverse order numbering
\input{reverse_order_bib_entry_numbering.tex}
\begin{document}
% J
\cvsectionnum{\sectiona}{\jobname_a.bib}{keyword={include}}%
% Wanda
\cvsectionnum{\sectionb}{\jobname_b.bib}{keyword={include}}%
\end{document}
The problem comes from
{\printtext[labelnumberwidth]{%
\printfield{labelprefix}%
\printfield{labelnumber}}}%
that I changed into
{\printfield[labelnumberwidth]{labelnumber}}%
by taking some inspiration in the biblatex User Guide p. 156.
The result is: