Hyperref의 앵커컬러가 작동하지 않나요?

Hyperref의 앵커컬러가 작동하지 않나요?

hyperref패키지를 사용하여 녹색으로 들어오는 내부 링크의 색상을 지정 \label하고 고정된 텍스트에서 오는 내부 링크는 \hypertarget빨간색으로 지정 하려고 합니다 . 그런데 두 경우 모두 관련 텍스트가 녹색으로 표시되나요? 사용하고 있는데 revtex4-1이게 문제는 아닌거 같은데...

\documentclass[a4paper]{revtex4-1}
\usepackage[pdftex]{xcolor}
\usepackage[pdftex,breaklinks,colorlinks,
linkcolor=green,
anchorcolor=red]{hyperref}

\begin{document}

\begin{equation}
   \text{this is an equation} \label{theeq}
\end{equation}

This is the equation \ref{theeq} and it is green as expected.\\
\hypertarget{thelink}{This should be anchored}
\hyperlink{thelink}{ But its color is not red?}

\end{document}

답변1

글쎄요, 당신이 이 버그를 의 관리자에게 보고했다고 가정하겠습니다 hyperref.

문제가 해결될 때까지 다음 해결 방법을 사용할 수 있습니다.

\newcommand{\myhypertarget}[3][red]{\hypertarget{#2}{\textcolor{#1}{#3}}}%

명령은 대상 텍스트에 수동으로 \myhypertarget색상을 설정합니다 .red

다음 MWE를 사용하면

\documentclass[a4paper]{revtex4-2}
\usepackage{xcolor}
\usepackage[%
  breaklinks,
  colorlinks,
  linkcolor=green,
  anchorcolor=red
]{hyperref}

\newcommand{\myhypertarget}[3][red]{\hypertarget{#2}{\textcolor{#1}{#3}}}%


\begin{document}

\begin{equation}
   \text{this is an equation} \label{theeq}
\end{equation}

This is the equation \ref{theeq} and it is green as expected.\\
\hypertarget{thelink}{This should be anchored}

And this is with \texttt{\\myhypertarget}: 
\myhypertarget{thelink1}{This should be anchored}
Text between target and link. Text between target and link. 
Text between target and link. Text between target and link. 
\hyperlink{thelink}{ But its color is not red?}

\hyperlink{thelink1}{ But its color is not red?}

\end{document}

결과는 다음과 같습니다.

결과 PDF

pdftex에 대한 드라이버를 삭제했는지 확인하세요 . 또한 revtex의 현재 버전인 class 를 사용했습니다 .xcolorhyperrefrevtex4-2

관련 정보