2
  1. I am trying to move date block to the right side of page (see picture - this is desired result). But I get error There's no line here to end. \makelettertitle
  2. There are a better way to add subject block without editing moderncv.sty? I just have added it to \opening{} (see code)

enter image description here

Minimal working example:

% !TeX TS-program = xelatex
\documentclass[11pt,a4paper,roman]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{blue}
\usepackage[scale=0.75]{geometry}
\usepackage{lipsum}

% personal data
\name{John}{Doe}
\address{street and number}{postcode city}{country}
\email{john@doe.org}
\extrainfo{additional information}

 % Remove extrainfo from cover letter
\patchcmd\makelettertitle{\makenewline\@extrainfo}{}{}{}

% text justify of cover letter
\usepackage{etoolbox}
\makeatletter
\patchcmd{\makelettertitle}% <cmd>
{\raggedright \@opening}% <search>
{\@opening}% <replace>
{}{}% <success><failure>
\makeatother

\begin{document}

\recipient{Company Recruitment team}{Company, Inc.\\123 somestreet\\some city}
\date{  
\begin{flushright}
\today
\end{flushright}  }
\opening{%
\textbf{Subject: bla bla bla alsdlasdlladlla}\\\\       % ugly solution?
Dear Sir or Madam,}
\closing{Yours faithfully,}
\enclosure[Attached]{curriculum vit\ae{}}
\makelettertitle

\lipsum[1-3]

\makeletterclosing

\end{document}
  • 1
    For first, use \patchcmd{\makelettertitle}% <cmd> {\@date\\[2em]}% <search> {\\\mbox{}\hfill\@date\\[2em]}% <replace> {}{}% <success><failure> and just say \date{\today}. What do you expect for second? – user11232 Aug 7 '15 at 12:43
0

What you have done to move the date is fine but a shorter way is to use \date{\hfil\today}.

The the cause of There's no line here to end has nothing to do with the date, however. Rather, this is caused by the \\\\ after your subject.

% !TeX TS-program = xelatex
\documentclass[11pt,a4paper,roman]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{blue}
\usepackage[scale=0.75]{geometry}
\usepackage{lipsum}

% personal data
\name{John}{Doe}
\address{street and number}{postcode city}{country}
\email{john@doe.org}
\extrainfo{additional information}

 % Remove extrainfo from cover letter
\patchcmd\makelettertitle{\makenewline\@extrainfo}{}{}{}

% text justify of cover letter
\usepackage{etoolbox}
\makeatletter
\patchcmd{\makelettertitle}% <cmd>
{\raggedright \@opening}% <search>
{\@opening}% <replace>
{}{}% <success><failure>
\makeatother

\begin{document}

\recipient{Company Recruitment team}{Company, Inc.\\123 somestreet\\some city}
\date{\hfil\today}
\opening{%
\textbf{Subject: bla bla bla alsdlasdlladlla}\\       % ugly solution?
Dear Sir or Madam,}
\closing{Yours faithfully,}
\enclosure[Attached]{curriculum vit\ae{}}
\makelettertitle

\lipsum[1-3]

\makeletterclosing

\end{document}
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.