2

The following code is my moderncv in the classic style. At the moment there is roundabout 4 to 5 cm space between the page(top) and the picture. How can I reduce this space to bring to complete header further up? Can anybody help me on this?

\documentclass[11pt,a4paper,sans]{moderncv} % Font sizes: 10, 11, or 12; paper sizes: a4paper, letterpaper, a5paper, legalpaper, executivepaper or landscape; font families: sans or roman
\moderncvstyle{classic} % CV theme - options include: 'casual' (default), 'classic', 'oldstyle' and 'banking'
\moderncvcolor{blue} % CV color - options include: 'blue' (default), 'orange', 'green', 'red', 'purple', 'grey' and 'black'
\makeatletter
  \renewcommand{\makecvtitle}{%
    \recomputecvlengths%
    % optional picture box
    \newbox{\makecvtitlepicturebox}%
    \savebox{\makecvtitlepicturebox}{%
      \ifthenelse{\isundefined{\@photo}}%
      {}%
      {%
    \hspace*{\separatorcolumnwidth}%
    \color{color1}%
    \setlength{\fboxrule}{\@photoframewidth}%
    \ifdim\@photoframewidth=0pt%
      \setlength{\fboxsep}{0pt}\fi%
    \framebox{\includegraphics[width=\@photowidth]{\@photo}}}}%
    \newlength{\makecvtitlepicturewidth}\settowidth{\makecvtitlepicturewidth}{\usebox{\makecvtitlepicturebox}}%
    % name and title
    \setlength{\makecvtitlenamewidth}{189pt}% dummy value, was overwritten
    \begin{minipage}[b]{\makecvtitlenamewidth}%
    \raggedleft% 
      \namestyle{\@firstname} \namestyle{\@familyname}\\[1em]%
      \ifthenelse{\equal{\@title}{}}{}{\titlestyle{\@title}}\\[1em]
      \vspace{20pt}%
      \addressfont\color{color2}%
      \ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\@addressstreet%
    \ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}}%
      \ifthenelse{\isundefined{\@mobile}}{}{\makenewline mobile: \@mobile}%
      \ifthenelse{\isundefined{\@email}}{}{\makenewline mail: \emaillink{\@email}}%
      \ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol\httplink{\@homepage}}%
      \ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}%
    \end{minipage}%
    \hfill%
    % optional picture box
    \usebox{\makecvtitlepicturebox}\\[2.5em]%
    % optional quote
    \ifthenelse{\isundefined{\@quote}}%
      {}%
      {{\centering\begin{minipage}{\quotewidth}\quotestyle{\@quote}\end{minipage}\\[2.5em]}}%
    \par}%
\makeatother
%----------------------------------------------------------------------------------------
\usepackage{lipsum} % Used for inserting dummy 'Lorem ipsum' text into the template
\usepackage[scale=0.75]{geometry} % Reduce document margins
\setlength{\hintscolumnwidth}{3.7cm} % Uncomment to change the width of the dates column
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
%----------------------------------------------------------------------------------------
%   NAME AND CONTACT INFORMATION SECTION
%----------------------------------------------------------------------------------------

\firstname{Mr} % Your first name
\familyname{Smith} % Your last name

% All information in this block is optional, comment out any lines you don't need
\title{CV}
\address{mystreet}{mytown}
\mobile{12345}
\email{[email protected]}
\photo[230pt][0pt]{mypic} % The first bracket is the picture height, the second is the thickness of the frame around the picture 
\quote{quote}

% ----------------------------------------------------------------------------------------
\usepackage{pdfpages}
\begin{document}
\pdfbookmark[0]{bookmark}{bo}
\begin{minipage}[b]{\textwidth}
\vspace{2cm}
\end{minipage}


%----------------------------------------------------------------------------------------
\makecvtitle % Print the CV title
%----------------------------------------------------------------------------------------
%   EDUCATION SECTION
%----------------------------------------------------------------------------------------

\section{me}
\cvitem{born}{1 January 1900}

\vspace{2cm}
%\emptysection \closesection
mytown, \today

\label{lastpage} % 

\end{document}
2
  • 1
    Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem.
    – Adam Liter
    Commented Feb 16, 2015 at 20:16
  • ok, thank you. I think this is what you mean? Commented Feb 16, 2015 at 20:35

1 Answer 1

0

