[Tex/LaTex] Name in a single line in moderncv

moderncv

I would like that my full name in the CV appears in a single line, I am using
\firstname{manuel}
\familyname{fernandez-perez}

also my email is too long and it automatically splits it in two lines and I would still want one, I am using \email{} thanks

Best Answer

To solve the first problem you can change \makecvtitlenamewidth (in moderncv 2.0 \makecvheadnamewidth) (default=10cm) and/or reduce the font size used for the name (the example below uses both changes); for the second issue, to avoid a possible overlap between the name and the personal information, instead of using \email, I used the \extrainfo field, but with the necessary provision to make it functional as the original \email field:

\documentclass{moderncv}
\moderncvstyle{classic} 
\moderncvcolor{green}

\setlength{\makecvtitlenamewidth}{12cm}
\renewcommand*{\namefont}{\fontsize{24}{29}\mdseries\upshape}

\firstname{Manuel} 
\familyname{Fern\'andez-P\'erez}
\title{CV}
\address{street and number}{postcode city}
\mobile{+1~(234)~567~890}
\phone{+2~(345)~678~901}
\fax{+3~(456)~789~012}
\homepage{www.johndoe.com}
\extrainfo{\emailsymbol\emaillink{manuel@fernandez-perez-galdos.com}}

\begin{document}

\makecvtitle
\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}  \cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}

\end{document}

enter image description here

In a comment, a new request was made to shift the name upwards; the file moderncvstyleclassic.sty, responsible for the classic style settings, uses (in the definition of \makecvtitle) a tabular and a minipage with bottom alignment ([b] in the optional argument) to typeset the name and the personal information, respectively; one option then is to use the etoolbox command to patch \makecvtitle and change [b] to [t] (now that the name has been shifted, using \email is again possible without overlapping):

\documentclass{moderncv}
\usepackage{etoolbox}

\moderncvstyle{classic} 
\moderncvcolor{green}

\patchcmd{\makecvtitle}{[b]}{[t]}{}{}
\patchcmd{\makecvtitle}{[b]}{[t]}{}{}

\setlength{\makecvtitlenamewidth}{12cm}
\renewcommand*{\namefont}{\fontsize{24}{29}\mdseries\upshape}

\firstname{Manuel} 
\familyname{Fern\'andez-P\'erez}
\title{CV}
\address{street and number}{postcode city}
\mobile{+1~(234)~567~890}
\phone{+2~(345)~678~901}
\fax{+3~(456)~789~012}
\email{manuel@fernandez-perez-galdos.com}
\homepage{www.johndoe.com}

\begin{document}

\makecvtitle
\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}  \cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}

\end{document}

enter image description here

The name can then be lowered at will, by using the above modifications and something like

 \firstname{\texorpdfstring{\\[1ex]Manuel}{Manuel}}