4

Hi the answer given here works nice for the classic style of moderncv but once i switch to banking style, Latex doesnt reconize it Undefined control sequence.\makecvheadnamewidth (neither the old syntax \makecvtitlenamewidth works).

PS: I dont want a complicated alternative to \makecvheadnamewidth just to make the the long name fit. I d'like to make it work for banking style too.

\documentclass[10pt,a4paper,roman]{moderncv}
\moderncvstyle{banking}
\moderncvcolor{blue} 
\usepackage[utf8]{inputenc}
\usepackage[scale=0.85]{geometry}

\nopagenumbers{}
%\setlength{\makecvheadnamewidth}{15cm}
%\renewcommand*{\namefont}{\fontsize{30}{29}\mdseries\upshape}

\title{here comes the title here comes the title}
\firstname{My Name Is very}
\familyname{VeryLong}
\address{address comes here}{14000}
\phone[mobile]{00~00~00~00~00}  
\email{mymail@gmail.com}
\extrainfo{0 ans Permis B}

\begin{document}
\maketitle
\end{document}

BTW: I'm using MiKTeX with the latest version of moderncv.

1
  • One solution could be to enforce a newline by \firstname{My Name \newline{} Is very long}
    – Cfun
    Jun 29 '16 at 19:03

1 Answer 1

3

Well, starting with the current version of moderncv you can have a look into the log file after compiling. There you can find, that style banking uses ...headiii to create the head for this style. Style classic or casual simply use another file ...head?. That is the reason that your first used command is not recognized, because it is simply not used in head 3.

With package xpatch you can change the relevant part of this file:

\usepackage{xpatch}    % to patch the command ...
\xpatchcmd{\makehead}{%
  \setlength{\makeheaddetailswidth}{0.8\textwidth}%
}{%
  \setlength{\makeheaddetailswidth}{0.95\textwidth}%
}{}{}

As shown you can play with the number before \textwidth. The standard number is 0.8. That means use 80% of the textwidth.

Added this code into your MWE gives:

\documentclass[10pt,a4paper,roman]{moderncv}

\moderncvstyle{banking} % head3   body3 
\moderncvcolor{blue}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.85]{geometry}

\nopagenumbers{}
%\setlength{\makecvheadnamewidth}{15cm}
%\renewcommand*{\namefont}{\fontsize{30}{29}\mdseries\upshape}

\title{here comes the title here comes the title}
\firstname{My Name Is very}
\familyname{VeryLong}
\address{address comes here}{14000}
\phone[mobile]{00~00~00~00~00}
\email{mymail@gmail.com}
\extrainfo{0 ans Permis B}

\usepackage{showframe} % to visualize the typing area ...
\usepackage{xpatch}    % to patch the command ...
\xpatchcmd{\makehead}{%
  \setlength{\makeheaddetailswidth}{0.8\textwidth}%
}{%
  \setlength{\makeheaddetailswidth}{0.95\textwidth}%
}{}{}


\begin{document}
\maketitle
\end{document}

with the result:

The used packages and version numbers to get this are (add \listfiles as first line into your code to get the list at the end of your log file):

 *File List*
moderncv.cls    2015/07/28 v2.0.0 modern curriculum vitae and letter document class
  size10.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
etoolbox.sty    2015/08/02 v2.2a e-TeX tools for LaTeX (JAW)
  ifthen.sty    2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
  xcolor.sty    2016/05/11 v2.12 LaTeX color extensions (UK)
   color.cfg    2016/01/02 v1.6 sample color configuration
  pdftex.def    2016/06/17 v0.06h Graphics/color for pdfTeX
infwarerr.sty    2016/05/16 v1.4 Providing info/warning/error messages (HO)
 ltxcmds.sty    2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
colortbl.sty    2012/02/13 v1.0a Color table columns (DPC)
   array.sty    2014/10/28 v2.4c Tabular extension package (FMi)
 ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