The title is set at the top of the page by default (no vertical space added). You added a \vspace{2cm} above the \makecvtitle, causing it to be pushed down by 2cm. Remove this and you'll note the title being aligned with the top:

enter image description here

\documentclass[11pt,a4paper,sans]{moderncv} % Font sizes: 10, 11, or 12; paper sizes: a4paper, letterpaper, a5paper, legalpaper, executivepaper or landscape; font families: sans or roman
\moderncvstyle{classic} % CV theme - options include: 'casual' (default), 'classic', 'oldstyle' and 'banking'
\moderncvcolor{blue} % CV color - options include: 'blue' (default), 'orange', 'green', 'red', 'purple', 'grey' and 'black'
\makeatletter
  \renewcommand{\makecvtitle}{%
    \recomputecvlengths%
    % optional picture box
    \newbox{\makecvtitlepicturebox}%
    \savebox{\makecvtitlepicturebox}{%
      \ifthenelse{\isundefined{\@photo}}%
      {}%
      {%
    \hspace*{\separatorcolumnwidth}%
    \color{color1}%
    \setlength{\fboxrule}{\@photoframewidth}%
    \ifdim\@photoframewidth=0pt%
      \setlength{\fboxsep}{0pt}\fi%
    \framebox{\includegraphics[width=\@photowidth]{\@photo}}}}%
    \newlength{\makecvtitlepicturewidth}\settowidth{\makecvtitlepicturewidth}{\usebox{\makecvtitlepicturebox}}%
    % name and title
    \setlength{\makecvtitlenamewidth}{189pt}% dummy value, was overwritten
    \begin{minipage}[b]{\makecvtitlenamewidth}%
    \raggedleft% 
      \namestyle{\@firstname} \namestyle{\@familyname}\\[1em]%
      \ifthenelse{\equal{\@title}{}}{}{\titlestyle{\@title}}\\[1em]
      \vspace{20pt}%
      \addressfont\color{color2}%
      \ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\@addressstreet%
    \ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}}%
      \ifthenelse{\isundefined{\@mobile}}{}{\makenewline mobile: \@mobile}%
      \ifthenelse{\isundefined{\@email}}{}{\makenewline mail: \emaillink{\@email}}%
      \ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol\httplink{\@homepage}}%
      \ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}%
    \end{minipage}%
    \hfill%
    % optional picture box
    \usebox{\makecvtitlepicturebox}\\[2.5em]%
    % optional quote
    \ifthenelse{\isundefined{\@quote}}%
      {}%
      {{\centering\begin{minipage}{\quotewidth}\quotestyle{\@quote}\end{minipage}\\[2.5em]}}%
    \par}%
\makeatother
%----------------------------------------------------------------------------------------
\usepackage{lipsum} % Used for inserting dummy 'Lorem ipsum' text into the template
\usepackage[scale=0.75]{geometry} % Reduce document margins
\setlength{\hintscolumnwidth}{3.7cm} % Uncomment to change the width of the dates column
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
%----------------------------------------------------------------------------------------
%   NAME AND CONTACT INFORMATION SECTION
%----------------------------------------------------------------------------------------

\firstname{Mr} % Your first name
\familyname{Smith} % Your last name

% All information in this block is optional, comment out any lines you don't need
\title{CV}
\address{mystreet}{mytown}
\mobile{12345}
\email{[email protected]}
\photo[230pt][0pt]{example-image} % The first bracket is the picture height, the second is the thickness of the frame around the picture 
\quote{quote}

% ----------------------------------------------------------------------------------------
\begin{document}


%----------------------------------------------------------------------------------------
\makecvtitle % Print the CV title
%----------------------------------------------------------------------------------------
%   EDUCATION SECTION
%----------------------------------------------------------------------------------------

\section{me}
\cvitem{born}{1 January 1900}

\vspace{2cm}

mytown, \today

\end{document}

The visual above shows the page layout with the addition of the showframe package.

If you wish to have the CV title even higher on the page, you can either insert a manual, negative \vspace, but this would only affect the first page. If you wish to adjust things globally, use the geometry package and set a specific margin for top.

1
  • Werner, thank you to show me how blind I am : ) I only focused on the renew command and I forgot to have a look at the parts I added a couple of days before! thanks again! Commented Feb 16, 2015 at 21:00

You must log in to answer this question.

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