我正在使用 moderncv,我想更改个人部分中邮件地址链接的颜色,但我希望简历上的其他链接保持蓝色。以下是示例:
\documentclass[11pt,a4paper,dvipsnames]{moderncv}
\moderncvtheme[blue]{classic}
\usepackage[scale=0.8]{geometry}
\usepackage[utf8]{inputenc}
\firstname{First name}
\familyname{Last name}
\title{Curriculum Vitae}
\address{Address line 1}{Address line 2}
\mobile{Phone}
\email{Email}
\AtBeginDocument{\hypersetup{colorlinks, urlcolor=NavyBlue}}
\begin{document}
\cvitem{Email}{\emaillink{[email protected]}}
\section{Education}
\cventry{Year}{Degree}{University}{Location}{GPA. \href{http://www.google.com}{Google}}{}
\cventry{2012}{test}{test}{\texttt{\href{http://www.google.com}{click me}}}{}{}
\cventry{2012}{test}{test}{\texttt{\url{http://www.google.com}}}{}{}
\end{document}
所以,我想要[电子邮件保护]显示为黑色,而谷歌的则保持为蓝色。有办法吗?谢谢!
答案1
一个解决方案可能是\hypersetup
为邮件地址分组一个附加命令:
\begingroup%
\hypersetup{urlcolor=black}%
\cvitem{Email}{\emaillink{[email protected]}}%
\endgroup%
hyperref
这可以防止稍后进行其他设置。
\documentclass[11pt,a4paper,dvipsnames]{moderncv}
\moderncvtheme[blue]{classic}
\usepackage[scale=0.8]{geometry}
\usepackage[utf8]{inputenc}
\firstname{First name}
\familyname{Last name}
\title{Curriculum Vitae}
\address{Address line 1}{Address line 2}
\mobile{Phone}
\email{Email}
\AtBeginDocument{\hypersetup{colorlinks, urlcolor=NavyBlue}}
\begin{document}
\begingroup
\hypersetup{urlcolor=black}%
\cvitem{Email}{\emaillink{[email protected]}}
\endgroup
\section{Education}
\cventry{Year}{Degree}{University}{Location}{GPA. \href{http://www.google.com}{Google}}{}
\cventry{2012}{test}{test}{\texttt{\href{http://www.google.com}{click me}}}{}{}
\cventry{2012}{test}{test}{\texttt{\url{http://www.google.com}}}{}{}
\end{document}
答案2
我设法通过重新定义文档中的 urlcolor 来创建您想要的内容。首先将其定义为黑色,然后在个人部分之后将其更改为 NavyBlue。以下代码返回警告,因为 urlcolor 宏已更改。
\documentclass[11pt,a4paper,dvipsnames]{moderncv}
\moderncvtheme[blue]{classic}
\usepackage[scale=0.8]{geometry}
\usepackage[utf8]{inputenc}
\firstname{First name}
\familyname{Last name}
\title{Curriculum Vitae}
\address{Address line 1}{Address line 2}
\mobile{Phone}
\email{Email}
\AtBeginDocument{\hypersetup{colorlinks, urlcolor=Black}}
\begin{document}
\cvitem{Email}{\emaillink{[email protected]}}
\hypersetup{urlcolor=NavyBlue}
\section{Education}
\cventry{Year}{Degree}{University}{Location}{GPA. \href{http://www.google.com}{Google}}{}
\cventry{2012}{test}{test}{\texttt{\href{http://www.google.com}{click me}}}{}{}
\cventry{2012}{test}{test}{\texttt{\url{http://www.google.com}}}{}{}
\end{document}