2

I have a problem with moderncv banking. I'd like to put my name and the title on different lines. There are some solutions on the subjects, but they did not work fine for me unfortunately. Here is a solution I have found here (I tried it but didn't work so far):

Name and Title on separate lines in Modern CV

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{banking}
\moderncvcolor{blue}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.85, top=1.5cm, bottom=1cm]{geometry}
\usepackage{enumitem}

\name{John}{Smith}
\title{Engineering Degree} 
\phone[mobile]{00.00.00.00}
\email{john.smith@blabla.com}
\social[linkedin]{john-smith}

\usepackage{xpatch}
\makeatletter
\xpatchcmd{\maketitle}{\titlestyle{~|~\@title}}{\par\vskip1ex\titlestyle{\@title}}{}{}
\makeatother
Naoufal
  • 21
  • 1
    In the \xpatchcmd, replace \maketitle by \makehead, such that the line starts with \xpatchcmd{\makehead}{\titlestyle... The problem with patches is that they stop working as soon as the internals of the patched code change. Apparently code that was in the macro \maketitle has been moved to \makehead in a later version. – gernot Aug 19 '16 at 08:47
  • Thank you very much, it worked perfectly. So if I undertood correctly what you said about the internals of the patched code, if it changes again, it is possible that this solution wouldn't work. But thanks again. Best solution – Naoufal Aug 19 '16 at 13:18
  • 1
    Please see my answer to question http://tex.stackexchange.com/questions/317219/banking-style-of-moderncv-doesnt-reconize-makecvheadnamewidth-for-fiting-long?rq=1 – Mensch Aug 19 '16 at 22:35
  • @gernot Please, add an answer. – egreg Dec 17 '16 at 16:54
  • @egreg Done, answer added. – gernot Dec 18 '16 at 13:12

2 Answers2

2

The solution proposed in Name and Title on separate lines in Modern CV still works, but with a small modification: Replace \maketitle by \makehead in the patch command such that the extra code in the preamble reads

\usepackage{xpatch}
\makeatletter
\xpatchcmd\makehead
   {\titlestyle{~|~\@title}}%
   {\par\vskip1ex\titlestyle{\@title}}%
   {}{}
\makeatother

The problem with patches is that they stop working as soon as the internals of the patched code change. Apparently code that before was in the macro \maketitle has been moved to \makehead in later versions.

Here is a complete example.

enter image description here

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{banking}
\moderncvcolor{blue}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.85, top=1.5cm, bottom=1cm]{geometry}
\usepackage{enumitem}

\name{John}{Smith}
\title{Engineering Degree} 
\phone[mobile]{00.00.00.00}
\email{john.smith@blabla.com}
\social[linkedin]{john-smith}

\usepackage{xpatch}
\makeatletter
\xpatchcmd\makehead
   {\titlestyle{~|~\@title}}%
   {\par\vskip1ex\titlestyle{\@title}}%
   {}{}
\makeatother

\begin{document}
\maketitle
\end{document}
gernot
  • 49,614
0

@Naoufal , Try this:

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

\name{\hspace{2.48cm}John}{Smith}
\title{\Large{}\newline{}\vspace{-0.24cm}\newline{}Engineering Degree}
% You can play with \hspace*{1.89cm}     and \vspace     and \newline
\phone[mobile]{00.00.00.00}
\email{john.smith@blabla.com}
\social[linkedin]{john-smith}

\begin{document}
\newgeometry{top=1.25cm, bottom=1.02cm,right=1.61cm, left=1.61cm}% inner=1cm, outer=0.618\textwidth
\vspace*{-1.02cm}
\maketitle
\vspace*{-0.88cm}
\end{document}

You should sesarch the way to erase the vertical line after the name and surname.

You obtain this:

enter image description here

Mika Ike
  • 3,751
  • Shouldn't we strive for minimally invasive operations instead of big hammers, like in medicine? – gernot Aug 19 '16 at 08:54
  • @gernot ok I just wrote in the way I think my post could help more. In the line of the original question. – Mika Ike Aug 19 '16 at 08:56
  • My feeling is that searching the way to erase the vertical line is beyond the abilities we can expect from a standard user of LaTeX. – gernot Aug 19 '16 at 09:01
  • 1
    @gernot I´m not a profesional of LaTeX, I´m a user that tried to help another one. Only that. I think that all of us should know more :-) but ... the best way is know the opinion of the original question writer. I think that you try to explain how to erase that vertical line ;-) – Mika Ike Aug 19 '16 at 09:04
  • Thank you guys, but gernot's solution worked just fine. Simple and efficient – Naoufal Aug 19 '16 at 13:20