1

How can I have some space above the email?

img

Tried newline, hspace and \\ to no avail.

\documentclass[10pt, a4paper]{moderncv}

%% ModernCV themes
\moderncvstyle{classic}
\moderncvcolor{red}

%% Character encoding
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

%% Personal data
\firstname{John}
\familyname{Doe}
\address{Don Knuth Street, 42}{Tex City}
\newline
\\
\hspace{0.5cm}
\email{[email protected]}
\setlength{\fboxsep}{0pt}
\photo[64pt][0.8pt]{placeholder.png}

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

Similar question1 yet no solution for me

Footnotes

1 Line break in address part of moderncv

1 Answer 1

2

Adding spaces in the preamble before the \begin{document} simply will not work.

What moderncv does is to collect all information: name, address, email, social, photo, then build a title based on the style (classic in your case). To collect the information moderncv defined macros that gather said information. For example, the macros that define the names are called \firstname and \familyname. The macros take the names as arguments.

That is why it does not matter in which order you write down these macros in your preamble, as long as the macro appears before \makecvtitle. You can write the address first, then the names, or first name, picture then address... You'll end up with the classic design.

The design uses a tabular to put everything in place. One option to control the spaces would be to patch the moderncvheadi.sty definition file. But that is quite complicated.

A simple hack in your case would be to add a line to the address. Since the address macro can take several lines, simply add another one:

\address{Don Knuth Street, 42}{Tex City}{~}

Notice that the added line has the ~ character in it. If you just add an empty line with {} it will be ignored, adding this little space causes the line to be printed.

Another way of doing this is calling the moderncv macro that creates a new line \makenewline

\address{Don Knuth Street, 42}{Tex City\makenewline}

Finally, if you need to tweak the size of the space you can use the following strut

\address{Don Knuth Street, 42}{Tex City}{\rule{0pt}{20pt}}

the second argument in the \rule defines how high your address will go.

Adding \\ \newline or \hspace to the address macro will not work since the macro is built to get rid of redundant spaces in order to produce the tight box it produces.

MWE:

\documentclass[10pt, a4paper]{moderncv}
\usepackage{graphicx}

%% ModernCV themes
\moderncvstyle{classic}
\moderncvcolor{red}

%% Character encoding
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

%% Personal data
\email{[email protected]}
\firstname{John}
\photo[64pt][0.8pt]{placeholder.png}
\familyname{Doe}
\address{Don Knuth Street, 42}{Tex City}{\rule{0pt}{20pt}}
%\address{Don Knuth Street, 42}{Tex City\makenewline}
%\address{Don Knuth Street, 42}{Tex City}{~}
\familyname{Doe}
\setlength{\fboxsep}{0pt}


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

You must log in to answer this question.

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