在 moderncv 求职信中添加日期地点

在 moderncv 求职信中添加日期地点

是否可以自动将地点添加到日期并将其打印在由 生成的求职信的右上角moderncv。这是一个最低限度的工作示例

\documentclass[11pt,a4paper,sans]{moderncv} 
\moderncvstyle{classic} 
\moderncvcolor{blue} 
\usepackage{lipsum} 

\usepackage[scale=0.75]{geometry} 
\usepackage[english]{babel}
\usepackage{blindtext}
%%%%%%%%%%%%%%%%%%%
\usepackage{etoolbox}
\patchcmd{\makelettertitle}{\hfill}{}{}{}
\patchcmd{\makelettertitle}{\raggedleft}{\raggedright}{}{}

\firstname{XXXXXX} % Your first name
\familyname{XXXXXX} 
\title{CV}
\address{XXXXXX,12}{12345,XXXXXX}
\email{[email protected]}

\begin{document}
\recipient{XXXX}{XXXX\\XXXXXXXXXXXX\\1234 XXXXXX\\XXXXXX} 
\date{\today} % Letter date
\opening{blablabla,} % Opening greeting
\closing{blablabla} % Closing phrase
\enclosure[Im Anhang]{CV} % List of enclosed documents
\makelettertitle % Print letter title
\blindtext[3]
\makeletterclosing % Print letter signature
\clearpage
\end{document}

结果如下:

在此处输入图片描述

答案1

的内容\date不一定是日期本身。因此,使用\date类似

\date{Place name, January 01, 1984}

在此处输入图片描述

或者

\date{%
  \begin{tabular}[t]{l@{}}
    Place name \\
    January 01, 1984
  \end{tabular}}

这将确保[t]日期“对象”的操作对齐、多行放置:

在此处输入图片描述

上述输出源于使用moderncv 模板与上述\date用法相同。


对于更复杂的设置,您可以将作为收件人地址的一部分插入。如果您想进行大量更改,\@date完全复制粘贴就可以了,而不是使用\makelettertitleetoolbox

在此处输入图片描述

\documentclass[11pt,a4paper,sans]{moderncv} 
\moderncvstyle{classic} 
\moderncvcolor{blue} 
\usepackage{lipsum} 

\usepackage[scale=0.75]{geometry} 
\usepackage[english]{babel}
\usepackage{blindtext}
%%%%%%%%%%%%%%%%%%%

\makeatletter

\renewcommand*{\makelettertitle}{%
  % recompute lengths (in case we are switching from letter to resume, or vice versa)
  \recomputeletterlengths%
  % sender contact info
  %\hfill%
  \begin{minipage}{.5\textwidth}%
    \raggedright% \raggedleft
    \addressfont\textcolor{color2}{%
      \makebox[\textwidth][l]{\makebox[2\textwidth]{\bfseries\upshape\@firstname~\@lastname\hfill\normalfont\textcolor{black}{\@date}}}\@firstdetailselementfalse%
      \ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\addresssymbol\@addressstreet%
        \ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}% if \addresstreet is defined, \addresscity and addresscountry will always be defined but could be empty
        \ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}%
      \collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
        \makenewline\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}%
      \ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol\emaillink{\@email}}%
      \ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol\httplink{\@homepage}}%
      \ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}}%
    \end{minipage}\\[1em]
  % recipient block
  \begin{minipage}[t]{.5\textwidth}
    \raggedright%
    \addressfont%
    {\bfseries\upshape\@recipientname}\\%
    \@recipientaddress%
  \end{minipage} \\[2em]
  % date
  %\hfill% US style
%  \\[1em]% UK style
  %\@date\\[2em]% US informal style: "January 1, 1900"; UK formal style: "01/01/1900"
  % opening
  \raggedright%
  \@opening\\[1.5em]%
  % ensure no extra spacing after \makelettertitle due to a possible blank line
%  \ignorespacesafterend% not working
  \hspace{0pt}\par\vspace{-\baselineskip}\vspace{-\parskip}}

\makeatother


\firstname{XXXXXX} % Your first name
\familyname{XXXXXX} 
\title{CV}
\address{XXXXXX,12}{12345,XXXXXX}
\email{[email protected]}

\begin{document}
\recipient{XXXX}{XXXX\\XXXXXXXXXXXX\\1234 XXXXXX\\XXXXXX} 
\date{\today} % Letter date
\opening{blablabla,} % Opening greeting
\closing{blablabla} % Closing phrase
\enclosure[Im Anhang]{CV} % List of enclosed documents

\makelettertitle % Print letter title
\blindtext[3]
\makeletterclosing % Print letter signature
\clearpage
\end{document}

相关内容