如何在文本中正确使用作者姓名

如何在文本中正确使用作者姓名

我想在纯文本中使用我资料中的作者姓名(小写)。我可以通过引用 bibtex 来实现这一点吗?还是我必须坚持使用“硬编码”名称?

这就是我要的:

正如爱因斯坦在他的源 bla blub 中所写。[EIN04]

这是我的做法:

As \textsc{Einstein} wrote in his source bla blub.\cite{Einstein1904}

这就是我想做的事:

As \somecommand{Einstein1904} wrote in his source bla blub. \cite{Einstein1904}

有人知道是否有办法实现这一点?

答案1

如果您使用 biblatex,这个 MWE 应该演示如何从参考书目中访问作者的姓名:

\documentclass{article}

\begin{filecontents}[overwrite]{my.bib}
@article{einstein1905,
    author =       {Einstein, Albert},
    title =        {Zur Elektrodynamik bewegter Körper},
    journal =      {Annalen der Physik},
    volume =       {322},
    number =       {10},
    year =         {1905},
}

@article{zweiDreistein2019,
    author =       {Zweistein, Anton and Dreistein, Berta},
    title =        {Neuste Erkenntnisse},
    journal =      {Annalen der Astrologie},
    volume =       {1},
    number =       {1},
    year =         {2019},
}
\end{filecontents}

\usepackage{biblatex}
\addbibresource{my.bib}

\begin{document}
\citename{einstein1905}{author} said: \ldots

\citename{zweiDreistein2019}{author} said: \ldots

\citeauthor{einstein1905} said: \ldots

\citeauthor{zweiDreistein2019} said: \ldots

Name in small caps:

\newcommand{\albertEinstein}{\textsc{\citename{einstein1905}{author}}}
\albertEinstein{} said: \ldots

\newcommand{\einstein}{\textsc{\citeauthor{einstein1905}}}
\einstein{} said: \ldots
\end{document}

相关内容