[Tex/LaTex] ModernCV classic – family name on separate line

moderncvvertical alignment

I'm trying to create a resume using the moderncv classic template, but the lay-out of my name is a bit off. Since my last name is fairly long and the personal information box on the right includes a photo as well, my family name gets hyphenated. When I use the option \usepackage[scale=0.75]{geometry} to decrease the margins, my family name gets pushed to the second line in its entirety, but the first name and family name are not properly aligned. The problem also persists when using different fonts or XeLaTeX instead of LuaLatex.

What is the correct way to move my family name to the second line manually and align it properly? I prefer this approach to reducing the font size of the name so that it can fit on a single line (as was answered here, although the accepted answer seems to cause a bunch of warning messages in texstudio). This was another similar problem, but I did not manage to translate the solution to the \familyname option of moderncv.

Here is my minimal working example and the output:

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

\moderncvstyle{classic}
%\usepackage[scale=0.75]{geometry}

\firstname{Klmopq}\familyname{VeryLongName}
\extrainfo{Personal Information}
\photo[64pt][0.4pt]{lion}

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

enter image description here

Best Answer

At last there is a little bug in the class moderncv.

One possibility is to write

\name{Klmopq}{\\[1ex]\mbox{VeryLongName}}

With \\[1ex] you get a new line with 1ex distance between the two lines. Change 1ex to values you want. Command \mbox does not allow a hyphenation of the VeryLongname.

With command \setlength{\makecvheadnamewidth}{12cm} you can define the length available for the name(s).

With the following MWE (see important changes marked with <=====):

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

\moderncvstyle{classic}
\usepackage[%
  scale=0.75
 ,showframe % <===== to show the used margins and typing area
]{geometry}

%\firstname{Klmopq}\familyname{VeryLongName}
\name{Klmopq}{\\[1ex]\mbox{VeryLongName}} % <===========================
\setlength{\makecvheadnamewidth}{12cm} % <==============================

%\extrainfo{Personal Information}
\extrainfo{Lots Of Personal Information}
\photo[64pt][0.4pt]{example-image-a}

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

you get the result:

result of given MWE