How to cite authors in small cap with \citet?

I followed Natbib reference sheet and \citet works as expected. I would like the author's name to appear in small caps, how can I do that?

I guess I should do:

Define \citenumfont to be a font declaration or command like \itshape or [...] \textit.

but I have no idea what it means.

Before you upvote lockstep's answer: it does not work, the authors name are not in small cap, the renewcommand has no effect. His example code does not compile as it is now.

UPDATE: Here is a minimum working example.

smallcap.tex

\documentclass[fleqn]{article}
\usepackage[numbers]{natbib}
\makeatletter
%\renewcommand*{\NAT@nmfmt}[1]{\textsc{#1}}
\def\NAT@nmfmt#1{\textsc{#1}}
\makeatother
\begin{document}
As mentioned in \citet{Biegler97}~\dots
\bibliographystyle{plainnat}
\bibliography{dummy}
\end{document}


dummy.bib

@BOOK{biegler97,
AUTHOR = {Lorenz T. Biegler and Ignacio E. Grossmann and Arthur W. Westerberg},
TITLE = {Systematic Methods of Chemical Process Design},
YEAR = {1997},
PUBLISHER = {Prentice Hall PTR, Upper Saddle River, NJ}
}

-
\renewcommand{\citenumfont}{\textsc} after loading natbib –  egreg Dec 5 '11 at 15:19
@egreg I tried but nothing happened. I recompiled everything properly. –  Ali Dec 5 '11 at 15:24
Please, show a minimal example. –  egreg Dec 5 '11 at 15:25
@egreg Done. Neither of the answers work for me. –  Ali Dec 6 '11 at 11:37

With the numbers option the patch is slightly more complicated:

\usepackage{etoolbox}
\makeatletter
\patchcmd{\NAT@test}{\else\NAT@nm}{\else\NAT@nmfmt{\NAT@nm}}{}{}
\let\NAT@up\scshape
\makeatother


Apparently natbib's author forgot to apply \NAT@nmfmt in the relevant place of \NAT@test

In order to get et al. in roman type,

\usepackage{etoolbox,xstring}
\makeatletter
\patchcmd{\NAT@test}{\else\NAT@nm}{\else\NAT@nmfmt{\NAT@nm}}{}{}
\renewcommand{\NAT@nmfmt}{\expandafter\aliNAT@nmfmt\expandafter}
\newcommand\aliNAT@nmfmt[1]{{%
\noexpandarg
\def~{}%
\edef\temp#1\edef\temp{\detokenize\expandafter{\temp}}%
\begingroup\edef\x{\endgroup
\noexpand\StrSubstitute{\temp}{\detokenize{etal}}}\x
{\textnormal{et\nobreakspace al}}[\tempa]%
\textsc{\tempa}}}
\makeatother

-
Thanks. Unfortunately it turns et al. also in small cap but it shouldn't do so... :( See my example code. –  Ali Dec 6 '11 at 12:54
+1 and thanks, it works. Is it really the simplest solution? I could not have figured that out myself. :( –  Ali Dec 6 '11 at 21:23
@Ali I haven't figured out a simpler solution. Unfortunately, beside the already mentioned oversight, also et~al. is hard coded instead of being buried in a macro. :( –  egreg Dec 6 '11 at 22:55

To cite authors in small caps, it is not necessary to create a new .bst file -- instead, redefine the \NAT@nmfmt macro which is responsible for formating the author's name. (See this answer for other areas of application for \NAT@nmfmt.)

\documentclass{article}

\usepackage{natbib}

\makeatletter
\renewcommand*{\NAT@nmfmt}[1]{\textsc{#1}}
\makeatother

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{Bli74,
author = {Blinder, Alan S.},
year = {1974},
title = {The economics of brushing teeth},
journal = {Journal of Political Economy},
volume = {82},
number = {4},
pages = {887--891},
}
\end{filecontents}

\begin{document}

As mentioned in \citet[99]{Bli74}~\dots

\bibliographystyle{plainnat}
\bibliography{\jobname}

\end{document}


-
@AlanMunn: \citenumfont only works for numbers in numerical citations. –  lockstep Dec 5 '11 at 17:07
+1 and thanks for the response! –  Ali Dec 5 '11 at 21:29
Is it necessary to load the etoolbox package and use that package's \patchcmd macro? The command \def\NAT@nmfmt#1{{\textsc{#1}}} should work equally well, right (if embedded between \makeatletter and \makeatother, naturally)? –  Mico Dec 5 '11 at 22:05
@Mico: Actually, it isn't. Stupid me. Answer corrected. –  lockstep Dec 5 '11 at 22:20
@Ali: I can confirm this, and have already tried to find a solution. The natbib code internals are a real pain, though. Have you considered to switch to biblatex? –  lockstep Dec 6 '11 at 21:19

From p. 15 of the natbib manual:

Numerical citations may be printed in a different font. Define \citenumfont to be a font declaration like \itshape or even a command taking arguments like \textit. [The command] \renewcommand{\citenumfont}[1]{\textit{#1}} ... is better than \itshape since it automatically adds italic correction.

Hence, changing \citenumfont will not affect the font used by LaTeX for typesetting authors' names in either citations or the bibliography. For that, you need to create a bibliography style file (extension .bst), probably from scratch. Have a look at the file makebst.tex (created by the author of the natbib package, by the way). It can be run under either TeX or LaTeX; when you run it, it'll ask you a lot of questions (with predefined options for answers) about the desired bibliography style -- including some about special fonts for authors' names -- and then builds a .bst file with this information.

Addendum: As @lockstep notes in his answer and in a comment to my answer, if you only want to use small-caps for the names of authors/editors in citations, it is not strictly necessary to create a new .bst file: one could, instead, redefine the \NAT@nmfmt macro. However, you must still create a new .bst file if you want the names of authors and editors be typeset in small-caps in the bibliography section as well -- plus you'll have to remember to insert instructions such as

\makeatletter
\def\NAT@nmfmt#1{\textsc{#1}}
\makeatother


from now on in the preamble of every document you write that features this citation format. You might as well simply tell the makebst.tex program about this preference and be done with it once and for all, right?

-
At least for formatting the author's name in citations, one doesn't need to create a .bst file -- see my answer. –  lockstep Dec 5 '11 at 16:56
@lockstep -- good news that one doesn't have to created or modify a .bst file, though the alternative does require extra work as well. –  Mico Dec 5 '11 at 17:16
@Mico +1 and thanks for the response! –  Ali Dec 5 '11 at 21:30
@Mico Your last suggestion does not work :( I am already using similar \def-s in the preamble so another one is no problem. Could you check your last suggestion, please? –  Ali Dec 6 '11 at 8:55
@Ali: Could you be a bit more specific about what "does not work"? I've added a pair of curly braces to the \def; please try the new code. –  Mico Dec 6 '11 at 9:00