하이퍼참조가 \citeauthor 또는 \citeyear가 아닌 \cite만 참조하도록 강제하는 방법은 무엇입니까?

하이퍼참조가 \citeauthor 또는 \citeyear가 아닌 \cite만 참조하도록 강제하는 방법은 무엇입니까?

and 와 함께 hyperref사용하지 않고 and 를 사용할 때만 링크를 만들고 싶습니다 . 예는 다음과 같습니다.\cite\citeyear\citeauthor

\documentclass{article}
\usepackage[numbers]{natbib}
\usepackage{hyperref}

\begin{document}

\citeauthor{Wysocki1960} has shown something interesting in \citeyear{Wysocki1960} \cite{Wysocki1960}.

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

.bib 파일 사용:

@article{Wysocki1960,
annote = {cited By (since 1996) 27},
author = {Wysocki, J.J.},
journal = {Journal of Applied Physics},
number = {3},
pages = {571--578},
title = {{Effect of temperature on photovoltaic solar energy conversion}},
volume = {31},
year = {1960}
}

출력에서 [1]만 링크로 나타나기를 원합니다.

답변1

\NAT@hyper@#1하이퍼링크는 에 정의된 매크로에 의해 설정됩니다 natbib.sty. 를 사용하면 etoolbox낮은 수준의 인용 명령에 연결하여 숫자가 아닌 인용에 대해 아무 작업도 \NAT@citexnum수행하지 않도록 할 수 있습니다. \NAT@hyper@여기에 예가 있습니다.

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

\makeatletter
\pretocmd{\NAT@citexnum}{\@ifnum{\NAT@ctype>\z@}{\let\NAT@hyper@\relax}{}}{}{}
\makeatother

\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,
  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]{\texttt{\textbackslash #1}}

\begin{document}
\noindent
\cmd{citeauthor}: \citeauthor{adams}, \citeauthor{companion} \\
\cmd{cite}: \cite{adams}, \cite{companion} \\
\cmd{citeyear}: \citeyear{adams}, \citeyear{companion} \\
\cmd{citet}: \citet{adams}, \citet[see][p. 20]{adams} \\
multi-\cmd{citet}: \citet{companion,adams} \\
\cmd{citep}: \citep{adams}, \citep[see][p. 20]{companion} \\
multi-\cmd{citep}: \citep{companion,adams} \\
\cmd{citetext}, \cmd{citealp}: \citetext{see \citealp{companion}, or even better \citealp{adams}}
\bibliographystyle{plainnat}
\bibliography{\jobname}
\end{document}

여기에 이미지 설명을 입력하세요

관련 정보