ifluatex.sty    2016/05/16 v1.4 Provides the ifluatex switch (HO)
 fontenc.sty
   t1enc.def    2005/09/27 v1.99g Standard LaTeX file
 lmodern.sty    2009/10/30 v1.6 Latin Modern Fonts
     url.sty    2013/09/16  ver 3.4  Verb mode for urls, etc.
graphicx.sty    2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
graphics.sty    2016/06/02 v1.0s Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg    2016/06/04 v1.11 sample graphics configuration
fancyhdr.sty    
tweaklist.sty    
    calc.sty    2014/10/28 v4.3 Infix arithmetic (KKT,FJ)
  xparse.sty    2016/05/18 v6512 L3 Experimental document command parser
   expl3.sty    2016/05/18 v6512 L3 programming layer (loader) 
expl3-code.tex    2016/05/18 v6512 L3 programming layer 
l3pdfmode.def    2016/03/26 v6465 L3 Experimental driver: PDF mode
microtype.sty    2016/05/14 v2.6a Micro-typographical refinements (RS)
microtype-pdftex.def    2016/05/14 v2.6a Definitions specific to pdftex (RS)
microtype.cfg    2016/05/14 v2.6a microtype main configuration file (RS)
moderncvcollection.sty    2015/07/28 v2.0.0 moderncv collections
moderncvcompatibility.sty    2015/07/28 v2.0.0 modern curriculum vitae and letter compatibility patches
moderncvstylebanking.sty    2015/07/28 v2.0.0 modern curriculum vitae and letter style scheme: banking
tgpagella.sty    2009/09/27 v1.2 TeX Gyre Pagella as default roman family
kvoptions.sty    2016/05/16 v3.12 Key value format for package options (HO)
kvsetkeys.sty    2016/05/16 v1.17 Key value parser (HO)
etexcmds.sty    2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
moderncviconsawesome.sty    2015/07/28 v2.0.0 modern curriculum vitae and letter icons: awesome
fontawesome.sty    2016/05/15 v4.6.3.1 font awesome icons
fontawesomesymbols-generic.tex
fontawesomesymbols-pdftex.tex
moderncvheadiii.sty    2015/07/28 v2.0.0 modern curriculum vitae and letter header variant: 3
moderncvbodyiii.sty    2015/07/28 v2.0.0 modern curriculum vitae and letter body variant: 3
   t1qpl.fd    2009/09/25 v1.2 font definition file for T1/qpl
ufontawesometwo.fd    2016/05/22 Font definitions for U/fontawesometwo.
moderncvcolorblue.sty    2015/07/28 v2.0.0 modern curriculum vitae and letter color scheme: blue
inputenc.sty    2015/03/17 v1.2c Input encoding file
    utf8.def    2016/02/28 v1.1s UTF-8 support for inputenc
   t1enc.dfu    2016/02/28 v1.1s UTF-8 support for inputenc
  ot1enc.dfu    2016/02/28 v1.1s UTF-8 support for inputenc
  omsenc.dfu    2016/02/28 v1.1s UTF-8 support for inputenc
geometry.sty    2010/09/12 v5.6 Page Geometry
   ifpdf.sty    2016/05/14 v3.1 Provides the ifpdf switch
  ifvtex.sty    2016/05/16 v1.6 Detect VTeX and its facilities (HO)
geometry.cfg
showframe.sty    2011/02/24 v0.1i showframe (new impl., RN)
 eso-pic.sty    2015/07/21 v2.0g eso-pic (RN)
atbegshi.sty    2016/06/09 v1.18 At begin shipout hook (HO)
  xpatch.sty    2012/10/02 v0.3 Extending etoolbox patching commands
hyperref.sty    2016/05/21 v6.83p Hypertext links for LaTeX
hobsub-hyperref.sty    2016/05/16 v1.14 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty    2016/05/16 v1.14 Bundle oberdiek, subset generic (HO)
  hobsub.sty    2016/05/16 v1.14 Construct package bundles (HO)
 intcalc.sty    2016/05/16 v1.2 Expandable calculations with integers (HO)
