在 moderncv 中更改地址行的颜色

在 moderncv 中更改地址行的颜色

我目前正在 moderncv 类中编写一封求职信,使用银行风格。我重新定义了“color1”,现在想将地址行中粗体部分的颜色更改为“color1”。但是,如果我\color{color1}\recipient文本前面调用,整个收件人字段会稍微向下移动,这样收件人和日期就不再对齐了。我该如何解决这个问题?

请注意,我进行了操作是\opening为了获得主题行。

您可以在这里找到 MWE:

\documentclass[11pt,a4paper,sans]{moderncv}       
\moderncvstyle{banking}                            
\moderncvcolor{blue}                            
\usepackage[scale=0.75]{geometry}
\usepackage[english]{babel}
\name{Peter}{Example} 
\makeatletter\renewcommand*{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}\makeatother
\usepackage{etoolbox}% Text justification
\makeatletter
\patchcmd{\makeletterhead}% <cmd>
  {\raggedright \@opening}% <search>
  {\@opening}% <replace>
  {}{}% <success><failure>
\makeatother
\definecolor{color1}{RGB}{1,98,161} 
\begin{document}
\recipient{\color{color1}Just a litte text}{Some more text\\example street
\\example city}
\date{\today}
\opening{\textbf{\color{color1}This is a subject line}\\[0.5cm]Dear Mr. Example,}
\closing{Yours faithfully,}
\makelettertitle
Just some random text. \\\\
\makeletterclosing
\end{document}

提前致谢!

答案1

使用\textcolor而不是\color似乎可以给出正确的对齐:

\documentclass[11pt,a4paper,sans]{moderncv}       
\moderncvstyle{banking}                            
\moderncvcolor{blue}                            
\usepackage[scale=0.75]{geometry}
\usepackage[english]{babel}
\name{Peter}{Example} 
\makeatletter\renewcommand*{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}\makeatother
\usepackage{etoolbox}% Blocksatz
\makeatletter
\patchcmd{\makeletterhead}% <cmd>
  {\raggedright \@opening}% <search>
  {\@opening}% <replace>
  {}{}% <success><failure>
\makeatother
\definecolor{color1}{RGB}{1,98,161} 
\begin{document}
\recipient{\textcolor{color1}{Just a litte text}}{Some more text\\example street
\\example city}
\date{\today}
\opening{\textbf{\color{color1}This is a subject line}\\[0.5cm]Dear Mr. Example,}
\closing{Yours faithfully,}
\makelettertitle
Just some random text. \\\\
\makeletterclosing
\end{document}

在此处输入图片描述

相关内容