18

I'm trying to find a way to modify the moderncv LaTeX "library" (dk if library is the right word). As shown on the picture below, I want the space 1 & 2 to be reduced by half.

I'm new in LaTeX, it's awesome btw, sorry if this is a stupid question.

enter image description here

3
  • 1
    May I ask why you want to do this? I think the space around the picture is typografical okay.
    – Mensch
    Commented Nov 15, 2012 at 16:10
  • 17
    I asked my mom "what do you think about my new CV ?" She told me "It's great but the space [1 & 2] are too big".
    – IggY
    Commented Nov 15, 2012 at 16:13
  • My interest in the answer to this question is simply that a proposal requires a 2-page CV and so removal of unnecessary white space is useful. Commented Nov 10, 2016 at 15:21

2 Answers 2

8

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}
1
  • Woaw ! Thank you very much ! I try this in 30min and let you know if it works
    – IggY
    Commented Nov 15, 2012 at 16:09
28

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.

2
  • Thank you a lot ! I picked the @Gonzalo Medina as it was more complete (and I had to choose only one :x) but your answer is also exactly what I needed
    – IggY
    Commented Nov 15, 2012 at 16:54
  • This answer is exactly what I was looking for. Gonzalo's answer is more flexible, but may fall out of sync (if it hasn't already) with future updates to ModernCV.
    – knite
    Commented Oct 9, 2013 at 6:04

You must log in to answer this question.

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