隐藏引文中的粗体字母

隐藏引文中的粗体字母

我使用以下命令在参考书目部分中以粗体显示作者姓名。这也导致在引用中显示粗体作者姓名,我还使用一些命令来抑制它。但是通过使用以下命令,我无法使用 \textcite 命令抑制引用中的粗体字母。这是我正在使用的代码。请帮助我抑制引用中的粗体作者姓名。

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[style=ieee, labeldateparts, backend=biber]{biblatex}
\addbibresource{biblatex-examples.bib}

\makeatletter
\newbibmacro*{simple:cite}{%
  \printtext[bibhyperref]{%
    \printfield{labelprefix}%
    \printfield{labelnumber}%
    \ifbool{bbx:subentry}
      {\printfield{entrysetcount}}
      {}}}

\newbibmacro*{textcite:init}{%
  \ifnumless{\value{multicitecount}}{2}
    {\global\boolfalse{cbx:parens}}
    {}%
  \global\undef\cbx@lasthash
  \global\undef\cbx@lastyear}

\renewbibmacro*{textcite}{%
   \ifboolexpr{test {\iffieldequals{namehash}{\cbx@lasthash}}
               and test {\iffieldequals{labelyear}{\cbx@lastyear}}}
    {\setunit{\multicitedelim}}
    {\ifnameundef{labelname}
       {\printfield[citetitle]{labeltitle}}
       {\printnames{labelname}}%
     \setunit*{\printdelim{nameyeardelim}}%
     \printlabeldate
     \setunit{\printdelim{namelabeldelim}}%
     \printtext{\bibopenbracket}\global\booltrue{cbx:parens}%
     \stepcounter{textcitecount}}%
  \savefield{namehash}{\cbx@lasthash}%
  \savefield{labelyear}{\cbx@lastyear}%
  \ifnumequal{\value{citecount}}{1}
    {\usebibmacro{prenote}}
    {}%
  \usebibmacro{simple:cite}%
  \setunit{%
    \ifbool{cbx:parens}
      {\bibclosebracket\global\boolfalse{cbx:parens}}
      {}%
    \textcitedelim}}

\DeclareCiteCommand{\textcite}[\cbx@textcite@init\cbx@textcite]
  {\gdef\cbx@savedkeys{}%
   \citetrackerfalse%
   \pagetrackerfalse%
   \DeferNextCitekeyHook%
   \usebibmacro{textcite:init}}
  {\ifthenelse{\iffirstcitekey\AND\value{multicitetotal}>0}
     {\protected@xappto\cbx@savedcites{()(\thefield{multipostnote})}%
      \global\clearfield{multipostnote}}
     {}%
   \xappto\cbx@savedkeys{\thefield{entrykey},}%
   \ifboolexpr{test {\iffieldequals{namehash}{\cbx@lasthash}}
               and test {\iffieldequals{labelyear}{\cbx@lastyear}}}
     {}
     {\stepcounter{textcitetotal}}%
   \savefield{namehash}{\cbx@lasthash}%
   \savefield{labelyear}{\cbx@lastyear}}
  {}
  {\protected@xappto\cbx@savedcites{%
     [\thefield{prenote}][\thefield{postnote}]{\cbx@savedkeys}}}
\makeatother

%================================[Make author names bold in bibliography but not in citation]============================================



\let\oldciteauthor\citeauthor
%\switchdelim{\addcomma\space}

\renewcommand{\citeauthor}[1]{%
    {%
        \renewcommand{\textbf}{}% suppress bold faced names in the running text
        \switchdelim{\olddelim}%
        \oldciteauthor{#1}%
        \switchdelim{\addcomma\space}%
    }%
}

\renewcommand{\mkbibnamelast}{\textbf}
\renewcommand{\mkbibnamefirst}{\textbf}
\renewcommand{\mkbibnameprefix}{\textbf}
\renewcommand{\mkbibnameaffix}{\textbf}


\begin{document}
\textcite{sigfridsson}

\textcite{knuth:ct:a,knuth:ct:b}

\textcite{knuth:ct:b,knuth:ct:c}

\printbibliography
\end{document}

答案1

将重新定义包装在\AtBeginBibliography

\AtBeginBibliography{%
  \renewcommand{\mkbibnamefamily}{\textbf}%
  \renewcommand{\mkbibnamegiven}{\textbf}%
  \renewcommand{\mkbibnameprefix}{\textbf}%
  \renewcommand{\mkbibnamesuffix}{\textbf}}

不再\renewcommand{\citeauthor}需要。请注意我如何将宏名称更改为新的biblatex-3.3+ 形式:Biblatex 3.3 名称格式

相关内容