1

My document has lots of natbib citations of the general form

 \citealt[462]{Andrews1982b} 

— which I would like to not create hyperlinks, while using the HyperRef package to produce other hyperlinks. I believe a way do do this is with \renewcommand. Adapting a suggestion from this question, I've tried:

\let\oldcitealt\citealt
\renewcommand*\citealt[2]{\begin{NoHyper}\oldcitealt[#1]{#2}\end{NoHyper}}

which appears to just disable the whole thing. How can I do this?

EDIT: MWEB (as requested by @samcarter)

\documentclass{article}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@incollection{Andrews1982b,
    Address = {Cambridge, Mass.},
    Author = {Andrews, Avery},
    Booktitle = {The Mental Representation of Grammatical Relations},
    Date-Modified = {2018-01-18 20:29:31 +0000},
    Editor = {Bresnan, Joan},
    Keywords = {Icelandic; quirky case; grammatical relation; agreement; subcategorisation},
    Pages = {426-503},
    Publisher = {MIT Press},
    Title = {The representation of case in Modern {Icelandic}},
    Year = {1982}}
}
\end{filecontents}

\usepackage{natbib}
\usepackage{hyperref}

% what makes it not work
\let\oldcitealt\citealt 
\renewcommand*\citealt[2]{\begin{NoHyper}\oldcitealt[#1]{#2}\end{NoHyper}}
%

\begin{document}
Things are true (\citealt{Andrews1982b}).

\bibliographystyle{plainnat}
\bibliography{\jobname} 
\end{document}

1 Answers1

3

I think you forgot to specify the optional argument in your \renewcommand

\documentclass{article}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@incollection{Andrews1982b,
    Address = {Cambridge, Mass.},
    Author = {Andrews, Avery},
    Booktitle = {The Mental Representation of Grammatical Relations},
    Date-Modified = {2018-01-18 20:29:31 +0000},
    Editor = {Bresnan, Joan},
    Keywords = {Icelandic; quirky case; grammatical relation; agreement; subcategorisation},
    Pages = {426-503},
    Publisher = {MIT Press},
    Title = {The representation of case in Modern {Icelandic}},
    Year = {1982}}
}
\end{filecontents}

\usepackage{natbib}
\usepackage{hyperref}

% with the optional argument, it works
\let\oldcitealt\citealt
\renewcommand*\citealt[2][]{\begin{NoHyper}\oldcitealt[#1]{#2}\end{NoHyper}}

\begin{document}
Things are true (\citealt{Andrews1982b}).

\bibliographystyle{plainnat}
\bibliography{\jobname}
\end{document}

enter image description here

gusbrs
  • 13,740