biblatex 连续反向编号除一个类别外的所有类别

biblatex 连续反向编号除一个类别外的所有类别

我正在更新我的简历和答案biblatex 连续反向编号......我之前的问题解决了我的问题,直到我意识到我不应该计算我未发表的文章(我想在已发表的文章之后立即显示),因此问题是:

**Articles (3)**
[6] great Article 2
[5] great Article 2
[4] great Article 1

**Submitted but unpublished Articles (2)**
- hopefully soon published Article 2
- hopefully soon published Article 1

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

**Thesis**
[1] great Thesis

我按照这个想法想出了计数引用\AtDataInput如何仅计算给定类别中的项目\iscategory{article}就可以解决问题\ifboolexpr{}{}{}- 效果很好!

答案1

链接问题中采用的一般方法可以在这里使用,但您必须调整labelnumber未出版作品的格式。对于已出版作品,在打印未出版作品列表后,需要更正项目总数。

下面是一个延伸到出版前的各个阶段的示例,如字段所示pubstate

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

\makeatletter
\def\forcategory#1{\forlistloop{#1}{\blx@categories}}
\def\ifskipbib{\iftoggle{blx@skipbib}}
\makeatother

% Print labelnumber as item total, minus actual number, plus one
\DeclareFieldFormat{labelnumberwidth}{\iffieldundef{pubstate}{\mkbibbrackets{#1}}{#1}}
\DeclareFieldFormat{labelnumber}{\iffieldundef{pubstate}{\mkbibdesc{#1}}{--}}
\newrobustcmd{\mkbibdesc}[1]{\number\numexpr\value{itemtotal}+1-#1\relax}
\newcounter{itemtotal}

\def\countinit#1{\csnumgdef{count:#1}{0}}
\forcategory{\countinit}

% Add entries to categories, increment entry totals
\def\countadd#1{%
  \ifboolexpr{ test {\ifentrytype{#1}} and not test {\ifskipbib} }
    {\iffieldundef{pubstate}
       {\addtocategory{#1}{\thefield{entrykey}}%
        \csnumgdef{count:#1}{\csuse{count:#1}+1}%
        \stepcounter{itemtotal}}
       {\addtocategory{unpublished}{\thefield{entrykey}}%
        \csnumgdef{count:unpublished}{\csuse{count:unpublished}+1}}%
     \listbreak}
    {}}
\AtDataInput{\forcategory{\countadd}}

\renewbibmacro*{in:}{%
  \iffieldundef{journaltitle}{}{\printtext{\bibstring{in}\intitlepunct}}}

\def\defbibtitle#1#2{\csdef{title:#1}{#2}}
\def\defbibsubheading#1{%
  \defbibheading{#1}{\subsection*{%
    \ifcsundef{title:#1}{\MakeCapital{#1s}}{\csuse{title:#1}}%
    \ifnumgreater{\csuse{count:#1}}{1}{~(\csuse{count:#1})}{}%
    \ifstrequal{#1}{unpublished}
      {\global\defcounter{itemtotal}{\value{itemtotal}+\csuse{count:#1}}}{}}}}

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

\defbibheading{bibliography}{\section*{Publications and Presentations}}
\defbibtitle{unpublished}{Unpublished articles}
\defbibtitle{inproceedings}{Presentations}
\forcategory{\defbibsubheading}

\begin{filecontents}{\jobname.bib}
@article{submit,
  author = {Last, First},
  title = {Title},
  journaltitle = {Journal},
  date = {2012},
  pubstate = {submitted}}
@article{inprep,
  author = {Last, First},
  title = {Title},
  date = {2012},
  pubstate = {inpreparation}}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\begin{document}
\nocite{glashow,bertram,chiu,companion,padhye,submit,angenendt,moraux,inprep}
\printbibheading
\bibbycategory
\end{document}

在此处输入图片描述

一些说明:

  • 此方法仅适用于\nocite参考部分。相关问题中已演示了一些扩展。

  • 即使biblatex日志中没有生成“重新运行 LaTeX”警告,该文档通常也需要额外运行 LaTeX 来编译。

  • 应在字段中使用本地化密钥pubstate。可以使用 在前言中重新定义密钥\DefineBibliographyStrings。有关更多详细信息,请参阅biblatex手册。

  • 降序labelnumber强调作品总数,但在这里你计算的是苹果和橘子。这种格式可能最适合包含超过一页的同行评审文章列表的简历。

相关内容