[Tex/LaTex] Cover letter moderncv opening and closing spacing

moderncvspacing

I am writing a cover letter using moderncv. Everything works fine so far, but since I am not using any \opening{}, I am having a large empty vertical spacing and I don't know how to get rid of it.

\documentclass[11pt,a4paper,sans,french]{moderncv}        
\usepackage{ragged2e}
% moderncv themes
\moderncvstyle{classic}                           
\moderncvcolor{green}                             

\usepackage[utf8]{inputenc}                  
\usepackage[scale=0.75]{geometry}

\name{XXX}{XXX}
\title{}                            
\address{XXXX}{XXX}% optional, remove / comment the line if not wanted; the "postcode city" and and "country" arguments can be omitted or provided empty
\phone[mobile]{+XXX}               
\email{XXX}                            

\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\renewcommand{\baselinestretch}{1.25}

\begin{document}
% recipient data
\recipient{XXX}{XXX}
\opening{}
\closing{Sincerely,}
\makelettertitle
\justify
Dear Mr. XXX,

\makeletterclosing

\end{document}

enter image description here

How can I control those spacings? More precisely, how can I make them smaller?

Best Answer

The \opening command, internally \@opening is used in the moderncv mechanism like this:

 \@opening\\[1.5em]

One dirty but quick and painless way to make it work is to use, in your document, the opening command with \vspace*{-1.5em} to counter the spacing later introduced by the class, i.e.

 \opening{\vspace*{-1.5em}}

Here a full code sample

\documentclass[11pt,a4paper,sans,french]{moderncv}        
\usepackage{ragged2e}
% moderncv themes
\moderncvstyle{classic}                           
\moderncvcolor{green}    
\usepackage[utf8]{inputenc}                  
\usepackage[scale=0.75]{geometry}

\name{XXX}{XXX}
\title{}                            
\address{XXXX}{XXX}% optional, remove / comment the line if not wanted; the "postcode city" and and "country" arguments can be omitted or provided empty
\phone[mobile]{+XXX}               
\email{XXX}                            

\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\renewcommand{\baselinestretch}{1.25}

\begin{document}
% recipient data
\recipient{XXX}{XXX}
\opening{\vspace*{-1.5em}}
\closing{Sincerely,}
\makelettertitle
\justify
\vspace*{-1.5em}
Dear Mr. XXX,

\makeletterclosing

\end{document}

Which produces:

enter image description here