1

Based on the .bib file included below, I would like to add something like "[..] Grubbs' (1969) test [...]" in the body text of my LaTeX script, i.e. insert an apostrophe between the author's name and the year of publication. So far, I came up with the following (reproducible) example:

\documentclass{article}

\usepackage[authoryear]{natbib}
\usepackage{filecontents}

%% .bib file contents
\begin{filecontents}{\jobname.bib}
@Article{Grubbs1969,
  author    = {Grubbs, F.},
  title     = {{Procedures for Detecting Outlying Observations in Samples}},
  year      = {1969},
  volume    = {11},
  number    = {1},
  pages     = {1--21},
  doi       = {10.1080/00401706.1969.10490657},
  file      = {:Grubbs - 1969.pdf:URL},
  owner     = {fdetsch},
  timestamp = {2016-10-20}
}
\end{filecontents}

\begin{document}

%% body text
\citeauthor{Grubbs1969}' (\citeyear{Grubbs1969}) test

%% bibliography incl. style
\bibliography{\jobname.bib}
\bibliographystyle{plainnat}

\end{document}

First of all, this produces the desired result:

grubbs_test

However, I am wondering whether there is a more convenient way to temporarily modify the author-year separator passed on to \citet. Right now, there are two separate hyperlinks involved - one associated with "Grubbs" and the other associated with "1969", whereas both the apostrophe and the round brackets are not clickable at all (which is different from all other, i.e. standard in-line references created via \citet).

  • at least you could define your own cite command: \newcommand[1]{\mycite}{\citeauthor{#1}' (\citeyear{#1})} – Timothy Truckle Oct 21 '16 at 9:20
  • 1
    Can you please add a minimal working example with bibliography (MWEB) to give us something to start working with? – user36296 Oct 21 '16 at 9:28
  • Done @samcarter - still new to the LaTeX forum, thanks for the hint. – fdetsch Oct 21 '16 at 9:53
2

In case you only need this for one article, you could work with a citealias. This requires you to define the text, but the whole citation will be hyperrefed.

\documentclass{article}

\usepackage[authoryear]{natbib}
\usepackage{hyperref}
\usepackage{filecontents}

%% .bib file contents
\begin{filecontents}{\jobname.bib}
@Article{Grubbs1969,
  author    = {Grubbs, F.},
  title     = {{Procedures for Detecting Outlying Observations in Samples}},
  year      = {1969},
  volume    = {11},
  number    = {1},
  pages     = {1--21},
  doi       = {10.1080/00401706.1969.10490657},
  file      = {:Grubbs - 1969.pdf:URL},
  owner     = {fdetsch},
  timestamp = {2016-10-20}
}
\end{filecontents}

\defcitealias{Grubbs1969}{Grubbs' (1969)} 

\begin{document}

\citetalias{Grubbs1969} 

%% body text
\citetext{\citeauthor{Grubbs1969}' (\citeyear{Grubbs1969})} test

%% bibliography incl. style
\bibliography{\jobname.bib}
\bibliographystyle{plainnat}

\end{document}

enter image description here

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.