
상호참조 색상을 변경하는 방법은 이미지처럼 라벨은 검은색, 숫자는 파란색으로 하고 싶습니다
\documentclass{article}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{caption}
\begin{document}
Insert cross reference \autoref{figure}
\begin{figure}%h!
\centering
\includegraphics[]{example-image-a}
\caption{Validation procedure for LR model}\label{figure}
\end{figure}
\end{document}
답변1
내 생각에는 다음 세 가지 일을 해야 한다고 생각합니다.
- 파란색을 정의하십시오.
linkcolor
정의된 파란색 색상을 hyperref의 -key에 할당합니다 .\HyRef@testreftype
참조의 이름/유형을 전달하기 전에 현재 텍스트 색상을 사용하는 패치입니다 .
\documentclass{article}
\usepackage{graphicx}
\usepackage{xcolor}
\definecolor{mylinkcolor}{rgb}{0.561, 0.667, 0.863}
\usepackage[colorlinks=true, linkcolor=mylinkcolor]{hyperref}
\makeatletter
\newcommand\MyAutoefPhrasecolorGroup[1]{%
\color@begingroup\color{MyCurrentcolor}#1\endgroup
}%
\def\HyRef@testreftype#1.#2\\{%
\colorlet{MyCurrentcolor}{.}%
\ltx@IfUndefined{#1autorefname}{%
\ltx@IfUndefined{#1name}{%
\HyRef@StripStar#1\\*\\\@nil{#1}%
\ltx@IfUndefined{\HyRef@name autorefname}{%
\ltx@IfUndefined{\HyRef@name name}{%
\def\HyRef@currentHtag{}%
\Hy@Warning{No autoref name for `#1'}%
}{%
\edef\HyRef@currentHtag{%
\noexpand\MyAutoefPhrasecolorGroup{%
\expandafter\noexpand\csname\HyRef@name name\endcsname
}%
\noexpand~%
}%
}%
}{%
\edef\HyRef@currentHtag{%
\noexpand\MyAutoefPhrasecolorGroup{%
\expandafter\noexpand
\csname\HyRef@name autorefname\endcsname
}%
\noexpand~%
}%
}%
}{%
\edef\HyRef@currentHtag{%
\noexpand\MyAutoefPhrasecolorGroup{%
\expandafter\noexpand\csname#1name\endcsname
}%
\noexpand~%
}%
}%
}{%
\edef\HyRef@currentHtag{%
\noexpand\MyAutoefPhrasecolorGroup{%
\expandafter\noexpand\csname#1autorefname\endcsname
}%
\noexpand~%
}%
}%
}%
\makeatother
\usepackage{caption}
\begin{document}
{\bfseries\verb|\autoref|-references with hyperlink:}
Textcolor unchanged: Insert cross reference \autoref{figure}
Textcolor sawitched to green: \textcolor{green}{Insert cross reference \autoref{figure}}
{\bfseries\verb|\autoref*|-references without hyperlink:}
Textcolor unchanged: Insert cross reference \autoref*{figure}
Textcolor sawitched to green: \textcolor{green}{Insert cross reference \autoref*{figure}}
\begin{figure}%h!
\centering
\includegraphics[]{example-image-a}
\caption{Validation procedure for LR model}\label{figure}
\end{figure}
\end{document}
하이퍼링크가 있는 -참조를 사용하면 \autoref
"그림"이라는 문구가 주변 텍스트 색상으로 나타나며 하이퍼참조의 linkcolor
-키로 표시된 색상으로 나타나는 숫자처럼 클릭할 수 있습니다.