2

My name is, Enrico Maria De Angelis. Using moderncv class and template, my name is typeset in two lines: "Enrico Maria De" in the first line, "Angelis" in the second line. How could I solve this problem?

I would at least have "Enrico Maria" written in the first line and "De Angelis" in the second one. This would be enough, I think, but I accept suggestions.

EDIT: Thanks to @Federico Poloni the problem is amost solved using \name{Enrico~Maria}{De~Angelis}.

For the sake of clarity, if you want to reproduce the problem you can use the file template.tex provided with the class, changing \name{John}{Doe} in \name{Enrico~Maria}{De~Angelis}

There's a way to add more space between the two lines?

5
  • 2
    I cannot reproduce it, at least with a first example file, but have you tried non-breaking spaces? \firstname{Enrico~Maria} \lastname{De~Angelis}. Nov 25, 2015 at 12:26
  • Sometimes changing your name is the easiest solution (for example, see telegraph.co.uk/travel/travelnews/ryanair/11653738/…).
    – jarauh
    Nov 25, 2015 at 15:18
  • 1
    By the way, your last question is a separate question. You should ask it as a separate question, otherwise people may not see it if they only read the title of your question.
    – jarauh
    Nov 25, 2015 at 15:19
  • @jarauh, the title is "moderncv - typeset 2 words first name and 2 words second name", that is it doesn't say whether the problem concerns the spacing or how the words are split in the two lines, don't you agree?
    – Enlico
    Nov 26, 2015 at 11:21
  • Well, you did address two problems: (1) Line breaks appear at the wrong place, and (2) line breaks are not typeset in a nice way. (1) is because the input was "wront" (missing ~), and (2) is a bug of moderncv. Sometimes when one asks a question (or two related questions), this is of course not clear. Also, I did not claim that it is forbidden to ask two questions at a time (although it is kind of discouraged), but I said that your second question might get more attention if it is a separate question (and not the last line of a longer question with an easy answer).
    – jarauh
    Nov 26, 2015 at 15:45

1 Answer 1

3

There is a little bug in class moderncv that causes the unwanted behaviour you got.

With the following MWE your problem is solved, but please have an eye on changes of class moderncv. With a later version it could happen, that this manual correction will not work longer.

It should be enouph to change the \namefont to use a proper distance of two lines (second numer). A good value could be fontsize+20%, like:

\renewcommand*{\namefont}{\fontsize{34}{41}\mdseries\upshape}

That does not work (you can try with bigger numbers like 81 instead of 41).

So we need to "hack" the class with:

%\usepackage{etoolbox} % already loaded by moderncv!
\makeatletter % <=======================================================
\patchcmd{\makecvhead}{%search
        \namestyle{\@firstname\ \@lastname}%
        }{%replace
        \namestyle{\@firstname\ \\[0.8ex]\@lastname}% <===================
        }{%success
  }{%failure
  }
\makeatother % <========================================================

There I added an \\[0.8ex] between first and lastname to force an linebreak with a vertical space of 0.8ex. You can play with this, you can also use 0.5cm or simular. Now the bigger space is granted and you do not have to write ~ in your first and last names ... commands \makeatletter and \makeatother are neccessary, because we had to use @.

MWE:

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

% moderncv themes
\moderncvstyle{classic}  
\moderncvcolor{blue}    
%\renewcommand*{\namefont}{\fontsize{34}{81}\mdseries\upshape}%{34}{41}

% character encoding
 \usepackage[utf8]{inputenc}    

% adjust the page margins
\usepackage[scale=0.75]{geometry}
%\setlength{\hintscolumnwidth}{3cm}     
%\setlength{\makecvtitlenamewidth}{10cm}  

% personal data
\name{Enrico Maria}{De Angelis}
\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}

%\usepackage{etoolbox} % already loaded by moderncv!
\makeatletter % <=======================================================
\patchcmd{\makecvhead}{%search
        \namestyle{\@firstname\ \@lastname}%
        }{%replace
        \namestyle{\@firstname\ \\[0.8ex]\@lastname}% <===================
        }{%success
  }{%failure
  }
\makeatother % <========================================================


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

and the result:

first page of cv

You must log in to answer this question.

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