[Tex/LaTex] moderncv, classic style: how to shift address box to the right

horizontal alignmentmoderncv

I am using the classic style of the moderncv package and I want to align the right margin of the address box with the right margin of all the other content and get rid of the offset marked in this image:

enter image description here

I can of course use the geometry package to change the margins in total, but whatever I try, the right margin of the address box continues to be shifted compared to the right margin of my cv entries.

By searching this forum I already figured out that I most likely will have to reconfigure the \makecvtitle command, but I am not good enough to understand how to do it without further help… :-/

Here is the minimal example that was used to generate the attached picture (vertical lines were drawn manually for clarity):

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{blue}
\usepackage[utf8]{inputenc}

%%%% adjust the page margins
\usepackage[scale=0.78, top=2.5cm, bottom=2.5cm, footskip=1cm]{geometry}

% personal data
\name{My}{Name}
\title{My title}
\address{Street}{City}{Country}
\phone[mobile]{1234567890}
\email{e@mail.com}

\usepackage{eurosym}

\begin{document}

\makecvtitle

\section{Education}
\cventry{from -- to}{Student}{This is a very long description of my education and what I have done with the only purpose to completely fill up the lane}{}{}{}

\end{document}

Best Answer

The construction of the CV header - done inside \makecvhead - stores much of its content in boxes:

  • \makecvheaddetailsbox: For address information

  • \makecvheadpicturebox: Picture, if supplied

  • \makecvheadnamebox: Name and title

The construction of \makecvheaddetailbox has a spurious space that ends up on the right of the tabular that contains the addresses - a bug in the package. Typically, spurious spaces are difficult to remove without copying the entire macro and inserting the appropriate % where needed. However, in this case we can slip a non-argument macro after \end{tabular}:

enter image description here

\documentclass[sans]{moderncv}

\moderncvstyle{classic}
\moderncvcolor{blue}

% personal data
\name{My}{Name}
\title{My title}
\address{Street}{City}{Country}
\phone[mobile]{1234567890}
\email{e@mail.com}

\usepackage{etoolbox}
% \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\patchcmd{\makecvhead}{\end{tabular}}{\end{tabular}\relax}{}{}

\begin{document}

\makecvtitle

\section{Education}
\cventry{from -- to}{Student}{This is a very long description of my education and 
  what I have done with the only purpose to completely fill up the lane}{}{}{}

\end{document}