2
\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?

  • Welcome to TeX.SX! Please add a full minimal working example (MWE), i.e. a file starting with \documentclass{...} and ending with \end{document}. – diabonas Sep 14 '17 at 16:55
  • Do you want to add a title to the cover letter ? or Do you want to customize the cover letter to include more information ? -- which version of moderncv are you using ? v0.6, v1.2 or v.2.0 ? – Jaime Sep 14 '17 at 17:19
  • I added full working sample, I think I have the version 1.3c – Hakikat41 Sep 14 '17 at 17:36
  • I want customize the cover letter to include more information not add a huge title on the top. – Hakikat41 Oct 5 '17 at 13:25
3

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:

\clearpage                             % start a new page

\recipient{ ... }                      % provide information
\opening{ ... }
\closing{ ... }
\enclosure[ ... ]{ ... }
\makelettertitle                       % print title / header

...                                    % print content
\makeletterclosing                     % print letter footer / signature

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.

\clearpage                             % start a new page
\recipient{ ... }                      % provide information
...

{\centering \Huge Add a title \par}    % add a text before header
\makelettertitle                       % print title / header
{\Huge Add another title \par}         % add a text after header   

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 the moderncv.cls file.

% makes the letter title
% usage: \makelettertitle
\newcommand*{\makelettertitle}{}    % for the version v1.2.0

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.

\renewcommand*{\makelettertitle}{%
   \recomputeletterlengths%
   :
}
1

The banking moderncvstyle prints a title in the letter head. If you want to use a moderncvstyle of your choice, you will have to redefine the makeletterhead command.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.