将标题添加到 ModernCV 模板

将标题添加到 ModernCV 模板

我需要在使用模板制作的求职信中,“尊敬的先生或女士”上方加粗标题moderncv,如下所示:

在此处输入图片描述

显然,新创建的标题上方和下方必须有一个新行,但我无法轻松地以这种方式编辑图片。

我是 LaTeX 的新手,我甚至不知道在哪里可以找到控制字母标题的部分。

这是该项目的 github 页面:现代简历我使用这个classic设计。

答案1

在 2.0.0 版本中,moderncv信件的标题是在宏中定义的\makeletterhead

为了获得想要的结果,您需要使用以下代码修补此宏:

\patchcmd{\makeletterhead}{%search
          \raggedright%
  \@opening\\[1.5em]%
        }{%replace
          \raggedright%
  \textbf{\@title}\\[1.5em]
  \@opening\\[1.5em]%
        }{%success
  }{%failure
  }

它添加了\title您必须在打开的文本之前将其定义为粗体标题。

拥有完整的 MWE

\documentclass[11pt,a4paper,sans]{moderncv}

% moderncv themes
\moderncvstyle{classic} % casual, classic, banking, oldstyle and fancy
\moderncvcolor{blue} 

\usepackage[utf8]{inputenc}

\usepackage[scale=0.75]{geometry}

% personal data
\name{John}{Doe}
\title{Resumé title}
\address{street and number}{postcode city}{country}
\phone[mobile]{+1~(234)~567~890}
\phone[fixed]{+2~(345)~678~901}
\phone[fax]{+3~(456)~789~012}
\email{[email protected]}
\homepage{www.johndoe.com}
\social[linkedin]{john.doe}
\social[twitter]{jdoe}
\social[github]{jdoe}
\extrainfo{additional information}
\photo[64pt][0.4pt]{example-image-a}
\quote{Some quote}

\setlength{\footskip}{66pt}

\makeatletter % needed for @ <==========================================
\patchcmd{\makeletterhead}{%search
          \raggedright%
  \@opening\\[1.5em]%
        }{%replace
          \raggedright%
  \textbf{\@title}\\[1.5em]
  \@opening\\[1.5em]%
        }{%success
  }{%failure
  }
\makeatother % needed for @ <===========================================


\begin{document}

%-----       letter       ---------------------------------------------------------
% recipient data
\recipient{Company Recruitment team}{Company, Inc.\\123 somestreet\\some city}
\title{Heading should look like this} % <===============================
\date{January 01, 1984}
\opening{Dear Sir or Madam,}
\closing{Yours faithfully,}
\enclosure[Attached]{curriculum vit\ae{}}
\makelettertitle

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis ullamcorper 
neque sit amet lectus facilisis sed luctus nisl iaculis. Vivamus at neque 
arcu, sed tempor quam. Curabitur pharetra tincidunt tincidunt. Morbi 
volutpat feugiat mauris, quis tempor neque vehicula volutpat. Duis 
tristique justo vel massa fermentum accumsan. Mauris ante elit, feugiat 
vestibulum tempor eget, eleifend ac ipsum. Donec scelerisque lobortis 
ipsum eu vestibulum. Pellentesque vel massa at felis accumsan rhoncus.

Suspendisse commodo, massa eu congue tincidunt, elit mauris pellentesque 
orci, cursus tempor odio nisl euismod augue. Aliquam adipiscing nibh ut 
odio sodales et pulvinar tortor laoreet. Mauris a accumsan ligula. 
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per 
inceptos himenaeos. Suspendisse vulputate sem vehicula ipsum varius nec 
tempus dui dapibus. Phasellus et est urna, ut auctor erat. Sed tincidunt 
odio id odio aliquam mattis. Donec sapien nulla, feugiat eget adipiscing 
sit amet, lacinia ut dolor. Phasellus tincidunt, leo a fringilla 
consectetur, felis diam aliquam urna, vitae aliquet lectus orci nec 
velit. Vivamus dapibus varius blandit.

Duis sit amet magna ante, at sodales diam. Aenean consectetur porta risus 
et sagittis. Ut interdum, enim varius pellentesque tincidunt, magna 
libero sodales tortor, ut fermentum nunc metus a ante. Vivamus odio leo, 
tincidunt eu luctus ut, sollicitudin sit amet metus. Nunc sed orci 
lectus. Ut sodales magna sed velit volutpat sit amet pulvinar diam 
venenatis.

Albert Einstein discovered that $e=mc^2$ in 1905.

\[ e=\lim_{n \to \infty} \left(1+\frac{1}{n}\right)^n \]

\makeletterclosing

\end{document}

然后你会得到以下结果字母:

在此处输入图片描述

相关内容