biblatex 通过类别进行连续反向编号

biblatex 通过类别进行连续反向编号

答案引用某种类型的参考...几乎完美地解决了我的问题,但我想对我的简历进行连续计数排序:

**Articles**
[5] great Article 2
[4] great Article 1

**Presentations**
[3] great Presentation 2
[2] great Presentation 1

**Thesis**
[1] great Thesis

答案1

从链接开始回答您需要一个计数器,而不是每个类别一个计数器。基本上您只需要bbx@itemtotal

\documentclass{article}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=numeric,sorting=ydnt,defernumbers]{biblatex}

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

% Increment item total, add entries to categories
\def\bbx@itemtotalcategory#1{%
  \iftoggle{blx@skipbib}{\listbreak}{}%
  \ifentrytype{#1}
    {\csnumgdef{bbx@itemtotal}{\csuse{bbx@itemtotal}+1}%
     \addtocategory{#1}{\thefield{entrykey}}%
     \listbreak}
    {}}
\AtDataInput{\forlistloop{\bbx@itemtotalcategory}{\blx@categories}}
\csnumgdef{bbx@itemtotal}{0}

\makeatother

\DeclareBibliographyCategory{article}
\DeclareBibliographyCategory{report}
\DeclareBibliographyCategory{inproceedings}

\defbibheading{bibliography}{\section*{Publications and Presentations}}
\defbibheading{article}{\subsection*{Journal Articles}}
\defbibheading{report}{\subsection*{Reports}}
\defbibheading{inproceedings}{\subsection*{Presentations}}

\addbibresource{biblatex-examples.bib}
\begin{document}
\nocite{aksin,bertram,chiu,companion,padhye,angenendt,moraux}
\printbibheading
\bibbycategory
\end{document}

\nocite同样的警告也适用于此 -即使biblatex没有告诉您需要,该方法也仅适用于并且需要额外的 LaTeX 运行。

相关内容