重新定义 \citealt 以避免创建超链接

重新定义 \citealt 以避免创建超链接

我的文档中有很多 natbib 引用的一般形式

 \citealt[462]{Andrews1982b} 

— 我不想创建超链接,而使用 HyperRef 包来生成其他超链接。我相信这样做的一个方法是使用 \renewcommand。采纳了这个问题, 我试过了:

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

这似乎只是禁用了整个功能。我该怎么做?

编辑:MWEB(根据@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

我认为你忘记在你的\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}

在此处输入图片描述

相关内容