moderncv - modify size of blank spaces
If you are new to LaTeX and don't need the flexibility offered by Gonzalo's solution (that enables you to modify anything you want in the header), you could simply put this
\usepackage[scale=0.8,top=2cm]{geometry}
in you preamble (or modify a line looking like this one already there). The scale=0.8
ensures that the margins are such that 80% of the page is reserved for the total body (change 0.8
to whatever you like between 0.0
and 1.0
), while top=2cm
forces the top margin to be exactly 2cm
(again, change this to whatever you like).
For the space after the header, simply put
\vspace*{-5mm}
right after \maketitle
. This produces a negative vertical space of 5mm
, or any other length you specify, i.e. it moves the following text back 5mm
to the top. You can also use this trick before a \section
if you want to reduce the space between sections.
The answer depends on the style used. Assuming the casual
style, you can redefine \makecvtitle
in the following way (modified lines are signaled with % NEW
; feel free to change the lengths used according to your needs):
\documentclass{moderncv}
\moderncvstyle{casual}
\moderncvcolor{blue}
\firstname{John}
\familyname{Doe}
\photo{ctanlion}
\makeatletter
\renewcommand*{\makecvtitle}{%
\recomputecvlengths%
\vspace*{-3em} % NEW
\makecvfooter%
\newbox{\makecvtitlepicturebox}%
\savebox{\makecvtitlepicturebox}{%
\ifthenelse{\isundefined{\@photo}}%
{}%
{%
\setlength\fboxrule{\@photoframewidth}%
\ifdim\@photoframewidth=0pt%
\setlength{\fboxsep}{0pt}\fi%
{\color{color1}\framebox{\includegraphics[width=\@photowidth]{\@photo}}}}}%
\usebox{\makecvtitlepicturebox}%
% name
\@initializelength{\makecvtitlepicturewidth}%
\settowidth{\makecvtitlepicturewidth}{\usebox{\makecvtitlepicturebox}}%
\parbox[b]{\textwidth-\makecvtitlepicturewidth}{%
\raggedleft\namefont{\color{color2!50}\@firstname} {\color{color2}\@familyname}}\\[-.35em]% alternate design: \MakeLowercase and no space
{\color{color2!50}\rule{\textwidth}{.25ex}}%
% optional title
\ifthenelse{\equal{\@title}{}}{}{\\[1.25em]\null\hfill\titlestyle{\@title}}\\[0em]% NEW original 2.5em
\ifthenelse{\isundefined{\@quote}}%
{}%
{{\null\hfill\begin{minipage}{\quotewidth}\centering\quotestyle{\@quote}\end{minipage}\hfill\null\\[2.5em]}}%
\par}% to avoid weird spacing bug at the first section if no blank line is left after \maketitle
\makeatother
\begin{document}
\makecvtitle
\section{Test Section}
\end{document}