控制 biblatex \citeauthor 中的名字显示?

控制 biblatex \citeauthor 中的名字显示?

有点类似自定义 `\citeauthor*` 以显示完整的作者姓名,但仅显示首字母大写,但我无法理解这一点。考虑一下这个 MWE:

% pdflatex test.tex; biber test; pdflatex test.tex; pdflatex test.tex
\documentclass{article}

\usepackage[%
  style=ieee,
  isbn=true,
  doi=false,
  url=true,
  defernumbers=true,
  sorting=nyt,
  %sorting=none, % "Do not sort at all. All entries are processed in citation order." (order of appearance)
  firstinits=false, % shows full first name in \printbibliography References
  backend=biber
]{biblatex}

\addbibresource{biblatex-examples.bib}
% @book{knuth:ct:a,
%   author       = {Knuth, Donald E.},
%   title        = {The \TeX book},
%   date         = 1984,

\usepackage{xcolor}
\pagecolor{yellow!10}

\begin{document}

As \citeauthor*{knuth:ct:a} noted in \cite{knuth:ct:a}, Tex can be a bit complicated. But as also noted in \cite{knuth:ct:d}, Metafont isn't far behind.

\printbibliography[sorting=none]

\end{document}

它目前产生这样的输出:

测试.png

...也就是说,目前\citeauthor*{knuth:ct:a}仅生成姓氏“ Knuth”。

我想在文本中任意使用\citeauthor*(带选项?)或其他命令,以便基于相同的引用键,我获得:a)“ D. Knuth”(名字作为首字母,忽略中间名);或 b)“ Donald Knuth”(名字完整,忽略中间名)。实际上,如果这样更简单,我会很欣赏包括中间名首字母(“ D. E. Knuth”或“ Donald E. Knuth”)的方法。不用说,我希望参考列表保持如图所示。我该怎么做?

答案1

好吧,一如既往,一个更博学的答案会受到欢迎 - 但就目前而言,我找到了一个解决方法,得出了这个(其中包括中间名的首字母):

测试2.png

first-last它并不是很简单,因为必须查找名称格式“ ”等biblatex.def(它们不在手册中),并且必须使用 hack 来控制firstinits序言之外的内容;但它似乎有效。这是 MWE:

% pdflatex test.tex; biber test; pdflatex test.tex; pdflatex test.tex
\documentclass{article}

\usepackage[%
  style=ieee,
  isbn=true,
  doi=false,
  url=true,
  defernumbers=true,
  sorting=nyt,
  %sorting=none, % "Do not sort at all. All entries are processed in citation order." (order of appearance)
  firstinits=false, % shows full first name
  backend=biber
]{biblatex}

\addbibresource{biblatex-examples.bib}
% @book{knuth:ct:a,
%   author       = {Knuth, Donald E.},
%   title        = {The \TeX book},
%   date         = 1984,

\usepackage{xcolor}
\pagecolor{yellow!10}

% http://tex.stackexchange.com/questions/179169/customize-citeauthor-to-show-full-author-name-but-uppercase-only-the-first-l
% http://tex.stackexchange.com/questions/200112/biblatex-extract-authors-seperately/207529#200119
% in biblatex.def: \DeclareNameFormat{first-last}, \DeclareNameFormat{initsonly}, \DeclareNameFormat{labelname}
\makeatletter%
\DeclareCiteCommand{\citeauthorfin}
  {\renewcommand*{\mkbibnamelast}[1]{####1}%
   \boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\ifciteindex
     {\indexnames{labelname}}
     {}%
   % \printnames[initsonly]{author} % too strong, all is initials (D.E.K.)
   %\printnames[firstinits=true,first-last]{author}} % cannot:
   % \ExecuteBibliographyOptions{firstinits=false} % only in preamble!
   % so must use setkeys:
   \setkeys{blx@opt@pre}{firstinits=true}%
   \printnames[first-last]{author}%
   \setkeys{blx@opt@pre}{firstinits=false}% restore - assuming false is default, which here it is
  }
  {\multicitedelim}
  {\usebibmacro{postnote}}
\makeatother%
\DeclareCiteCommand{\citeauthorffn}
  {\renewcommand*{\mkbibnamelast}[1]{####1}%
   \boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\ifciteindex
     {\indexnames{labelname}}
     {}%
   \printnames[first-last]{author}}
  {\multicitedelim}
  {\usebibmacro{postnote}}


\begin{document}

As \citeauthor*{knuth:ct:a} noted in \cite{knuth:ct:a}, Tex can be a bit complicated. But as also noted in \cite{knuth:ct:d}, Metafont isn't far behind. 
Also, "\citeauthorfin{knuth:ct:a}" and "\citeauthorffn{knuth:ct:a}", and "\citeauthor*{knuth:ct:a}" again after that.

\printbibliography[sorting=none]

\end{document}

相关内容