2

I want to do a CV (I use moderncv) and print several bibliographies at the end. All of them should be in decreasing order (sorted by year) but with new starting point. What I know is the solution here: Multibib reverse label or sort order however this enforces leading letters which I do not want.

My MWE (hopefully) is here:

\documentclass{moderncv}

\usepackage[ngerman]{babel}
\usepackage[babel,german=guillemets]{csquotes}
\usepackage[sorting=ydnt, maxbibnames=99, isbn=false, doi=false, firstinits, terseinits, defernumbers, backend=biber]{biblatex}

\AtDataInput{%
  \csnumgdef{entrycount:\therefsection}{%
    \csuse{entrycount:\therefsection}+1}}

\DeclareFieldFormat{labelnumber}{\mkbibdesc{#1}}    
\newrobustcmd*{\mkbibdesc}[1]{%
  \number\numexpr\csuse{entrycount:\therefsection}+1-#1\relax}

\bibliography{test}

\usepackage{filecontents}
\begin{filecontents}{test.bib}
  @article{citation01,
    Author = {Doe, John and Roe, Jane},
    Journal = {Fancy Journal},
    Pages = {123--145},
    Title = {Lorem ipsum dolor sit amet, consectetur adipiscing elit},
    Volume = {2},
    Year = {2012}}
  @article{citation02,
    Author = {Doe, John and Roe, Jane},
    Journal = {Fancy Journal},
    Pages = {12--34},
    Title = {Lorem ipsum dolor sit amet, consectetur adipiscing elit.},
    Volume = {1},
    Year = {2014}}
  @book{citation03,
    Author = {Doe, John and Roe, Jane},
    Title = {Lorem ipsum dolor sit amet, consectetur adipiscing elit.},
    publisher = {Company},
    location = {Somewhere},
    Year = {2013}}
\end{filecontents}

\name{John}{Doe}
\title{CV}
\email{john@doe.com}

\begin{document}
\makecvtitle

\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}

\nocite{*}

\printbibheading[title={Publications}]
\printbibliography[type=article, title={Papers}]
\printbibliography[type=book, title={Books}]

\end{document}

What I get is something like

[3] Doe
[2] Doe

[1] Doe

What I want is

[2] Doe
[1] Doe

[1] Doe
Worz
  • 23

1 Answers1

3

We can simply start counting each entry type separately with

\AtDataInput{%
  \csnumgdef{entrycount:\therefsection:\thefield{entrytype}}{%
    \csuse{entrycount:\therefsection:\thefield{entrytype}}+1}}

\DeclareFieldFormat{labelnumber}{\mkbibdesc{#1}}    
\newrobustcmd*{\mkbibdesc}[1]{%
  \number\numexpr\csuse{entrycount:\therefsection:\thefield{entrytype}}+1-#1\relax}

Then we only need a resetnumbers for the bibliographies and we are good to go.

MWE

\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage[babel,german=guillemets]{csquotes}
\usepackage[sorting=ydnt, maxbibnames=99, isbn=false, doi=false, firstinits, terseinits, defernumbers, backend=biber]{biblatex}

\AtDataInput{%
  \csnumgdef{entrycount:\therefsection:\thefield{entrytype}}{%
    \csuse{entrycount:\therefsection:\thefield{entrytype}}+1}}

\DeclareFieldFormat{labelnumber}{\mkbibdesc{#1}}    
\newrobustcmd*{\mkbibdesc}[1]{%
  \number\numexpr\csuse{entrycount:\therefsection:\thefield{entrytype}}+1-#1\relax}


\addbibresource{biblatex-examples.bib}

\begin{document}
\nocite{sigfridsson,wilde,worman,geer,baez/article}
\printbibheading[title={Publications}]
\printbibliography[type=article, title={Papers},resetnumbers]
\printbibliography[type=book, title={Books},resetnumbers]
\printbibliography[type=thesis, title={Theses},resetnumbers]
\end{document}

example output with three lists


Since this seems to be required for the purpose of a CV (and you probably don't actually need to \cite the entries) we can also use the nicely-named etaremune package without additional counting of the entries

\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage[babel,german=guillemets]{csquotes}
\usepackage[sorting=ydnt, maxbibnames=99, isbn=false, doi=false, firstinits, terseinits, defernumbers, backend=biber]{biblatex}
\usepackage{etaremune}

\addbibresource{biblatex-examples.bib}

\defbibenvironment{bibliography}
  {\renewcommand\labelenumi{[\theenumi]}
   \etaremune}
  {\endetaremune}
  {\item}

\begin{document}
\nocite{sigfridsson,wilde,worman,geer,baez/article}
\printbibheading[title={Publications}]
\printbibliography[type=article, title={Papers},resetnumbers]
\printbibliography[type=book, title={Books},resetnumbers]
\printbibliography[type=thesis, title={Theses},resetnumbers]
\end{document}

See also Is there a way to get reverse numbering on the enumerate environment? and enumitem newlist with etaremune.

moewe
  • 175,683