\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{green}
\usepackage[scale=0.75]{geometry}
\usepackage[ngerman]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{multicol}
\usepackage{xpatch}
\xpatchcmd{\cventry}{.\strut}{\strut}{}{}
\xpatchcmd{\cvitem}{\raggedleft\hintstyle{#2}}{\raggedright\hintstyle{#2}}{}{}
\xpatchcmd*{\cvitemwithcomment}{\bfseries}{\mdseries}{}{}
\makeatletter
\xpatchcmd{\makeletterclosing}{\bfseries \@firstname~\@lastname}
{\includegraphics[width=4cm, height=1cm]{unterschrift.jpg}
\vspace{-10pt}\par
\bfseries \@firstname~\@lastname}
{}{}
\makeatother
% personal data
\name{John}{Doe}
\title{Lebenslauf} % optional, remove / comment the line if not wanted
\address{asdfdsf 12}{77777 scity}{Germany}
\phone[mobile]{+49~(xxx)~xxx~xxx} %
\phone[fixed]{+49~(xxx)~xxx~xxx}
\email{XXXXX}
\photo[64pt][0.4pt]{picture}
\renewcommand*{\bibliographyitemlabel}{[\arabic{enumiv}]}
\usepackage{ifthen} % <===========================================
\newboolean{CV}
\setboolean{CV}{false} % <===========================================
\newboolean{Letter}
\setboolean{Letter}{true} % <===========================================
\begin{document}
\ifthenelse{\boolean{CV}}{% print CV
\makecvtitle
\setlength{\hintscolumnwidth}{0.195\textwidth}
\section{Hobbys}
\cvlistitem{dance}
\cvlistitem{chess}
\cvlistitem{cook}
\cvlistitem{swim}
\ \\
\ \\
\includegraphics[width=4cm, height=1cm]{unterschrift.jpg} \\
ccity, 10. Oktober 2017
\clearpage
}{% print no CV
}
\title{Bewerbung um XXX}
\ifthenelse{\boolean{Letter}}{% print Cover Letter
\recipient{Xxxy}{Xxxxx\\XXXXX\\XXXXXXXX}
\date{ccity, 10.10.2017}
\opening{\textbf{Sehr geehrte Damen und Herren},}
\closing{Mit freundlichen Gr"u"sen,}
\enclosure[Im Anhang]{Lebenslauf}
\makelettertitle
Suspendisse commodo, massa eu congue tincidunt, elit mauris pellentesque orci, cursus tempor odio nisl euismod augue.
\makeletterclosing
}{% print no Cover Letter
}
\end{document}
I want to add a title to my letter. The \title{} doesn't print any title. Can someone please help?
Best Answer
In moderncv, the classic cover letter does not use the information you provide in the
\title
. Basically, it was written to create that page without providing any title.How the cover letter is created
A cover letter is created using some macros to provide information, a macro to create a header and other to create the signature and footer:
The
\makelettertitle
and\makeletterclosing
do not use the information of the title (@title
) to create the content.How to add a title
At the end, A moderncv document is a LaTeX document. You can add content before or after the header provided by the template. For instance, you can add a title before the header or after the salutation.
Modifying moderncv
You may be interested on modifying the moderncv template. You can get the source code from Github.
If you want to change the code, note that
moderncv
has many "styles". The\makelettertitle
is defined empty in themoderncv.cls
file.The macro is redefined in each style. For instance, if you use the classic style, that style is defined in
moderncvstyleclassic.sty
file. You must look for the\renewcommand*{\makelettertitle}
in the file for the style you are using and change the code.