1

How can I change the font style of the authorname in a citation like \citep{} to \textsc?

I tried changing the command of \citep to \textsc{\citep} (see MWE). But this of course creates problems with multiple authors, as i don't want any "and" printed in \textsc as well.

But there must be a way to refer to the authorname similar to \bibfont being the reference to the fontstyle of the bibliography.

I read the natbib documenation and searched this forum. similar problems only focused on the package biblatex. However, let's assume I don't want to change the package.

Note: this is not the same question as this: Format natbib font style (which is about fontstyles in the bibliography):

MWE:

\documentclass[]{scrartcl}
\usepackage[authoryear,sort]{natbib}            
\usepackage{filecontents}

\begin{filecontents}{bib.bib}
@artice{who,
author={Dr Who},
title={said that},
year={2017}
}

@artice{no,
author={Dr No},
title={said otherwise},
year={2017}
}

\end{filecontents}


\begin{document}
\makeatletter
\renewcommand{\cite}[1]{\textsc{\citeauthor{#1}} (\citeyear{#1})}
\renewcommand{\citep}[1]{(\textsc{\citeauthor{#1}} \citeyear{#1})}
\makeatother

I say this \citep{who,no}.
\cite{who} said that.

\bibliographystyle{dinat}
\bibliography{bib}
\end{document}
  • You would have to edit the formatting routine for author names in the bst file used by natbib. The package documentation states that you can declare custom bst files in a natbib.cfg file. – Michael Palmer Jul 30 '17 at 13:09
  • Correct me if i'm wrong but in my understanding having a *.cfg file is about the same as having a '\makeatletter' section before \begin{document} where I change the setting with '\renewcommand' etc which still leaves me with the problem of how to refer to the authorname cite font – Igel_in_aspic Jul 31 '17 at 5:23
  • OK. I was thinking about formatting the names in the bibliography, but it seems that \bibliographystyle{dinat} already takes care of that. For the in-text citations, it seems you have to redefine the internal macro `\NAT@nmfmt'. See answer below for details. – Michael Palmer Jul 31 '17 at 19:45
2

It seems that the natbib package uses the macro \NAT@nmfmt to format the author names in in-text citations. We can redefine it to use small caps.

\documentclass[]{scrartcl}
\usepackage[authoryear,sort]{natbib}
\usepackage{filecontents}

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

\begin{filecontents}{bib.bib}
@artice{who,
author={Dr Who},
title={said that},
year={2017}
}

@artice{no,
author={Dr No},
title={said otherwise},
year={2017}
}

\end{filecontents}


\begin{document}

I say this \citep{who,no}.
\cite{who} said that.

\bibliographystyle{dinat}
\bibliography{bib}
\end{document}

Note that this redefinition will prevent natbib's package option nonamebreak from working. The effect of that option should be obtained with

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

instead of the above redefinition.

Please note that I tested this answer only with your example code and not with any larger real-life document.

| improve this answer | |
  • Seems to be working just fine! Thank you so much – Igel_in_aspic Jul 31 '17 at 21:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.