Biblatex 的 citesetup 和 citetext

Biblatex 的 citesetup 和 citetext

\citesetup我正在使用 biblatex 通过重新定义包含以下内容来使引用编号变为粗体\bfseries

\renewcommand*{\citesetup}{%
\bfseries
\biburlsetup
\frenchspacing}

这使得引用\cite{key}显示为

[1]

根据需要。问题是,有时我想使用\textcite还包括作者姓名,但仍然使用粗体引用编号,即命令\textcite{key}应该产生

作者姓名[1]

使用我的重新定义,\citesetup这无法实现,因为它使作者的名字以及引用数变为粗体,即,

作者姓名 [1]

有人知道通过部分粗体引用来实现预期效果的好方法吗?

答案1

这是一个解决方案,它重新定义了textcitebibmacro(如 citestyle 中所示numeric),定义了一个新\mkbibboldbrackets命令并将其应用于各种引用命令(替换\mkbibbrackets)。请注意,这样前后注仍将以粗体排版。

\documentclass{article}

\usepackage{biblatex}

\makeatletter

\renewbibmacro*{textcite}{%
  \iffieldequals{namehash}{\cbx@lasthash}
    {\multicitedelim}
    {\cbx@tempa
     \ifnameundef{labelname}
       {\printfield[citetitle]{labeltitle}}
       {\printnames{labelname}}%
%     \addspace\bibopenbracket}% DELETED
     \addspace\begingroup\bfseries\bibopenbracket}% ADDED
  \ifnumequal{\value{citecount}}{1}
    {\usebibmacro{prenote}}
    {}%
  \usebibmacro{cite}%
  \savefield{namehash}{\cbx@lasthash}%
%  \gdef\cbx@tempa{\bibclosebracket\multicitedelim}}% DELETED
  \gdef\cbx@tempa{\textbf{\bibclosebracket}\multicitedelim}}% ADDED

\DeclareCiteCommand{\textcite}
  {\let\cbx@tempa=\empty
   \undef\cbx@lasthash}
  {\usebibmacro{citeindex}%
   \usebibmacro{textcite}}
  {}
  {\usebibmacro{postnote}%
%   \bibclosebracket}% DELETED
   \bibclosebracket\endgroup}% ADDED

\newrobustcmd{\mkbibboldbrackets}[1]{%
  \begingroup
  \blx@blxinit
  \blx@setsfcodes
  \bfseries\bibopenbracket#1\bibclosebracket
  \endgroup}

\makeatother

\DeclareCiteCommand{\cite}[\mkbibboldbrackets]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\parencite}[\mkbibboldbrackets]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\smartcite}[\iffootnote\mkbibboldbrackets\mkbibfootnote]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareMultiCiteCommand{\cites}[\mkbibboldbrackets]{\cite}{\multicitedelim}
\DeclareMultiCiteCommand{\parencites}[\mkbibboldbrackets]{\parencite}{\multicitedelim}
\DeclareMultiCiteCommand{\smartcites}[\iffootnote\mkbibboldbrackets\mkbibfootnote]{\smartcite}{\multicitedelim}

\addbibresource{biblatex-examples.bib}

\begin{document}

Some text about \textcite{companion} and \textcite[see][99]{knuth:ct:a}.

\printbibliography

\end{document}

在此处输入图片描述

另一种方法是仅将标签(而不是周围的括号)排版为粗体:

\documentclass{article}

\usepackage{biblatex}

\renewbibmacro*{cite}{%
  \textbf{% ADDED
  \printtext[bibhyperref]{%
    \printfield{prefixnumber}%
    \printfield{labelnumber}%
    \ifbool{bbx:subentry}
      {\printfield{entrysetcount}}
%      {}}}% DELETED
      {}}}}% ADDED

\addbibresource{biblatex-examples.bib}

\begin{document}

Some text about \textcite{companion} and \textcite[see][99]{knuth:ct:a}.

\printbibliography

\end{document}

在此处输入图片描述

相关内容