4

I have the following problem. I need to change the position of name and title in my cv, because I'm using the title field for my academic title and that needs to stand in front of the name. So I would like to change the lines in my header, title first and name in the second line. Unfortunately I haven't been able to do this myself. Does anybody know a solution?

Thx!!

MWE:

\documentclass[12pt,a4paper]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{black}
\nopagenumbers{}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[top=2.5cm, bottom=2cm, left=2.5cm, right=2.5cm]{geometry}

\title{Dr.med.univ.}
\firstname{john}
\familyname{doe}
\address{xxroad 123}{5555 city}
\phone[mobile]{+43~1234~123123123}
\email{[email protected]}

\begin{document}
    \makecvtitle

    \section{Berufserfahrung}

\end{document}
0

1 Answer 1

4

You could use etoolbox \patchcmd like this:

\patchcmd{\makecvhead}
{%
\namestyle{\@firstname\ \@lastname}%
\ifthenelse{\equal{\@title}{}}{}{\\[1.25em]\titlestyle{\@title}}%
}
{%
\titlestyle{\@title}\\[1.25em]
\namestyle{\@firstname\ \@lastname} 
}
{}{}

Will basically switch \titlestyle and \namestyle

complete MWE:

\documentclass[12pt,a4paper]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{black}
\nopagenumbers{}


\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[top=2.5cm, bottom=2cm, left=2.5cm, right=2.5cm]{geometry}


\title{Dr. med. univ.}
\firstname{john}
\familyname{doe}
\address{xxroad 123}{5555 city}
\phone[mobile]{+43~1234~123123123}
\email{[email protected]}

\makeatletter
\patchcmd{\makecvhead}{%
\namestyle{\@firstname\ \@lastname}%
\ifthenelse{\equal{\@title}{}}{}{\\[1.25em]\titlestyle{\@title}}%
}
{
\titlestyle{\@title}\\[1.25em]
\namestyle{\@firstname\ \@lastname} 
}
{}{}
\makeatother

\begin{document}
    \makecvtitle

    \section{Berufserfahrung}

\end{document}

enter image description here

as for an hackish alternative, you could simply empty the \title macro and insert your title into the \firstname macro, like this

\title{}
\firstname{{\huge\textit{Dr. med. univ.}}\\[12pt] john}

and the set the styling of the "fake" title at will.

6
  • Thank you! One funny thing though: if I'm running it with TeXShop it works fine, with TeXstudio (my primary tool) it won't work (no errors, just won't set the title above name)!?
    – traily
    Commented Aug 21, 2016 at 13:58
  • I'm using TeXstudio too and it works here, have you tried removing the .aux file before compiling? Sometime TeXstudio gives me strange errors depending on what is inside the aux file.
    – d-cmst
    Commented Aug 21, 2016 at 13:59
  • Found out that it depends on which compiler I'm using. If I'm running latxmk it works, with PDFLaTeX it won't.
    – traily
    Commented Aug 21, 2016 at 14:34
  • Maybe you have set some option for pdflatex in TeXstudio that creates the problem. I'm able to compile fine with pdflatex.
    – d-cmst
    Commented Aug 21, 2016 at 14:40
  • Was able to sort it out. Had some old versions of tex on my mac, deleted them and now everything works. Thank you very much for your help!
    – traily
    Commented Aug 21, 2016 at 20:27

You must log in to answer this question.

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