在演示幻灯片中,一个人自己的作品通常被缩写,比如用姓氏的首字母缩写(例如“这已被 FB(2013)解决”,而不是“这已被 Foobarfoo 和 Barfoobar(2013)解决”)。如何使用 实现这一点BibLaTeX
,同时保留参考书目中的完整参考文献?(例如“Foobarfoo,B. 和 Barfoobar,F.(2013),关于奇怪的 BibLaTeX 问题,BibLaTeX 杂志 12(3)”。[我已经有了后一种参考书目样式,我只是想知道是否有一个选项,以便\cite{}
从标准的全名作者年份样式更改为这种新的缩写样式。我看到了选项abbreviate=true
,但当然没有做到这一点。]
答案1
labelalpha
可能就是您正在寻找的。
编辑添加maxalphanames=999
后,所有作者均缩写(尽管很多名字确实会造成混淆)。
我们让biber
创建标签(labelalpha=true
)并设置template
。
\DeclareLabelalphaTemplate{
\labelelement{
\field[final]{shorthand}
\field{label}
\field[strwidth=1,strside=left]{labelname}
}
\labelelement{
\literal{\,}
}
\labelelement{
\field{year}
}
}
然后\citefield{testartlong}{labelalpha}
我们就可以访问缩短的标签。
然后我们定义一个新的引用命令\abbrvcite
来使用缩写引用(我宁愿不覆盖\cite
来使用这种样式)。
\DeclareCiteCommand{\abbrvcite}
{\usebibmacro{prenote}}
{\printfield{labelalpha}%
\iffieldundef{extraalpha}%
{}%
{\printfield{extraalpha}}}%
{\multicitedelim}
{\usebibmacro{postnote}}
请注意使用extraalpha
,因为缩写的引用可能很快就会变得模棱两可。
完整 MWE
\documentclass[american, a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage[autopunct=true]{csquotes}
\usepackage[labelalpha=true,style=numeric,maxnames=999,maxalphanames=999]{biblatex}
\addbibresource{\jobname.bib}
\begin{filecontents}{\jobname.bib}
@article{testartlong,
author = {Arnold Uthor and William Riter and Rita Esearcher and Steven C. Ientist and Stuart T. Udent and Peter R. Ofessor and Lewis E. C. Turer},
title = {An Article about Articles},
journal = {Journal of Articles},
volume = {8},
number = {2},
page = {1-5},
date = {2010},
}
@article{testart,
author = {Arnold Uthor and William Riter},
title = {A Very Interesting Article},
journal = {Journal of Articles},
volume = {7},
number = {3},
page = {1-5},
date = {2010},
}
@book{testbook,
author = {Walter Ordsmith},
editor = {Eddie Ditor},
title = {The Work},
subtitle = {Subtitle},
date = {1983},
}
@online{testonline,
author = {Bernie Logger},
title = {A Very Opinionated Blog Post},
url = {http://example.com},
year = {2013},
}
@online{testonline2,
author = {Bernie Logger},
title = {A Very Opinionated Blog Post II},
subtitle = {More Text},
url = {http://example.com},
year = {2013},
}
\end{filecontents}
\DeclareLabelalphaTemplate{
\labelelement{
\field[final]{shorthand}
\field{label}
\field[strwidth=1,strside=left]{labelname}
}
\labelelement{
\literal{\,}
}
\labelelement{
\field{year}
}
}
\DeclareCiteCommand{\abbrvcite}
{\usebibmacro{prenote}}
{\printfield{labelalpha}%
\iffieldundef{extraalpha}%
{}%
{\printfield{extraalpha}}}%
{\multicitedelim}
{\usebibmacro{postnote}}
\begin{document}
Let's cite \cite{testartlong}.
\abbrvcite{testartlong} and \abbrvcite{testbook}, \abbrvcite{testart} or \abbrvcite{testonline} vs \abbrvcite{testonline2}.
\nocite{*}
\printbibliography
\end{document}