# Set author's last name in small caps but avoid them for editors, translators, etc using biblatex

I'm using biblatex and I need author's last name in small caps, so I do this:

\renewcommand\mkbibnamelast[1]{\textsc{#1}}


So I get "SMITH, John" and that's what I needed. But I also get for example:

ALCINOOS (1990). Enseignement des doctrines de Platon. Ed. por J. WHITTAKER y P. LOUIS. Paris: Belles Lettres.

And the problem is I don't want that editors, translators, etc in small caps, because in spanish is not correct.

-

Small capitals can be applied selectively using \ifcurrentname. The example below applies \textsc only to the last names of the fields labelname, author (or editor, in the absence of author). The results are demonstrated with verbose-trad1, but the solution should work for most styles.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{csquotes}
\usepackage[american]{babel}

\renewcommand*{\mkbibnamelast}[1]{%
\ifmknamesc{\textsc{#1}}{#1}}

\renewcommand*{\mkbibnameprefix}[1]{%
\ifboolexpr{ test {\ifmknamesc} and test {\ifuseprefix} }
{\textsc{#1}}
{#1}}

\def\ifmknamesc{%
\ifboolexpr{ test {\ifcurrentname{labelname}}
or test {\ifcurrentname{author}}
or ( test {\ifnameundef{author}} and test {\ifcurrentname{editor}} ) }}

\begin{document}
\null\vfill\noindent
\citeauthor{aristotle:poetics,gaonkar}.
Filler text \autocites[10--15]{aristotle:poetics}{aristotle:rhetoric,companion,cicero}.
Filler text \autocites[11]{companion}[10--15]{aristotle:poetics}{aristotle:rhetoric,gaonkar,vangennep}.
\printbibliography
\end{document}


Note that applying the format to labelname makes \citeauthor set in small capitals. To avoid this under styles with citation tracking enabled, \ifmknamesc can be refined:

\def\ifmknamesc{%
\ifboolexpr{ ( test {\ifbibliography} or test {\ifbool{citetracker}} )
and ( test {\ifcurrentname{labelname}}
or test {\ifcurrentname{author}}
or ( test {\ifnameundef{author}}
and test {\ifcurrentname{editor}} ) ) }}


Under styles without tracking, \citeauthor can be modified directly:

\DeclareCiteCommand{\citeauthor}
{\boolfalse{citetracker}%
\boolfalse{pagetracker}%
\usebibmacro{prenote}}
{\ifciteindex
{\indexnames{labelname}}
{}%
\let\ifmknamesc=\ifbibliography%
\printnames{labelname}}
{\multicitedelim}
{\usebibmacro{postnote}}


To avoid use of small capitals in citations entirely, we can use the test \ifbibliography. The following definition also limits \textsc to the first author (or editor).

\def\ifmknamesc{%
\ifboolexpr{ test {\ifnumequal{\value{listcount}}{1}}
and test {\ifbibliography}
and ( test {\ifcurrentname{author}}
or ( test {\ifnameundef{author}}
and test {\ifcurrentname{editor}} ) ) }}


One style-specific consideration is the idem abbreviation. In the example it is not set in small capitals. To change this you can redefine the cite:idem bibliography macro.

\renewbibmacro*{cite:idem}{%
\textsc{\bibstring[\mkibid]{idem\thefield{gender}}}%
\setunit{\nametitledelim}}

-
It doesn't work for me. I get this error ! Undefined control sequence. \iffirstname ->\ifboolexpr { test {\ifnumequal {\value {listcount}}{1}} and ... What am I doing wrong? I've tried it with my tex file and with the code you've posted in your answer. –  Gastón Sep 29 '11 at 14:59
@Mario For your attempt with the example I posted - did you use an exact copy of the code? It's generally hard to troubleshoot without more information (MWE, biblatex version, etc). –  Audrey Sep 29 '11 at 16:22
biblatex version is biblatex.sty,v 0.8i and latex is LaTeX2e I didn't forget to include \def\iffirstname cause I 've made a copy/paste of your code. –  Gastón Sep 29 '11 at 16:23
@Mario You're definitely in need of an update - the current version is 1.6. If this doesn't fix the problem, feel free to comment/post back here. –  Audrey Sep 29 '11 at 16:27
Thank you. I think I need to update texlive, not only biblatex.sty. ;) –  Gastón Sep 30 '11 at 3:00