[Tex/LaTex] bibtex and genitive / possessive ‘s: the proper way to obtain “Kuran’s (1989) model”

bibtexcitingnatbib

Is there an automatic way to attach a genitive apostrophe or " ' s " to an author's name?

Currently I use:

\citeauthor{kuran1989}'s \citeyear{kuran1989}

But since this comes up regularily I'd like to know whether there's a general solution.

Best Answer

If you're using the natbib package, a possessive citation command should behave very much like the textual citation command \citet. This can be done by altering the name formatting command \NAT@nmfmt in the definition for \citet. One catch with this approach is that numeric styles don't apply \NAT@nmfmt, but you can make them do so by patching \NAT@test via the etoolbox package. (\NAT@test is a command used by the numeric styles to print textual citation labels.)

\documentclass{article}
\usepackage{natbib}
\usepackage[colorlinks]{hyperref}
\usepackage{etoolbox}

\makeatletter

% make numeric styles use name format
\patchcmd{\NAT@test}{\else \NAT@nm}{\else \NAT@nmfmt{\NAT@nm}}{}{}

% define \citepos just like \citet
\DeclareRobustCommand\citepos
  {\begingroup
   \let\NAT@nmfmt\NAT@posfmt% ...except with a different name format
   \NAT@swafalse\let\NAT@ctype\z@\NAT@partrue
   \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}

\let\NAT@orig@nmfmt\NAT@nmfmt
\def\NAT@posfmt#1{\NAT@orig@nmfmt{#1's}}

\makeatother

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{companion,
  author = {Goossens, Michel and Mittelbach, Frank and Samarin, Alexander},
  title = {The LaTeX Companion},
  edition = {1},
  publisher = {Addison-Wesley},
  location = {Reading, Mass.},
  year = {1994}}
@book{adams:life,
  title = {Life, the Universe and Everything},
  author = {Adams, Douglas},
  series = {The Hitchhiker's Guide to the Galaxy},
  publisher = {Pan Macmillan},
  year = {1980}}
@book{adams:rest,
  title = {The Restaurant at the End of the Universe},
  author = {Douglas Adams},
  series = {The Hitchhiker's Guide to the Galaxy},
  publisher = {Pan Macmillan},
  year = {1980}}
\end{filecontents}

\newcommand{\cmd}[1]{\textbackslash\texttt{#1}}
\begin{document}
\noindent
Compact \cmd{citet}: \citet{adams:life,adams:rest} \\
Compact \cmd{citepos}: \citepos{adams:life,adams:rest} \\
\cmd{citet} with postnote: \citet[pp.~10--20]{companion} \\
\cmd{citepos} with postnote: \citepos[pp.~10--20]{companion} \\
\cmd{citepos*} with postnote: \citepos*[p.~10]{companion}
\bibliographystyle{plainnat}
\bibliography{\jobname}
\end{document}

enter image description here

Loading natbib with \usepackage[numbers]{natbib} instead gives:

enter image description here

In English singular possessive nouns are formed typically by adding "'s", even when the name ends with "s" (e.g. "Adams's"). If the possessive should reflect pronunciation (i.e. "Adams'") you can extend the definition of \NAT@posfmt using the xstring package.

...
\usepackage{xstring}
...
\makeatletter
...
\def\NAT@posfmt#1{%
  \StrRemoveBraces{#1}[\NAT@temp]%
  \IfEndWith{\NAT@temp}{s}
    {\NAT@orig@nmfmt{#1'}}
    {\NAT@orig@nmfmt{#1's}}}

\makeatother
...

enter image description here