[Tex/LaTex] moderncv’s casual CV template with oldstyle cover letter

lettersmoderncv

I want to use moderncv's casual CV template with oldstyle cover letter. How can I do this?

Best Answer

One option is to have two documents; the first one, using the casual style, for the CV and the other one, with the oldstyle style for the cover letter. Then, if required, you can merge both into one PDF using, for example, the pdfpages package.

Another option, if you want only one document, is to copy to your document the settings used in moderncvstyleoldstyle.sty for the cover letter (the section between \makeatletter and \makeatother in my example code below); you also need to load the changepage package:

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{casual}
\moderncvcolor{grey}
\usepackage{changepage}
\usepackage[scale=0.75]{geometry}

\makeatletter
% commands for oldstyle letter
\newlength{\textwidthdelta}%
\renewcommand*{\recomputeletterlengths}{%
  \recomputecvlengths%
  \setlength{\parskip}{6\p@}%
  \leftskip=0pt%
%  \setlength{\textwidthdelta}{+\marginparwidth+\marginparsep}%
  \setlength{\marginparwidth}{\hintscolumnwidth}%
  \setlength{\marginparsep}{2\separatorcolumnwidth}%
%  \addtolength{\textwidthdelta}{-\marginparwidth-\marginparsep}%
%  \changepage{}{\textwidthdelta}{-\textwidthdelta}{}{}{}{}{}{}%\changepage{<textheight>}{<textwidth>}{<evensidemargin>}{<oddsidemargin>}{<columnsep>}{<topmargin>}{<headheight>}{<headsep>}{<footskip>}
  \changepage{}{-\marginparwidth-\marginparsep}{}{}{}{}{}{}{}%\changepage{<textheight>}{<textwidth>}{<evensidemargin>}{<oddsidemargin>}{<columnsep>}{<topmargin>}{<headheight>}{<headsep>}{<footskip>}
  }

\renewcommand*{\makelettertitle}{%
  % recompute lengths (in case we are switching from letter to resume, or vice versa)
  \recomputeletterlengths%
  % recipient block
  {\addressfont%
    {\bfseries\upshape\@recipientname}\\%
    \@recipientaddress}\\[1em]%
  % date
  \@date\\[2em]%
  % opening
  \@opening\\[1.5em]%
  % sender contact info
  \hspace{0pt}%
  \marginpar{%
    \addressfont\textcolor{color2}{%
      {\bfseries\@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}}%
      \collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
        \makenewline\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}%
      \ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}}}%
  % ensure no extra spacing after \makelettertitle due to a possible blank line
%  \ignorespacesafterend% not working
  \par\vspace{-\baselineskip}\vspace{-\parskip}}

\renewcommand*{\makeletterclosing}{
  \@closing\\[3em]%
  {\bfseries\@firstname~\@lastname}%
  \ifthenelse{\isundefined{\@enclosure}}{}{%
    \\%
    \vfill%
    {\color{color2}\itshape\enclname: \@enclosure}}}
\makeatother

\name{John}{Doe}
\title{The 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{john@doe.org}
\homepage{www.johndoe.com}
\social[linkedin]{john.doe}
\social[twitter]{jdoe}
\social[github]{jdoe}
\extrainfo{additional information}
\photo[64pt][0.4pt]{picture}
\quote{Some quote}

\begin{document}
\makecvtitle

\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}  % arguments 3 to 6 can be left empty
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}

\section{Master thesis}
\cvitem{title}{\emph{Title}}
\cvitem{supervisors}{Supervisors}
\cvitem{description}{Short thesis abstract}

\section{Experience}
\subsection{Vocational}
\cventry{year--year}{Job title}{Employer}{City}{}{Description line 1\newline{}Description line 2}
\subsection{Miscellaneous}
\cventry{year--year}{Job title}{Employer}{City}{}{Description}

\section{Languages}
\cvitemwithcomment{Language 1}{Skill level}{Comment}
\cvitemwithcomment{Language 2}{Skill level}{Comment}
\cvitemwithcomment{Language 3}{Skill level}{Comment}

%-----       letter       ---------------------------------------------------------
\clearpage
\fancyhf{}
\recipient{Company Recruitment team}{Company, Inc.\\123 somestreet\\some city}
\date{January 01, 1984}
\opening{Dear Sir or Madam,}
\closing{Yours faithfully,}
\enclosure[Attached]{curriculum vit\ae{}}          % use an optional argument to use a string other than "Enclosure", or redefine \enclname
\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}

enter image description here