[Tex/LaTex] Change author font for specific cite command

biblatexformatting

Consider the following MWE

\documentclass{article}
\usepackage[style=authoryear-comp,backend=biber]{biblatex}
\addbibresource{biblatex-examples.bib}
\AtBeginDocument{%
  \renewcommand*{\mkbibnamelast}[1]{\textsc{#1}}
}

\begin{document}
\textcite{knuth:ct:e}\\
\fullcite{salam}\\
Footcite\footfullcite{baez/article}
\printbibliography
\end{document}

This will print author surnames in small caps for all cite command both in the document and in the bibliography. Just for the \textcite command I want the surname (i.e Knuth in the example) to be printed in the text in regular font rather than in small caps.

EDIT: As of March 2016 (biblatex 3.3), you need to change \mkbibnamefamily instead of \mkbibnamelast

Best Answer

A possible solution is to introduce a toggle to determine whether we are in a text cite or not. Then the modification of \mkbibnamelast is parametrised to the toggle. This solution uses the xpatch package to modify the textcite bibmacro, to set the toggle to true just before executing the textcite macro and to false right after the textcite macro has been executed.

\newtoggle{textcite}

\AtBeginDocument{
  \renewcommand*{\mkbibnamelast}[1]{%
    \iftoggle{textcite}{#1}{\textsc{#1}}}
}

\xpretobibmacro{textcite}{\toggletrue{textcite}}{}{}
\xapptobibmacro{textcite}{\togglefalse{textcite}}{}{}

enter image description here