我正在运行我的简历,它是通过调用
pdflatex main
biber main --output-safechars
pdflatex main
pdflatex main % shouldn't be necessary but added delay negligible
当我在运行 biber 1.8 的 Linux Mint 笔记本电脑上运行此脚本时,一切都如我所愿,但当我在运行 biber 2.1 的 Mac 笔记本电脑上运行它时,编号出现了奇怪的情况。对于这个 MWE,我得到的编号不是 [1] 和 [1],而是 [1] 和 [0],这没有意义。随着更多示例的添加,问题变得越来越严重,尽管我在将文件添加到 MyPapers.bib 时无法识别任何明确的模式
MWE 如下(仅作为两个单独的文件):
我的论文集
@unpublished{exampletwo,
author = {Last-name, Firstname and lname, En\'{e}as},
booktitle = {In Review},
title = {{Pick a Title}}
}
@inproceedings{exampleone,
author = {Jones, Jim and Example, Jos\'{e}},
booktitle = {Sustentabilidade H{\'{\i}}drica}},
year = {2014}
}
主文本
\documentclass[11pt,letterpaper,roman]{moderncv}
% moderncv themes
\moderncvstyle{classic}
\moderncvcolor{blue}
\usepackage[utf8]{inputenc}% character
\usepackage{csquotes}
%---------------------Bibliography and BiBLaTeX--------------------
% Use BibLaTeX
\usepackage[backend=biber,
sorting=ynt]{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}
% Initialize category counters
\def\bbx@initcategory#1{\csnumgdef{bbx@count@#1}{0}}
\forlistloop{\bbx@initcategory}{\blx@categories}
% Increment category counters
\def\bbx@countcategory#1{%
\ifentrytype{#1}
{\csnumgdef{bbx@count@#1}{\csuse{bbx@count@#1}+1}%
\addtocategory{#1}{\thefield{entrykey}}%
\listbreak}
{}}
\AtDataInput{\forlistloop{\bbx@countcategory}{\blx@categories}}
% Modify \bibbycategory to set item total
\patchcmd{\blx@bibcategory}
{\blx@key@heading{#1}}
{\blx@key@heading{#1}%
\csnumdef{blx@labelnumber@\the\c@refsection}{0}%
\csnumgdef{bbx@itemtotal}{\csuse{bbx@count@#1}}}
{}{}
\makeatother
\DeclareBibliographyCategory{unpublished}
\DeclareBibliographyCategory{inproceedings}
\defbibheading{bibliography}{\section*{Publications and Presentations}}
\defbibheading{unpublished}{\subsection*{Articles In Review}}
\defbibheading{inproceedings}{\subsection*{Conference Papers}}
\addbibresource{MyPapers.bib}
%------------------------ personal data -------------------------------------
\name{Firstname}{Name}
\begin{document}
\makecvtitle
% Publications
\nocite{*} % count all pubs as cited
\printbibheading
\bibbycategory
\end{document}
答案1
我不明白你为什么要使用所有这些内部修补。你难道不会得到类似这样的输出吗:
\documentclass[11pt,letterpaper,roman]{moderncv}
% moderncv themes
\moderncvstyle{classic}
\moderncvcolor{blue}
\usepackage[utf8]{inputenc}% character
\usepackage{csquotes}
%---------------------Bibliography and BiBLaTeX--------------------
% Use BibLaTeX
\usepackage[backend=biber,
sorting=ynt,defernumbers]{biblatex}
\defbibheading{bibliography}{\section*{Publications and Presentations}}
\defbibheading{unpublished}{\subsection*{Articles In Review}}
\defbibheading{inproceedings}{\subsection*{Conference Papers}}
\addbibresource{bib.bib}
%------------------------ personal data -------------------------------------
\name{Firstname}{Name}
\begin{document}
\makecvtitle
% Publications
\nocite{*} % count all pubs as cited
\printbibheading
\printbibliography[heading=unpublished,resetnumbers,type=unpublished]
\printbibliography[heading=inproceedings,resetnumbers,type=inproceedings]
\end{document}