2

When I compile the following pieces of the moderncv example, the first and middle name are closer to each other than to the last name.

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{blue}
\usepackage[scale=0.75]{geometry}

\name{Johnathan Ulysses}{Bierbaum}
\title{Curriculum vitae}

\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}
\photo[50mm][0.4pt]{picture}

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

As picture I used the example picture from the moderncv package but any other will do. The picture is necessary to get the line breaks.

The incorrect spacing seems to occur because the middle name contains a descender whereas the first name doesn't.

One solution would be to append a white character with descender to the first name. This is not very nice because it breaks copy & pasting.

Another solution would be to use a raisebox like \name{\raisebox{.4ex}{Johnathan} Ulysses}{Bierbaum}. This seems to work rather well although it might be more complicated if first and middle name are swapped. Also I don't know if that height would be correct.

The \strut option as mentioned in this question creates a gap that seems to big. (When using \name{Johnathan\strut{} Ulysses}{Bierbaum})

What is the best solution to get consistent line spacing between lines with and without descenders?

4
  • I think you may need to use \strut (or similar), try \name{Dorothy Crowfoot}{Hodgkin} you should see that there is again a mismatch in gap between lines but the small gap is now between the bottom two lines. The issue is not different gaps, but actually a difference in the height of the letters. With just two lines it's a single gap so it doesn't really need to be fixed, unfortunately with three it can be more visible.
    – Dai Bowen
    Sep 13 '16 at 21:28
  • It seems the problem is not immediately clear from the given code, since the picture that has not been provided leads to a line break between first and middle name; see answer of egreg below.
    – gernot
    Sep 13 '16 at 22:32
  • 2
    @gernot I do not see the problem - the code supplied specifies a fixed width for the picture, as long as an appropriately titled graphic can be added to the directory nothing should prevent the code attached being compiled and the problem the OP discusses can be readily observed (and fixed if you're egreg).
    – Dai Bowen
    Sep 13 '16 at 23:11
  • I edited the post to clarify the picture situation.
    – Benjamin
    Sep 14 '16 at 20:33
3

The class uses \namefont to style the name which, under the (wrong) assumption the name fits in one line, adds a line breaking command in an unsuitable position, when the interline spacing has already been reverted to a smaller value than the one good for \namefont. Here's a patch to solve the issue.

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{blue}
\usepackage[scale=0.75]{geometry}
\usepackage{xpatch}

\makeatletter
% remove \\ from the wrong place
\xpatchcmd\makecvhead{\\[1.25em]}{}{}{}
% put it where it should (reducing the space, because the em changes
\xpatchcmd\makecvhead{\@lastname}{\@lastname\\[.5em]}{}{}
\makeatother

\name{Jopnathan Ulysses}{Bierbaum}
\title{Curriculum vitae}

\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}
\photo[50mm][0.4pt]{duck}

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

enter image description here

1
  • Thank you! Works like a charm. Is this something that should be brought to the package maintainers attention?
    – Benjamin
    Sep 14 '16 at 20:27

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.