我使用 apacite 以及 cite{author} 和 citeA{author} 命令。使用 cite{author} 时,作者和年份均已超链接,这没问题。
但是当使用 citeA{author} 时,我只想超链接年份。以下是 citeA{tulving1972, tulving1995} 的屏幕截图:
我希望作者姓名 (tulving) 像文本的其余部分一样显示为黑色。但是,当使用 cite{} 时,我希望姓名和年份都带有超链接。
找到了这个答案但无法设法调整它以使其与 citeA{} 一起工作(注意 citea{}
有什么帮助吗?
答案1
事实证明,这比解决方案要容易得多natbib
。我还没有测试所有其他 cite 命令,但这似乎对\citeA
和 都有效\cite
。
\begin{filecontents}{\jobname.bib}
@article{Adams1987,
Author = {Marianne Adams},
Journal = {Natural Language \& Linguistic Theory},
Pages = {1-32},
Title = {From Old French to the Theory of Pro-Drop},
Volume = {5},
Year = {1987}}
@article{Adams1985,
Author = {Marianne Adams},
Journal = {Linguistic Inquiry},
Pages = {305-313},
Title = {Government of Empty Subjects in Factive Clausal Complements},
Volume = {16},
Year = {1985}}
@book{Chomsky1986,
Address = {Cambridge Mass.},
Author = {Noam Chomsky},
Publisher = {{MIT} Press},
Title = {Barriers},
Year = {1986}}
\end{filecontents}
\documentclass{article}
\usepackage[colorlinks=true]{hyperref}
\usepackage{apacite}
\bibliographystyle{apacite}
\usepackage{etoolbox}
\makeatletter
\newif\if@citeA
\pretocmd{\citeA}{\@citeAtrue}{}{}
\def\@ifauthorsunequalc@de#1{%
\if@F@cite
\@F@citefalse
\else
\if@Y@cite
{\@BAY}%
\fi
{\@BBC}%
\fi
\edef\@cite@undefined{?}%
\def\BBA{\@BBA}%
\if@A@cite
\if@citeA
{\csname b@\@citeb\APAC@extra@b@citeb\endcsname}%
\@citeAfalse
\else
\hyper@natlinkstart{#1}%
{\csname b@\@citeb\APAC@extra@b@citeb\endcsname}%
\hyper@natlinkend
\fi
\if@Y@cite
{\@BBAY}%
\fi
\fi
\if@Y@cite
\hyper@natlinkstart{#1}%
{\csname Y@\@citeb\APAC@extra@b@citeb\endcsname}%
\hyper@natlinkend
\fi
\let\BBA\relax
}
\makeatother
\begin{document}
\noindent
\cite{Adams1985,Chomsky1986}
\citeA{Adams1985,Adams1987}
\citeA<see>[p.22]{Adams1985}
\cite<see>[p.22]{Adams1985}
\bibliography{\jobname}
\end{document}