kvdefinekeys.sty    2016/05/16 v1.4 Define keys (HO)
pdftexcmds.sty    2016/05/21 v0.22 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty    2016/05/16 v1.14 Implements pdfTeX's escape features (HO)
bigintcalc.sty    2016/05/16 v1.4 Expandable calculations on big integers (HO)
  bitset.sty    2016/05/16 v1.2 Handle bit-vector datatype (HO)
uniquecounter.sty    2016/05/16 v1.3 Provide unlimited unique counter (HO)
letltxmacro.sty    2016/05/16 v1.5 Let assignment for LaTeX macros (HO)
 hopatch.sty    2016/05/16 v1.3 Wrapper for package hooks (HO)
xcolor-patch.sty    2016/05/16 xcolor patch
atveryend.sty    2016/05/16 v1.9 Hooks at the very end of document (HO)
refcount.sty    2016/05/16 v3.5 Data extraction from label references (HO)
 hycolor.sty    2016/05/16 v1.8 Color options for hyperref/bookmark (HO)
 auxhook.sty    2016/05/16 v1.4 Hooks for auxiliary files (HO)
  pd1enc.def    2016/05/21 v6.83p Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg    2002/06/06 v1.2 hyperref configuration of TeXLive
   puenc.def    2016/05/21 v6.83p Hyperref: PDF Unicode definition (HO)
 hpdftex.def    2016/05/21 v6.83p Hyperref driver for pdfTeX
rerunfilecheck.sty    2016/05/16 v1.8 Rerun checks for auxiliary files (HO)
supp-pdf.mkii
epstopdf-base.sty    2016/05/15 v2.6 Base part for package epstopdf
  grfext.sty    2016/05/16 v1.2 Manage graphics extensions (HO)
  mt-ppl.cfg    2005/11/16 v1.6 microtype config. file: Palatino (RS)
 nameref.sty    2016/05/21 v2.44 Cross-referencing by name of section
gettitlestring.sty    2016/05/16 v1.5 Cleanup title references (HO)

Update:

Having the name and the title side by side it needs a heavy rework of the building of the header, because that is only possible with using a tabular environment or simular ...

Because you want an easy way why not place the name in the first line, the title in the second line without delimiter. That can be done easily with the following patch (\makeatletter and \makeatother are needed now because the use of @ in that part of code):

\makeatletter
\xpatchcmd{\makehead}{%
\titlestyle{~|~\@title}%
}{%
\\\vspace*{10pt}\titlestyle{\@title}\vspace*{10pt}%
}{}{false}
\makeatother

With the complete MWE

\listfiles
\documentclass[10pt,a4paper,roman]{moderncv}

\moderncvstyle{banking} % head3   body3 
\moderncvcolor{blue}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.85]{geometry}

\nopagenumbers{}
%\setlength{\makecvheadnamewidth}{15cm}
%\renewcommand*{\namefont}{\fontsize{30}{29}\mdseries\upshape}

\title{here comes the title here comes the title}
\firstname{My Name Is very}
\familyname{VeryLong}
\address{address comes here}{14000}
\phone[mobile]{00~00~00~00~00}
\email{mymail@gmail.com}
\extrainfo{0 ans Permis B}

\usepackage{showframe} % to visualize the typing area ...
\usepackage{xpatch}    % to patch the command ...
\xpatchcmd{\makehead}{%
  \setlength{\makeheaddetailswidth}{0.8\textwidth}%
}{%
  \setlength{\makeheaddetailswidth}{0.95\textwidth}%
}{}{}

\makeatletter
\xpatchcmd{\makehead}{%
\titlestyle{~|~\@title}%
}{%
\\\titlestyle{\@title}%
}{}{}
\makeatother


\begin{document}
\maketitle
\end{document}

you get the resulting pdf:

Does that help?

1
  • interesting info about \listfiles but dont you think the output is unaesthetic ? my aim is not to put my name in a single line (sorry if i was confusing with the other question), i dont mind if it's on two lines as long as it's well aligned side by side to the title column like this i dont know if it's easy though.
    – Cfun
    Jun 29 '16 at 21:47

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 moderncv or ask your own question.