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{[email protected]}
\social[linkedin]{john-smith}

\usepackage{xpatch}
\makeatletter
\xpatchcmd{\maketitle}{\titlestyle{~|~\@title}}{\par\vskip1ex\titlestyle{\@title}}{}{}
\makeatother
5
  • 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
    Commented Aug 19, 2016 at 8: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
    Commented Aug 19, 2016 at 13:18
  • 1
    Please see my answer to question tex.stackexchange.com/questions/317219/…
    – Mensch
    Commented Aug 19, 2016 at 22:35
  • @gernot Please, add an answer.
    – egreg
    Commented Dec 17, 2016 at 16:54
  • @egreg Done, answer added.
    – gernot
    Commented Dec 18, 2016 at 13:12

2 Answers 2

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{[email protected]}
\social[linkedin]{john-smith}

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

\begin{document}
\maketitle
\end{document}
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{[email protected]}
\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

5
  • Shouldn't we strive for minimally invasive operations instead of big hammers, like in medicine?
    – gernot
    Commented Aug 19, 2016 at 8: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
    Commented Aug 19, 2016 at 8: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
    Commented Aug 19, 2016 at 9: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
    Commented Aug 19, 2016 at 9:04
  • Thank you guys, but gernot's solution worked just fine. Simple and efficient
    – Naoufal
    Commented Aug 19, 2016 at 13:20

You must log in to answer this question.

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