我正在尝试使用 moderncv 构建简历,其中除 URL 之外的所有内容都是黑色的。因此,在尝试了其他选项(参见注释行)后,我想在本地手动设置 URL 的颜色。但是 URL 显示在正确条目下方的一行。我做错了什么?
%\PassOptionsToPackage{pdfpagelabels=false}{hyperref}
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{black}
\usepackage[scale=0.75]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\setlength{\hintscolumnwidth}{2.6cm}
\setlength{\makecvheadnamewidth}{5.6cm} % <==== old: makecvtitlenamewidth
\geometry{
a4paper,
total={170mm,257mm},
left=20mm,
top=20mm,
}
%\usepackage[colorlinks]{hyperref}
%\hypersetup{
% colorlinks,
% filecolor=magenta,
% linkcolor=blue,
% citecolor=mypink1,
% urlcolor=cyan,
% final
%}
\definecolor{myblue}{RGB}{0, 32, 255}
%\AfterPreamble{\hypersetup{
%% pdfauthor={Rob Ward},
%% pdftitle={CV for Rob Ward},
%% pdfsubject={Detailed CV for Rob},
%
% colorlinks,
% linkcolor=blue,
% urlcolor=blue,
%}}
\title{John Doe}
\name{Curriculum Vitae}{}
\begin{document}
\section{Personal information}
\cventry{website}{\color{myblue}{\url{www.google.com}}}{}{}{}{}
\end{document}
答案1
您应该在这里使用\textcolor
not \color
。实际上,您已经使用了\textcolor
as \color{blue}
does npt take an parameters 的语法。
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{black}
\usepackage[scale=0.75]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\setlength{\hintscolumnwidth}{2.6cm}
\setlength{\makecvheadnamewidth}{5.6cm} % <==== old: makecvtitlenamewidth
\geometry{
a4paper,
total={170mm,257mm},
left=20mm,
top=20mm,
}
%\usepackage[colorlinks]{hyperref}
%\hypersetup{
% colorlinks,
% filecolor=magenta,
% linkcolor=blue,
% citecolor=mypink1,
% urlcolor=cyan,
% final
%}
\definecolor{myblue}{RGB}{0, 32, 255}
%\AfterPreamble{\hypersetup{
%% pdfauthor={Rob Ward},
%% pdftitle={CV for Rob Ward},
%% pdfsubject={Detailed CV for Rob},
%
% colorlinks,
% linkcolor=blue,
% urlcolor=blue,
%}}
\title{John Doe}
\name{Curriculum Vitae}{}
\begin{document}
\section{Personal information}
\cventry{website}{\textcolor{myblue}{\url{www.google.com}}}{}{}{}{}
\end{document}