如何仅在 fullcite 命令中将作者字体更改为小写字母?

如何仅在 fullcite 命令中将作者字体更改为小写字母?

我最近发过这个问题询问如何修改\fullcite命令,以便作者姓名在此特定cite命令中以小写字母显示,但对于其余命令则保持正常字体。虽然我得到了一个答案,其中包含两个可行的选项,但我需要一个不同的答案,因为在我的 Beamer 演示文稿的序言中cite包含了会使这些方法失败。这是一个 MWE:\DeclareNameAlias{author}{family-given}

\documentclass{beamer}

% PACKAGES 

\usepackage{filecontents} % To get the bibliography inside the tex file

\begin{filecontents}{jobname.bib}
@book{author_book,
title = {Book's title},
author = {Author, Some},
location = {The City},
publisher = {Publisher},
date = {2005},
}
\end{filecontents}

\usepackage[isbn=false,giveninits=true,uniquename=init,style=authoryear-comp,backend=biber,natbib,maxbibnames=99,maxcitenames=3,hyperref=true]{biblatex} % To get fancy bibliography as desired.
\addbibresource{jobname.bib}

\DeclareNameAlias{author}{family-given}

% DOCUMENT 

\begin{document}

\fullcite{author_book} [The author here should appear in small caps.]

\citet{author_book} [The author here should appear in normal font.]

\citeauthor{author_book} [The author here should appear in small caps.]

\end{document}

如何fullcite在使用时仅在命令中更改作者的字体\DeclareNameAlias{author}{family-given}?谢谢大家!

答案1

这应该足够了:

\DeclareNameAlias{author}{family-given}

\DeclareNameFormat{family-given}{%
 \ifgiveninits
 {\usebibmacro{name:family-given}
  {\scshape\namepartfamily}
  {\namepartgiveni}
  {\namepartprefix}
  {\namepartsuffix}}
 {\usebibmacro{name:family-given}
  {\namepartfamily}
  {\namepartgiven}
  {\namepartprefix}
  {\namepartsuffix}}%
 \usebibmacro{name:andothers}}

答案2

我的答案你之前的问题如果包含,则无需改变也可以正常工作\DeclareNameAlias{author}{family-given}

\documentclass{article}
\usepackage[
  backend=biber,
  style=numeric,
  giveninits=true, uniquename=init,
  maxbibnames=99, maxcitenames=3,
  isbn=false,
  natbib,
]{biblatex}
\addbibresource{biblatex-examples.bib}

\DeclareNameAlias{author}{family-given}

\DeclareNameWrapperFormat{smallcaps}{%
  \renewcommand*{\mkbibnamefamily}{\textsc}%
  #1}

\DeclareCiteCommand{\fullcite}
  {\usebibmacro{prenote}}
  {\usedriver
     {\DeclareNameAlias{sortname}{default}%
      \DeclareNameWrapperAlias{author}{sortname}%
      \DeclareNameWrapperAlias{editor}{sortname}%
      \DeclareNameWrapperAlias{translator}{sortname}%
      \DeclareNameWrapperAlias{sortname}{smallcaps}}
     {\thefield{entrytype}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\begin{document}
\fullcite{sigfridsson}

\citet{sigfridsson}

\citeauthor{sigfridsson}
\end{document}

小型大写的“Sigfridsson, E. 和 Ryde, U.”

尽管我倾向于\DeclareNameAlias{author}{family-given}\DeclareNameAlias{sortname}{family-given}这里用 替换,并告诉\fullcite不要将别名sortname改为default

\documentclass{article}
\usepackage[
  backend=biber,
  style=numeric,
  giveninits=true, uniquename=init,
  maxbibnames=99, maxcitenames=3,
  isbn=false,
  natbib,
]{biblatex}
\addbibresource{biblatex-examples.bib}

\DeclareNameAlias{sortname}{family-given}

\DeclareNameWrapperFormat{smallcaps}{%
  \renewcommand*{\mkbibnamefamily}{\textsc}%
  #1}

\DeclareCiteCommand{\fullcite}
  {\usebibmacro{prenote}}
  {\usedriver
     {\DeclareNameWrapperAlias{author}{sortname}%
      \DeclareNameWrapperAlias{editor}{sortname}%
      \DeclareNameWrapperAlias{translator}{sortname}%
      \DeclareNameWrapperAlias{sortname}{smallcaps}}
     {\thefield{entrytype}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\begin{document}
\fullcite{sigfridsson}

\citet{sigfridsson}

\citeauthor{sigfridsson}
\end{document}

输出是一样的。

相关内容