2

How could I increase the spacing between \firstname and \familyname?

I tried redefining the \makecvtitle command, unfortunately I did not succeed.

I would like to make the vertical space bigger as the basic setting makes the first name and family name too close together:

enter image description here

I am using the classic moderncvstyle.

MWE:

\documentclass[11pt,a4paper,roman]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{blue}

\pagestyle{fancy}
\rfoot{\thepage}

\usepackage[utf8]{inputenc}

\usepackage[scale=0.75]{geometry}



\firstname{firstname\hspace{1cm}}
\familyname{familyname}
\title{Curriculum Vitae}
\address{Address}
\mobile{+123~000~000~000}
\email{email}

\usepackage{subfiles}

\begin{document}
\makecvtitle
\end{document}

Thank you

4
  • in your example the names are side by side not one above the other. May 29 at 18:55
  • I wanted to increase the spacing between firstname and lastname in case they endup on separate lines either because one of them is long or by directly adding some horizontal space, in the end I solved by using name instead of firstname and lastname.
    – Raymond_90
    May 29 at 19:22
  • 1
    make an example that demonstrates the issue, not some arbitrary MWE. May 29 at 19:25
  • please see my added answer ...
    – Mensch
    Jun 7 at 22:27
1

Alternatively, you could use \strut as in

\firstname{\strut firstname\hspace{30mm}} % \hspace{30mm} to force a line break.
\familyname{\strut familyname}

For example, LaTeX and plainTeX provide the command \strut to insert a font size specific strut. In LaTeX it has a height of 70% of the baseline skip (the distance between the baselines of two consecutive lines of text) and a depth of 30% of the baseline skip. It ensures that two vertical stacked boxes which include such a strut have the same distance like two normal consecutive lines. (Reference)

1

Well, you can patch the current version 2.1.0 of moderncv to add a new line between first and last name with for example \\[0.3em] like this:

\makeatletter
\patchcmd{\makecvhead}{% <==============================================
  \namestyle{\@firstname\ \@lastname}%
  }{%
  \namestyle{\@firstname\\[0.3em] \@lastname}% <============ change 0.3em to anything you like
  }{%success
  }{%failure
  }
\makeatother

Then you have no problems with the automatic generated metadatas by class moderncv using your given firstname and lastname without disturbing formating commands ...

With the following complete MWE

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

\moderncvstyle{classic} % head 1 body 1
\moderncvcolor{blue}

\pagestyle{fancy}
\rfoot{\thepage}

\usepackage[utf8]{inputenc}
\usepackage[scale=0.75]{geometry}

\makeatletter
\patchcmd{\makecvhead}{% <==============================================
  \namestyle{\@firstname\ \@lastname}%
  }{%
  \namestyle{\@firstname\\[0.3em] \@lastname}% <============ change 0.3em to anything you like
  }{%success
  }{%failure
  }
\makeatother

\firstname{firstname}
\familyname{familyname}
\title{Curriculum Vitae}
\address{Address}
\mobile{+123~000~000~000}
\email{email}


\begin{document}
\makecvtitle
\end{document}

you get the following pdf:

resulting pdf

0

In the end I solved by using \name instead of \firstname and \lastname and breaking in the second argument like this:

\name{Firstname}{\\[0.5ex]Lastname}

Which produces the desired output:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.