在某些学术圈,例如理论物理学,在演讲过程中,演讲作者通常只使用自己的姓名首字母来引用自己,而其余作者姓名则按照引用样式保持不变。
例如,如果我的姓名首字母缩写是 DCG,并且我引用了一篇以我为作者的论文,则它应该显示为:
[利马,DCG,霍瓦特,2010]
有没有办法在 LaTeX 中自动完成此操作?我使用 powerdot 进行演示,使用 natbib 进行参考,但在它们的文档中找不到任何此类信息。也许有办法在第二次运行 LaTeX 时替换 BibTeX 生成的字符串,但我不知道该怎么做。
答案1
关于评论,我想提供一种使用方法biblatex
。
首先,我改变了作者输出的定义,并\highlightname
用宏中保存的首字母替换了存储的名称\shortform
。
主要思想受到 P. Lehmann 的启发。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{test1,
author = {Goossens, Michel and Mittelbach, Frank
and Samarin, Alexander},
title = {The LaTeX Companion},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994},
}
@Book{test2,
author = {Mittelbach, Frank and Goossens, Michel
and Samarin, Alexander},
title = {The LaTeX Companion},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994},
}
@Book{test3,
author = {Mittelbach, Frank and Samarin, Alexander
and Goossens, Michel},
title = {The LaTeX Companion},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994},
}
\end{filecontents}
\usepackage[style=authoryear,minnames=8,maxnames=10]{biblatex}
\addbibresource{\jobname.bib}
\newcommand*{\mknamesignature}[5]{\def#1{#2|#3|#4|#5}}
\mknamesignature{\highlightname}{Goossens}{Michel}{}{}
\def\shortform{MG}
\makeatletter
\DeclareNameFormat{labelname}{%
\begingroup
\mknamesignature{\currentsignature}{#1}{#3}{#5}{#7}%
\ifdefequal{\highlightname}{\currentsignature}%
{\let\mkbibnamefirst=\@gobble%
\def\mkbibnamelast{\shortform\@gobble}%
\let\mkbibnameprefix=\@gobble%
\let\mkbibnameaffix=\@gobble}%
{}%
\ifnum\value{listcount}=1\relax
\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}%
\ifblank{#3#5}
{}
{\usebibmacro{name:revsdelim}}%
\else
\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}%
\fi
% Ende der Gruppe
\endgroup
\usebibmacro{name:andothers}}
\makeatother
\begin{document}
Test
\cite{test1}
\cite{test2}
\cite{test3}
\printbibliography
\end{document}
编辑 1:修复间距问题