1

I am trying to create my CV in latex based on some basic designs(moderncv) given in the following link: link How do I create a CV with banking style for title and classic style for the body ?

I copied the following from moderncvstylebanking.sty and put it before \begin{document}

\makeatletter

% symbols
\renewcommand*{\mobilesymbol}{\marvosymbol{72}~}
\renewcommand*{\phonesymbol}{\marvosymbol{84}~}
\renewcommand*{\faxsymbol}{\marvosymbol{117}~}
\renewcommand*{\emailsymbol}{\marvosymbol{66}~}
\renewcommand*{\homepagesymbol}{{\Large\marvosymbol{205}}~}

% commands
\newcommand*{\maketitlesymbol}{%
{~~~{\rmfamily\textbullet}~~~}}% the \rmfamily is required to force Latin Modern fonts when using sans serif, as OMS/lmss/m/n is not defined and gets substituted by OMS/cmsy/m/n
%   internal command to add an element to the footer
%   it collects the elements in a temporary box, and checks when to flush the box
\newsavebox{\maketitlebox}%
\newsavebox{\maketitletempbox}%
\newlength{\maketitlewidth}%
\newlength{\maketitleboxwidth}%
\newif\if@firstmaketitleelement\@firstmaketitleelementtrue%
%   adds an element to the maketitle, separated by maketitlesymbol
%   usage: \addtomaketitle[maketitlesymbol]{element}
\newcommand*{\addtomaketitle}[2][\maketitlesymbol]{%
  \if@firstmaketitleelement%
    \savebox{\maketitletempbox}{\usebox{\maketitlebox}#2}%
  \else%
    \savebox{\maketitletempbox}{\usebox{\maketitlebox}#1#2}\fi%
  \settowidth{\maketitleboxwidth}{\usebox{\maketitletempbox}}%
  \ifnum\maketitleboxwidth<\maketitlewidth%
    \savebox{\maketitlebox}{\usebox{\maketitletempbox}}%
    \@firstmaketitleelementfalse%
  \else%
    \flushmaketitle{}\\%
    \savebox{\maketitlebox}{#2}%
    \savebox{\maketitletempbox}{#2}%
    \settowidth{\maketitleboxwidth}{\usebox{\maketitlebox}}%
    \@firstmaketitleelementfalse\fi}
%   internal command to flush the maketitle
\newcommand*{\flushmaketitle}{%
  \strut\usebox{\maketitlebox}%
  \savebox{\maketitlebox}{}%
  \savebox{\maketitletempbox}{}%
  \setlength{\maketitleboxwidth}{0pt}}
\renewcommand*{\maketitle}{%
  \setlength{\maketitlewidth}{0.8\textwidth}%
  \hfil%
  \parbox{\maketitlewidth}{%
    \centering%
    % name and title
    \namestyle{\@firstname~\@familyname}%
    \ifthenelse{\isundefined{\@title}}{}{\titlestyle{~|~\@title}}\\%
    % detailed information
    \addressfont\color{color2}%
    \ifthenelse{\isundefined{\@addressstreet}}{}    {\addtomaketitle{\addresssymbol\@addressstreet}%
      \ifthenelse{\equal{\@addresscity}{}}{}{\addtomaketitle[~--~]    {\@addresscity}}\flushmaketitle\@firstmaketitleelementtrue\\}% if     \addresstreet is defined, \addresscity will always be defined but could be empty
    \ifthenelse{\isundefined{\@mobile}}{}    {\addtomaketitle{\mobilesymbol\@mobile}}%
    \ifthenelse{\isundefined{\@phone}}{}    {\addtomaketitle{\phonesymbol\@phone}}%
    \ifthenelse{\isundefined{\@fax}}{}{\addtomaketitle{\faxsymbol\@fax}}%
    \ifthenelse{\isundefined{\@email}}{}    {\addtomaketitle{\emailsymbol\emaillink{\@email}}}%
    \ifthenelse{\isundefined{\@homepage}}{}{%
\ifthenelse{\equal{\@homepagetitle}{}}% \homepagetitle could be empty
{\addtomaketitle{\homepagesymbol\httplink{\@homepage}}}%
{\addtomaketitle{\homepagesymbol\httplink[\@homepagetitle]    {\@homepage}}}}%
    \ifthenelse{\isundefined{\@extrainfo}}{}    {\addtomaketitle{\@extrainfo}}%
    \flushmaketitle}\\[2.5em]}% need to force a \par after this to avoid weird spacing bug at the first section if no blank line is left after \maketitle


%-------------------------------------------------------------------------------
%                resume style definition
%-------------------------------------------------------------------------------

% fonts
\renewcommand*{\namefont}{\Huge\bfseries\upshape}
\renewcommand*{\titlefont}{\Huge\mdseries\upshape}
\renewcommand*{\addressfont}{\normalsize\mdseries\upshape}
\renewcommand*{\quotefont}{\large\slshape}
\renewcommand*{\sectionfont}{\Large\bfseries\upshape}
\renewcommand*{\subsectionfont}{\large\upshape\fontseries{sb}\selectfont}
\renewcommand*{\hintfont}{\bfseries}

% styles
\renewcommand*{\namestyle}[1]{{\namefont\textcolor{color1}{#1}}}
\renewcommand*{\titlestyle}[1]{{\titlefont\textcolor{color2!85}{#1}}}
\renewcommand*{\addressstyle}[1]{{\addressfont\textcolor{color1}{#1}}}
\renewcommand*{\quotestyle}[1]{{\quotefont\textcolor{color1}{#1}}}
\renewcommand*{\sectionstyle}[1]{{\sectionfont\textcolor{color1}{#1}}}
\renewcommand*{\subsectionstyle}[1]{{\subsectionfont\textcolor{color1}{#1}}}
\renewcommand*{\hintstyle}[1]{{\hintfont\textcolor{color0}{#1}}}

% lengths
\newlength{\quotewidth}
\newlength{\hintscolumnwidth}
\setlength{\hintscolumnwidth}{0.3\textwidth}%
\newlength{\separatorcolumnwidth}
\setlength{\separatorcolumnwidth}{0.025\textwidth}%
\newlength{\maincolumnwidth}
\newlength{\doubleitemcolumnwidth}
\newlength{\listitemsymbolwidth}
\settowidth{\listitemsymbolwidth}{\listitemsymbol}
\newlength{\listitemmaincolumnwidth}
\newlength{\listdoubleitemmaincolumnwidth}

% commands
\renewcommand*{\recomputecvlengths}{%
  \setlength{\quotewidth}{0.65\textwidth}%
  % main lenghts
  \setlength{\maincolumnwidth}{\textwidth}%
  % listitem lengths
  \setlength{\listitemmaincolumnwidth}{\maincolumnwidth-                \listitemsymbolwidth}%
  % doubleitem lengths
  \setlength{\doubleitemcolumnwidth}{\maincolumnwidth-    \separatorcolumnwidth}%
  \setlength{\doubleitemcolumnwidth}{0.5\doubleitemcolumnwidth}%
  % listdoubleitem lengths
  \setlength{\listdoubleitemmaincolumnwidth}{\maincolumnwidth-    \listitemsymbolwidth-\separatorcolumnwidth-\listitemsymbolwidth}%
  \setlength{\listdoubleitemmaincolumnwidth}    {0.5\listdoubleitemmaincolumnwidth}%
  % fancyhdr lengths
  \renewcommand{\headwidth}{\textwidth}%
  % regular lengths
  \setlength{\parskip}{0\p@}}

\renewcommand*{\makecvtitle}{%
  % recompute lengths (in case we are switching from letter to resume, or vice versa)
  \recomputecvlengths%
  \maketitle%
  % 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 \maketitle}

\makeatother

which gives the following error:

! LaTeX Error: Command \quotewidth already defined.
           Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.96 \newlength{\quotewidth}

? 

! LaTeX Error: Command \hintscolumnwidth already defined.
           Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.97 \newlength{\hintscolumnwidth}

? 

! LaTeX Error: Command \separatorcolumnwidth already defined.
           Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.99 \newlength{\separatorcolumnwidth}

? 

! LaTeX Error: Command \maincolumnwidth already defined.
           Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
     ...                                              

l.101 \newlength{\maincolumnwidth}

? 

! LaTeX Error: Command \listitemsymbolwidth already defined.
           Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.103 \newlength{\listitemsymbolwidth}

? 

! LaTeX Error: Command \listitemmaincolumnwidth already defined.
           Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.105 \newlength{\listitemmaincolumnwidth}

? 

! LaTeX Error: Command \listdoubleitemmaincolumnwidth already defined.
           Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.106 \newlength{\listdoubleitemmaincolumnwidth}

? 
1

Class moderncv defines the several styles in separate sty files. You have two possibilitys:

  1. Create a new style and include it into moderncv. That is not easy, because you would have to change a lot of files building class moderncv. Easier is method two.
  2. Change one of the existing styles (one you usually do not use) and add the hacked sty file in the same directory where your cv file, let's say mwe-moderncv.texis. But please see: that is a dirty hack then!

A third possibility would be to have a inbuild-style, like mystyle.sty, so one can change the style as he/she wants. I think I will suggest the author of moderncv to do that.

I decided to use method 2, therefore I changed oldstyle of moderncv. :

With the both lines

\moderncvhead{3} 
\moderncvbody{1}

we define that we want (1. line) the banking style title and (2. line) classic body in the hacked style. So we get the complete hacked version to

Hacked version of moderncvstyleoldstyle.sty (same directory that contains your cv):

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{moderncvstyleoldstyle}[2015/07/28 v2.0.0 modern curriculum vitae and letter style scheme: oldstyle hacked by John]

\DeclareOption*{}% 
%\ExecuteOptions{mixedrules,left}
\ProcessOptions*\relax% 


%-------------------------------------------------------------------------------
%                fonts & icons
%-------------------------------------------------------------------------------
% TeX Gyre Pagella font
  \IfFileExists{tgpagella.sty}%
    {%
      \RequirePackage{tgpagella}%
      \renewcommand*{\familydefault}{\rmdefault}}%
    {}

% symbols
\moderncvicons{marvosym} % marvosym awesome


%-------------------------------------------------------------------------------
%                header, body & footer
%-------------------------------------------------------------------------------
\moderncvhead{3} % <====================================================
\moderncvbody{1} % <====================================================

\endinput

Now we can use the hacked sty file in our mwe-moderncv.tex to create the wished CV:

\listfiles % to check easy the used versions
\documentclass[11pt,a4paper,sans]{moderncv}

\moderncvstyle{oldstyle} % <============== hacked version!!!!!!!!!!!!!!!
\moderncvcolor{blue} 

 \usepackage[utf8]{inputenc}
\usepackage[scale=0.75]{geometry}
%\setlength{\hintscolumnwidth}{3cm}

% 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{john@doe.org}
\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}


\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}


\end{document}

Please check in the resulting logfile that you see at the end of the log file a list of used packages and versions, containing

moderncvstyleoldstyle.sty    2015/07/28 v2.0.0 modern curriculum vitae and letter style scheme: oldstyle hacked by John

Then the hacked version (you see hacked by John?) was used and you should see the following result:

resulting cv

-1

It turns out that

\moderncvstyle{classic} 
\moderncvheader{3}

which tries to implement banking header + classic body doesn't work. But

\moderncvstyle{banking}
\moderncvbody{1} % classic body

works perfectly and gives what you're looking for. Here's a MWE:

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

\moderncvstyle{banking}
\moderncvbody{1} % classic body

\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}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}

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

\end{document}

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.