5

I am working on my cv and my cover letter and I have different questions.

My current code:

\documentclass[11pt,a4paper]{moderncv}


\moderncvtheme[green]{classic}                  

\usepackage[utf8]{inputenc}                  
\usepackage{floatflt}
\usepackage{lipsum} 


\usepackage[scale=0.8]{geometry}
\geometry{a4paper,left=2cm,right=1cm, top=1cm, bottom=1cm} 

\firstname{Prename}
\familyname{\newline Surname}
\title{Curriculum vitae}              
\address{}{}  
\photo[128pt]{picture}                        

\usepackage{wrapfig}


\makeatletter
\renewcommand*{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}
\makeatother


%----------------------------------------------------------------------------------
%            content
%----------------------------------------------------------------------------------

\begin{document}
\includegraphics{footer3.jpg}\\
\maketitle
born 99.11.999 in smallcity\\

\section{school education}

\cventry{1996- 2008}{Abitur}{School City}{}{}{grade: x,x}  
\cventry{1996--2000}{elementary school}{}{}{}{Grundschule somewhere}
\section{studies}

\cventry{02.10.2011-- today}{matriculation Master of Science in xxx}{}{}{}{Joint Masters Program in whatever}
\cventry{07.04.2011}{finishing of Bachelor studies}{}{}{}{grade: x,x title: Bachelor of Science whatever}
\cventry{02.12.2010-01.02.2011}{student assistant}{}{}{}{Chair of xxx  Prof. Dr. xxx \newline student assistant as a tutor of xxx}
\cventry{21.07.2008--29.09.2011}{matriculation Bachelor of Science xxx}{}{}{}{university of xxx}
\section{Bachelor thesis}
\cvline{title}{\emph{Here comes a long title}}
\cvline{supervisor}{Prof. Dr. xxxxx}
\cvline{date}{february 2011}
\cvline{grade}{1.0}

%\section{Master Thesis}
%\cvline{Title}{\emph{Processor hardware implementation for Galois Counter Mode (GCM-AES) security encryption standard}}
%\cvline{Supervisors}{Constantinos Goutis}
%\cvline{Description}{\small Project based on VHDL design language; Hardware architecture design of an encryption algorithm; Validation using C programming and implementation on a Xilinx FPGA}

%\section{Other Projects}
%\subsection{Master projects}
%\cvline{VHDL}{Design and implementation of a multiply - add unit, Modeling using Octave, Testing in a Xilinx FPGA using a logic analyzer}
%\cvline{VHDL}{Architectural exploration of a LMS filter, Optimization for power, area and performance}

\section{languages}
\cvlanguage{german}{mother tongue}{}
\cvlanguage{english}{fluent}{}

\section{technical knowledge}
\begin{wrapfigure}{r}{0.5\textwidth}
  \begin{center}


  \end{center}
\end{wrapfigure}
\cvline{basic}{Stata, SPSS}
\cvline{expert}{R}

\cvline{miscellaneous}{LaTex, Microsoft Office, Microsoft Dynamics} 


\clearpage

\recipient{HR Departmnet}{Corporation\\123 Pleasant Lane\\12345 City, State} 
\date{\today} 
\opening{Dear Sir or Madam,} 
\closing{Sincerely yours,} 
\enclosure[Attached]{curriculum vit\ae{}} 

\makelettertitle 

\lipsum[1-3] 

\makeletterclosing

\end{document}

Where picture is the following picture of myself:

pi

and footer3 is the following header created with paint:

fo

In total this gives the following output: t1

t2

First of all, I am not happy with the implemented solution to create my header. I do not know how to create the following header I want: I want to have the structure as the paint-solution shows. So I want to have it somehow horizontal. So left is my adress, then right to it (in the middle) comes my telephone number and right to it (so at the right corner) comes the mail. I do not want a vertical solution, so that the telephone is under the adress and so. In addition, I want a nice long vertical line underlining this. How can I get this? I want the same header for the cover letter, since I think this makes sense?

As you can see, there is something wrong with the cover letter: The attachement somehow does not work, it seems to me, latex does not get it as code and prints it as text? Where is the mistake?

My other thought is that I want to have a green element in the cover letter too. So I was somehow dreaming about a nice line combination in in the cover letter above the title, something like this (in a better design and with the same green color): t2ed

