当使用同一作者、同一年份撰写的多个参考文献时,通常按标题排序,并在年份后添加字母以在引用中区分。
例如,这是一个 MWE:
\documentclass{article}
\usepackage[backend=bibtex,
bibstyle=authoryear,
citestyle=authoryear,
sorting=nyt,
dashed=false]{biblatex}
\bibliography{myref}
\usepackage{filecontents}
\begin{filecontents}{myref.bib}
@inproceedings{someone:2000:xx,
author = {Some Researcher},
title = {Some Important Paper},
year = {2000},
booktitle = {Proc. of Some Cool Conference},
pages = {123--126}
}
@inproceedings{someone:2000:yy,
author = {Some Researcher},
title = {Some Other Important Paper},
year = {2000},
booktitle = {Proc. of Some Other Cool Conference},
pages = {123--126}
}
\end{filecontents}
\begin{document}
\cite{someone:2000:xx}
\cite{someone:2000:yy}
\printbibliography
\end{document}
它在我的参考书目中是这样的:
我希望年份后面的字母大写,这样它就会是 (2000A) 和 (2000B),而不是 (2000a) 和 (2000b),因为这是我的论文格式,如指南中所述。任何帮助都非常感谢,提前致谢!
答案1
额外字母的格式由字段格式控制extradate
。默认情况下,它使用\mknumalph
,它根据给定的数字生成一个小的拉丁字母。我们可以复制\mknumalph
来获得一个\mknumAlph
,它会生成大写拉丁字母,并在格式中使用它。
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=authoryear, backend=biber]{biblatex}
\DeclareFieldFormat{extradate}{%
\iffieldnums{labelyear}
{\mknumAlph{#1}}
{\mkbibparens{\mknumAlph{#1}}}}
\makeatletter
\newrobustcmd*{\mknumAlph}[1]{%
\begingroup
\blx@tempcnta=#1\relax
\ifnum\blx@tempcnta>702 %
\else
\ifnum\blx@tempcnta>26 %
\advance\blx@tempcnta\m@ne
\divide\blx@tempcnta26\relax
\blx@numalph\blx@tempcnta
\multiply\blx@tempcnta26\relax
\blx@tempcnta=\numexpr#1-\blx@tempcnta\relax
\fi
\fi
\blx@numAlph\blx@tempcnta
\endgroup}
\def\blx@numAlph#1{%
\ifcase#1\relax\blx@warning@entry{Value out of range}\number#1\or
A\or B\or C\or D\or E\or F\or G\or H\or I\or J\or K\or L\or M\or
N\or O\or P\or Q\or R\or S\or T\or U\or V\or W\or X\or Y\or Z\else
\blx@warning@entry{Value out of range}\number#1\fi}
\makeatother
\addbibresource{biblatex-examples.bib}
\begin{document}
\autocite{knuth:ct:b,knuth:ct:c}
\printbibliography
\end{document}
对于较短的实现,\mknumAlph
您可以使用expl3
\usepackage{expl3}
\usepackage{xparse}
\ExplSyntaxOn
\NewExpandableDocumentCommand{\mknumAlph}{m}{\int_to_Alph:n{#1}}
\ExplSyntaxOff