在 moderncv 信件中移动日期块?

在 moderncv 信件中移动日期块?
  1. 我正在尝试将日期块移至页面右侧(见图 - 这是期望的结果)。但我收到错误There's no line here to end. \makelettertitle
  2. 有没有更好的方法来添加主题块而无需编辑 moderncv.sty?我刚刚将其添加到\opening{}(查看代码)

在此处输入图片描述

最小工作示例:

% !TeX TS-program = xelatex
\documentclass[11pt,a4paper,roman]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{blue}
\usepackage[scale=0.75]{geometry}
\usepackage{lipsum}

% personal data
\name{John}{Doe}
\address{street and number}{postcode city}{country}
\email{[email protected]}
\extrainfo{additional information}

 % Remove extrainfo from cover letter
\patchcmd\makelettertitle{\makenewline\@extrainfo}{}{}{}

% text justify of cover letter
\usepackage{etoolbox}
\makeatletter
\patchcmd{\makelettertitle}% <cmd>
{\raggedright \@opening}% <search>
{\@opening}% <replace>
{}{}% <success><failure>
\makeatother

\begin{document}

\recipient{Company Recruitment team}{Company, Inc.\\123 somestreet\\some city}
\date{  
\begin{flushright}
\today
\end{flushright}  }
\opening{%
\textbf{Subject: bla bla bla alsdlasdlladlla}\\\\       % ugly solution?
Dear Sir or Madam,}
\closing{Yours faithfully,}
\enclosure[Attached]{curriculum vit\ae{}}
\makelettertitle

\lipsum[1-3]

\makeletterclosing

\end{document}

答案1

您移动日期的方法很好,但更短的方法是使用\date{\hfil\today}

然而,原因There's no line here to end与日期无关。相反,这是由\\\\主题之后的引起的。

% !TeX TS-program = xelatex
\documentclass[11pt,a4paper,roman]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{blue}
\usepackage[scale=0.75]{geometry}
\usepackage{lipsum}

% personal data
\name{John}{Doe}
\address{street and number}{postcode city}{country}
\email{[email protected]}
\extrainfo{additional information}

 % Remove extrainfo from cover letter
\patchcmd\makelettertitle{\makenewline\@extrainfo}{}{}{}

% text justify of cover letter
\usepackage{etoolbox}
\makeatletter
\patchcmd{\makelettertitle}% <cmd>
{\raggedright \@opening}% <search>
{\@opening}% <replace>
{}{}% <success><failure>
\makeatother

\begin{document}

\recipient{Company Recruitment team}{Company, Inc.\\123 somestreet\\some city}
\date{\hfil\today}
\opening{%
\textbf{Subject: bla bla bla alsdlasdlladlla}\\       % ugly solution?
Dear Sir or Madam,}
\closing{Yours faithfully,}
\enclosure[Attached]{curriculum vit\ae{}}
\makelettertitle

\lipsum[1-3]

\makeletterclosing

\end{document}

相关内容