I know this is possible with tikz, but I don't know how to code what I want, since my latex knowledge is limited.

1
  • Have a look at remember picture and overlay in the TikZ manual.
    – user10274
    Commented Sep 13, 2013 at 10:53

1 Answer 1

6
+100
  • Since moderncv internally loads fancyhdr, I defined a myfancy page style to produce the desired header.

  • I used TikZ to produce the green rule in the letter. In my opinion, the shape for the green line you suggest in the letter seems not too good; I replaced it with a straight line (this looks a little better, but perhaps no rule at all is the best?).

  • I redefined \makecvtitle so as to give you the desired layout for the first and family names.

  • Analogously, I redefined the opening and closing sections of the letter to have the desired formatting for first and last names.

The code:

\documentclass[11pt,a4paper]{moderncv}
\moderncvtheme[green]{classic}                  
\usepackage[utf8]{inputenc}                  
\usepackage{floatflt}
\usepackage{fancyhdr} 
\usepackage{geometry}
\geometry{a4paper,left=2cm,right=1cm, top=2cm, bottom=1.5cm,headheight=21pt} 
\usepackage{tikz} 
\usepackage{wrapfig}
\usepackage{lipsum} 

% Suppress final dot in \cventry
\renewcommand*\cventry[7][.25em]{%
  \cvitem[#1]{#2}{%
    {\bfseries#3}%
    \ifthenelse{\equal{#4}{}}{}{, {\slshape#4}}%
    \ifthenelse{\equal{#5}{}}{}{, #5}%
    \ifthenelse{\equal{#6}{}}{}{, #6}%
    \strut%
    \ifx&#7&%
      \else{\newline{}\begin{minipage}[t]{\linewidth}\small#7\end{minipage}}\fi}}

% New page style
\fancypagestyle{myfancy}{
\fancyhead[L]{\parbox[t]{.3333\textwidth}{\sffamily\footnotesize
  Address Line 1\\Address Line 2}}
\fancyhead[C]{\parbox[t]{.3333\textwidth}{\fixedphonesymbol\sffamily\footnotesize  555-123-456-789}}
\fancyhead[R]{\parbox[t]{.3333\textwidth}{\emailsymbol\sffamily\footnotesize  [email protected]}}
}
\makeatletter
\let\ps@plain\ps@myfancy
\let\ps@empty\ps@myfancy
\makeatother
\pagestyle{myfancy}

% Redefinitions of \makecvtitle, opening and closing to
% have the desired formatting for first and family names
\makeatletter
\renewcommand*{\makecvtitle}{%
  % recompute lengths (in case we are switching from letter to resume, or vice versa)
  \recomputecvlengths%
  % optional detailed information (pre-rendering)
  \def\phonesdetails{}%
  \collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
    \protected@edef\phonesdetails{\phonesdetails\protect\makenewline\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}%
  \def\socialsdetails{}%
  \collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
    \protected@edef\socialsdetails{\socialsdetails\protect\makenewline\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}}%
  \newbox{\makecvtitledetailsbox}%
  \savebox{\makecvtitledetailsbox}{%
    \addressfont\color{color2}%
    \begin{tabular}[b]{@{}r@{}}%
      \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}}%
      \phonesdetails% needs to be pre-rendered as loops and tabulars seem to conflict
      \ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol\emaillink{\@email}}%
      \ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol\httplink{\@homepage}}%
      \socialsdetails% needs to be pre-rendered as loops and tabulars seem to conflict
      \ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}%
    \end{tabular}
  }%
  % optional photo (pre-rendering)
  \newbox{\makecvtitlepicturebox}%
  \savebox{\makecvtitlepicturebox}{%
    \ifthenelse{\isundefined{\@photo}}%
    {}%
    {%
      \hspace*{\separatorcolumnwidth}%
      \color{color1}%
      \setlength{\fboxrule}{\@photoframewidth}%
      \ifdim\@photoframewidth=0pt%
        \setlength{\fboxsep}{0pt}\fi%
      \framebox{\includegraphics[width=\@photowidth]{\@photo}}}}%
  % name and title
  \newlength{\makecvtitledetailswidth}\settowidth{\makecvtitledetailswidth}{\usebox{\makecvtitledetailsbox}}%
  \newlength{\makecvtitlepicturewidth}\settowidth{\makecvtitlepicturewidth}{\usebox{\makecvtitlepicturebox}}%
  \ifthenelse{\lengthtest{\makecvtitlenamewidth=0pt}}% check for dummy value (equivalent to \ifdim\makecvtitlenamewidth=0pt)
    {\setlength{\makecvtitlenamewidth}{\textwidth-\makecvtitledetailswidth-\makecvtitlepicturewidth}}%
    {}%
  \begin{minipage}[b]{\makecvtitlenamewidth}%
    \namestyle{\@firstname}\par\smallskip\namestyle{\@lastname}%
    \ifthenelse{\equal{\@title}{}}{}{\\[1.25em]\titlestyle{\@title}}%
  \end{minipage}%
  \hfill%
  % optional detailed information (rendering)
  \llap{\usebox{\makecvtitledetailsbox}}% \llap is used to suppress the width of the box, allowing overlap if the value of makecvtitlenamewidth is forced
  % optional photo (rendering)
  \usebox{\makecvtitlepicturebox}\\[2.5em]%
  % optional quote
  \ifthenelse{\isundefined{\@quote}}%
    {}%
    {{\centering\begin{minipage}{\quotewidth}\centering\quotestyle{\@quote}\end{minipage}\\[2.5em]}}%
  \par}% to avoid weird spacing bug at the first section if no blank line is left after \makecvtitle
\renewcommand*{\makeletterclosing}{
  \@closing\\[3em]%
  {\bfseries\@firstname\\\@lastname}%
  \ifthenelse{\isundefined{\@enclosure}}{}{%
    \\%
    \vfill%
    {\color{color2}\itshape\enclname: \@enclosure}}}
\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}%
    \raggedleft%
    \addressfont\textcolor{color2}{%
      {\bfseries\upshape\@firstname\\\@lastname}\@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}
  % 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

\makeatletter
\renewcommand*{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}
\makeatother

\firstname{Prename}
\familyname{Surname}
\title{Curriculum vitae}              
\address{}{}  
\photo[128pt]{picture}                        

\begin{document}

\makecvtitle
born 99.11.999 in smallcity

\section{school education}

\cventry{1996- 2008}{Abitur}{School City}{}{}{grade: x,x}  
\cventry{1996--2000}{elementary school}{}{}{}{Grundschule somewhere}
\section{studies}

\cventry{02.10.2011-- today}{matriculation Master of Science in xxx}{}{}{}{Joint Masters Program in whatever}
\cventry{07.04.2011}{finishing of Bachelor studies}{}{}{}{grade: x,x title: Bachelor of Science whatever}
\cventry{02.12.2010-01.02.2011}{student assistant}{}{}{}{Chair of xxx  Prof. Dr. xxx \newline student assistant as a tutor of xxx}
\cventry{21.07.2008--29.09.2011}{matriculation Bachelor of Science xxx}{}{}{}{university of xxx}
\section{Bachelor thesis}
\cvline{title}{\emph{Here comes a long title}}
\cvline{supervisor}{Prof. Dr. xxxxx}
\cvline{date}{february 2011}
\cvline{grade}{1.0}

\section{languages}
\cvlanguage{german}{mother tongue}{}
\cvlanguage{english}{fluent}{}

\section{technical knowledge}

\cvline{basic}{Stata, SPSS}
\cvline{expert}{R}

\cvline{miscellaneous}{LaTex, Microsoft Office, Microsoft Dynamics} 


\clearpage

\begin{tikzpicture}[remember picture,overlay]
\draw[color1,line width=10pt] 
  ([yshift=-55pt]current page.north west) -- +(14cm,0pt);
\end{tikzpicture}
\recipient{HR Departmnet}{Corporation\\123 Pleasant Lane\\12345 City, State} 
\date{\today} 
\opening{Dear Sir or Madam,} 
\closing{Sincerely yours,} 
\enclosure[Attached]{curriculum vit\ae{}} 

\makelettertitle 

\lipsum[1-3] 

\makeletterclosing

\end{document}

enter image description here

Of course, a package such as xpatch can be used to patch the corresponding commands, considerably simplifying the code:

\documentclass[11pt,a4paper]{moderncv}
\moderncvtheme[green]{classic}                  
\usepackage[utf8]{inputenc}                  
\usepackage{floatflt}
\usepackage{fancyhdr} 
\usepackage{geometry}
\geometry{a4paper,left=2cm,right=1cm, top=2cm, bottom=1.5cm,headheight=21pt} 
\usepackage{tikz} 
\usepackage{wrapfig}
\usepackage{xpatch} 
\usepackage{lipsum} 


% Suppress final dot in \cventry
\xpatchcmd{\cventry}{.\strut}{\strut}{}{}

% New page style
\fancypagestyle{myfancy}{
\fancyhead[L]{\parbox[t]{.3333\textwidth}{\sffamily\footnotesize
  Address Line 1\\Address Line 2}}
\fancyhead[C]{\parbox[t]{.3333\textwidth}{\fixedphonesymbol\sffamily\footnotesize  555-123-456-789}}
\fancyhead[R]{\parbox[t]{.3333\textwidth}{\emailsymbol\sffamily\footnotesize  [email protected]}}
}
\makeatletter
\let\ps@plain\ps@myfancy
\let\ps@empty\ps@myfancy
\makeatother
\pagestyle{myfancy}

\makeatletter
\xpatchcmd{\makecvtitle}{\namestyle{\@firstname\ \@lastname}}{\namestyle{\@firstname}\par\smallskip\namestyle{\@lastname}}{}{}
\xpatchcmd{\makelettertitle}{\@firstname~\@lastname}{\@firstname\\\@lastname}{}{}
\xpatchcmd{\makeletterclosing}{\@firstname~\@lastname}{\@firstname\\\@lastname}{}{}
\makeatother

\makeatletter
\renewcommand*{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}
\makeatother

\firstname{Prename}
\familyname{Surname}
\title{Curriculum vitae}              
\address{}{}  
\photo[128pt]{picture}                        

\begin{document}

\makecvtitle
born 99.11.999 in smallcity

\section{school education}

\cventry{1996- 2008}{Abitur}{School City}{}{}{grade: x,x}  
\cventry{1996--2000}{elementary school}{}{}{}{Grundschule somewhere}
\section{studies}

\cventry{02.10.2011-- today}{matriculation Master of Science in xxx}{}{}{}{Joint Masters Program in whatever}
\cventry{07.04.2011}{finishing of Bachelor studies}{}{}{}{grade: x,x title: Bachelor of Science whatever}
\cventry{02.12.2010-01.02.2011}{student assistant}{}{}{}{Chair of xxx  Prof. Dr. xxx \newline student assistant as a tutor of xxx}
\cventry{21.07.2008--29.09.2011}{matriculation Bachelor of Science xxx}{}{}{}{university of xxx}
\section{Bachelor thesis}
\cvline{title}{\emph{Here comes a long title}}
\cvline{supervisor}{Prof. Dr. xxxxx}
\cvline{date}{february 2011}
\cvline{grade}{1.0}

\section{languages}
\cvlanguage{german}{mother tongue}{}
\cvlanguage{english}{fluent}{}

\section{technical knowledge}

\cvline{basic}{Stata, SPSS}
\cvline{expert}{R}

\cvline{miscellaneous}{LaTex, Microsoft Office, Microsoft Dynamics} 


\clearpage

\begin{tikzpicture}[remember picture,overlay]
\draw[color1,line width=10pt] 
  ([yshift=-55pt]current page.north west) -- +(14cm,0pt);
\end{tikzpicture}
\recipient{HR Departmnet}{Corporation\\123 Pleasant Lane\\12345 City, State} 
\date{\today} 
\opening{Dear Sir or Madam,} 
\closing{Sincerely yours,} 
\enclosure[Attached]{curriculum vit\ae{}} 

\makelettertitle 

\lipsum[1-3] 

\makeletterclosing

\end{document}

The initial version of the code:

\documentclass[11pt,a4paper]{moderncv}
\moderncvtheme[green]{classic}                  
\usepackage[utf8]{inputenc}                  
\usepackage{floatflt}
\usepackage{fancyhdr} 
\usepackage{geometry}
\geometry{a4paper,left=2cm,right=1cm, top=2cm, bottom=1.5cm,headheight=21pt} 
\usepackage{tikz} 
\usepackage{wrapfig}
\usepackage{lipsum} 

% Suppress final dot in \cventry
% Suppress final dot in \cventry
\renewcommand*\cventry[7][.25em]{%
  \cvitem[#1]{#2}{%
    {\bfseries#3}%
    \ifthenelse{\equal{#4}{}}{}{, {\slshape#4}}%
    \ifthenelse{\equal{#5}{}}{}{, #5}%
    \ifthenelse{\equal{#6}{}}{}{, #6}%
    \strut%
    \ifx&#7&%
      \else{\newline{}\begin{minipage}[t]{\linewidth}\small#7\end{minipage}}\fi}}
% New page style
\fancypagestyle{myfancy}{
\fancyhead[L]{\parbox[t]{.3333\textwidth}{\sffamily\footnotesize
  Address Line 1\\Address Line 2}}
\fancyhead[C]{\parbox[t]{.3333\textwidth}{\fixedphonesymbol\sffamily\footnotesize  555-123-456-789}}
\fancyhead[R]{\parbox[t]{.3333\textwidth}{\emailsymbol\sffamily\footnotesize  [email protected]}}
}
\makeatletter
\let\ps@plain\ps@myfancy
\let\ps@empty\ps@myfancy
\makeatother
\pagestyle{myfancy}

\makeatletter
\renewcommand*{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}
\makeatother

\firstname{Prename\\[.2ex]}
\familyname{\unskip Surname}
\title{Curriculum vitae}              
\address{}{}  
\photo[128pt]{picture}                        

\begin{document}

\makecvtitle
born 99.11.999 in smallcity

\section{school education}

\cventry{1996- 2008}{Abitur}{School City}{}{}{grade: x,x}  
\cventry{1996--2000}{elementary school}{}{}{}{Grundschule somewhere}
\section{studies}

\cventry{02.10.2011-- today}{matriculation Master of Science in xxx}{}{}{}{Joint Masters Program in whatever}
\cventry{07.04.2011}{finishing of Bachelor studies}{}{}{}{grade: x,x title: Bachelor of Science whatever}
\cventry{02.12.2010-01.02.2011}{student assistant}{}{}{}{Chair of xxx  Prof. Dr. xxx \newline student assistant as a tutor of xxx}
\cventry{21.07.2008--29.09.2011}{matriculation Bachelor of Science xxx}{}{}{}{university of xxx}
\section{Bachelor thesis}
\cvline{title}{\emph{Here comes a long title}}
\cvline{supervisor}{Prof. Dr. xxxxx}
\cvline{date}{february 2011}
\cvline{grade}{1.0}

\section{languages}
\cvlanguage{german}{mother tongue}{}
\cvlanguage{english}{fluent}{}

\section{technical knowledge}

\cvline{basic}{Stata, SPSS}
\cvline{expert}{R}

\cvline{miscellaneous}{LaTex, Microsoft Office, Microsoft Dynamics} 


\clearpage

\begin{tikzpicture}[remember picture,overlay]
\draw[color1,line width=10pt] 
  ([yshift=-55pt]current page.north west) -- +(14cm,0pt);
\end{tikzpicture}
\recipient{HR Departmnet}{Corporation\\123 Pleasant Lane\\12345 City, State} 
\date{\today} 
\opening{Dear Sir or Madam,} 
\closing{Sincerely yours,} 
\enclosure[Attached]{curriculum vit\ae{}} 

\makelettertitle 

\lipsum[1-3] 

\makeletterclosing

\end{document}
3
  • @Gonazlo Medina I have a further question: I want to include a png file with my handwritten signature. How can I include it in a way that it is between sincerely yours and my printed name? I use the first version you posted.
    – Jen Bohold
    Commented Sep 22, 2013 at 11:52
  • Are you in the mood for answering an old question based on your code here? 'Questions about my cv and cover letter' revisited, changing number of lines in address
    – Johannes_B
    Commented Mar 8, 2015 at 17:24
  • @Johannes_B Later I'll take a look at the new question and let you know when I provide an answer there. Thanks for the heads up. Commented Mar 8, 2015 at 23:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .