Biblatex 参考文献按降序排列,但有多个列表从最高列表数开始

Biblatex 参考文献按降序排列,但有多个列表从最高列表数开始

我想做一份简历(我用moderncv) 并在末尾打印几个参考书目。所有这些都应按降序排列(按年份排序),但要有新的起点。我知道的解决方案如下:Multibib 反向标签或排序顺序然而这会强制输出我不想要的前导字母。

我的 MWE(希望)在这里:

\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{[email protected]}

\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}

我得到的是

[3] Doe
[2] Doe

[1] Doe

我想要的是

[2] Doe
[1] Doe

[1] Doe

答案1

我们可以简单地开始分别计算每个条目类型

\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}

然后我们只需要一个resetnumbers参考书目就可以了。

平均能量损失

\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}

包含三个列表的示例输出


由于这似乎是简历所必需的(你可能实际上并不需要\cite这些条目),我们也可以使用名称很好的etaremune包裹无需额外计算

\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}

也可以看看有没有办法在枚举环境中获得反向编号?使用 etemune 进行 enumitem newlist

相关内容