Update (moderncv
v2.0)
With moderncv
v2.0, the command to be patched is no more \makelettertitle
but \makeletterhead
, so the correct patch for this version is
\patchcmd{\makeletterhead}
{\begin{minipage}[t]{.5\textwidth}}
{\begin{minipage}[t]{.7\textwidth}}
{}
{}
Original answer (works with older versions of moderncv
)
You can patch the command \makelettertitle
so that the minipage
containing this data is a little bigger. That is, add the following lines in the preamble (the package etoolbox
is loaded by moderncv
):
\patchcmd{\makelettertitle}
{\begin{minipage}[t]{.5\textwidth}}
{\begin{minipage}[t]{.7\textwidth}}
{}
{}
MWE:
\documentclass[12pt,letterpaper,sans]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{black}
\renewcommand{\familydefault}{\sfdefault}
\nopagenumbers{}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.75]{geometry}
\usepackage{lipsum}
\patchcmd{\makelettertitle}
{\begin{minipage}[t]{.5\textwidth}}
{\begin{minipage}[t]{.7\textwidth}}
{}
{}
%% Personal data
\firstname{New PhD}
\familyname{Scholar}
\address{31415 Pi Street}{Largeville, ND, 58202}
\mobile{+1~(502)~321~1234}
\email{scholar@gmail.edu}
\begin{document}
% recipient data
\recipient{New Work and Research Studies Search Committee\\E. Pluribus Unum School of Grant Proposals and Other Funding}{Blueberry University\\204 N. Peach Ave.\\Buymore, WI 78115}
\date{\today}
\opening{Dear Committee Members,}
\closing{Regards,}
\makelettertitle
\lipsum
\makeletterclosing
\end{document}
Output:
So, I have to mention that you example is far from minimal; I would highly recommend you look over some good tips for minimizing your code that have been provided on the Meta site.
But to your question. Several items in your code were all mashed together, likely a result of bringing together several solutions from different places. The placement of the line breaks (with \\[2em]
, for instance) was interfering with being able to add space in front of the second minipage
environment. Similarly, the date got moved around enough times that there were (and still are) some lines that probably aren't necessary (like the \hfill
indicated). Since I don't know exactly what your final product should look like, I'll leave it to you to clean things up from here.
Finally, you are using \patchcmd
to "patch" the command that you were already directly redefining. This is needlessly complicated, unless you anticipate using part of your code again without the changes you are trying to patch in. Just make the changes in the renewed definition of the commands. I have changed the first one to remove \raggedright
multiple times where it is now not necessary. The second \patchcmd
works (I changed it to be \raggedleft
, which is the proper declarative form of the flushright
environment), but it would be better to just make the change in the renewed definition if you want it to "just work".
Your example now becomes:
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{blue}
\nopagenumbers{}
\usepackage{etoolbox}
\usepackage{lipsum}
%%%%%%%%%%%%% Beginning of \makelettertittle modification %%%%%%%%%%%%%%%%%%
\makeatletter
%-------------------------------------------------------------------------------
% letter style definition
%-------------------------------------------------------------------------------
% commands
\renewcommand*{\recomputeletterlengths}{%
\recomputecvlengths%
\setlength{\parskip}{6\p@}}
\newcommand*{\subject}[1]{\def\@subject{#1}}
\renewcommand*{\makelettertitle}{%
% recompute lengths (in case we are switching from letter to resume, or vice versa)
\recomputeletterlengths%
% sender contact info
%\hfill%
\begin{minipage}{.5\textwidth}%
\raggedright%
\addressfont\textcolor{color2}{%
{\bfseries\upshape\@firstname~\@familyname}\@firstdetailselementfalse%
\ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\addresssymbol\@addressstreet%
\ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}}%
\ifthenelse{\isundefined{\@mobile}}{}{\makenewline\mobilesymbol\@mobile}%
\ifthenelse{\isundefined{\@phone}}{}{\makenewline\phonesymbol\@phone}%
\ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol\emaillink{\@email}}%
\ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol\httplink{\@homepage}}%
\ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}}%
\end{minipage}\vspace{2em}% << Add space with \vspace, have actual paragraph break
% recipient block V--V Adjust to fit text and align as desired
\hfill\begin{minipage}[t]{.5\textwidth} % << \hfill now works
\raggedright%
\addressfont%
{\bfseries\upshape\@recipientname}\\%
\@recipientaddress\\[2em]%
\@date\\[1.5em]%
\end{minipage} % << Another paragraph break here needed
% date
\hfill % << This wasn't doing anything good before, probably not now either.
\null\\[2em]%
%\raggedright % << Remove ragged right from definition
\ifthenelse{\isundefined{\@subject}}{}{%
\begin{tabular}{ p{0.08\textwidth} p{0.92\textwidth} }
Objet: & \raggedright \@subject
\end{tabular}
\\[1.5em]}%
% opening
%\raggedright % << Remove ragged right from definition
\@opening\\[1.5em]%
\hspace{0pt}\par\vspace{-\baselineskip}\vspace{-\parskip}}
\renewcommand*{\makeletterclosing}{
\@closing\\[3em]%
{\bfseries \@firstname~\@familyname}%
\ifthenelse{\isundefined{\@enclosure}}{}{%
\\%
\vfill%
{\color{color2}\itshape\enclname: \@enclosure}}}
\makeatother%
%%%%%%%%%%%%%%%%% End of \makelettertittle modification%%%%%%%%%%%%%%%%%%%%%%%%%%%
\patchcmd{\makeletterclosing} %%% Flushing right the signature
{\@closing}
{\raggedleft \@closing}
{}{}
\makeatother
% character encoding
\usepackage[ansinew]{inputenc}
\usepackage[francais]{babel}
% adjust the page margins
\usepackage[top=1.1cm, bottom=1.1cm, left=2cm, right=2cm]{geometry}
\setlength{\hintscolumnwidth}{3cm}
% personal data
\firstname{Mr Foo}
\familyname{Bar}
\title{Resume title}
\address{address}{city}{country}
\mobile{0987654321}
\phone{0123456789}
\email{foo.bar@mail.lol}
\begin{document}
%%%%Recipient infos%%%%
\recipient{Recruitment Office}{Derp Corp.\\12 Some Way\\Foobar}
\date{\today}
\subject{Job application ref. 121212}
\opening{Dear Sir or Madam,}
\closing{Yours faithfully,}
\enclosure[Attached]{curriculum vit\ae{}}
\makelettertitle
\lipsum[1-3]
\makeletterclosing
\end{document}
Best Answer
If you want to only move the address block, i.e. the Company Recruitment ... text, you can add negative vertical space to the arguments of the
\recipient
command directly:Result:
If you want to also move the letter text upwards, I would suggest wrapping the first paragraph (or maybe the entire text) in a
parbox
environment, with a horizontal size less than the pagewidth (the first argument toparbox
). You can then pull up the text with negative\vspace
. This is a bit of a hacky solution, and I couln't make these ideas work with the\opening
command, so you might have to add your opening manually.Result: