Sender & Subject in Cover Letter

Asked by Cheesey

Hi!

First of all: Thank you so much for this great work! I love moderncv and it's looking fantastic!

In our country it's conventional to write the sender on the cover letter aswell as a subject. The date would be in the first line on the right with the sender name. How can I make the cover letter look like the following? Of course it would be great, if this was optional in a future moderncv version!! =)

Thanks for your help!

Firstname Familyname Date(<- on the right side)
 Adressstreet
 Adresscity
 Mobile
 Email

[space]
 [space]

HR Departmnet
 Corporation
 123 Pleasant Lane
 12345 City, State

[space]
 [space]

Subject: Application for a LaTeX programmer

[space]
 [space]

Dear Sirs and Madams,

Lorem Ipsum blah blah blah,...

Question information

Language:
English Edit question
Status:
Solved
For:
moderncv Edit question
Assignee:
Xavier Danaux Edit question
Solved by:
Cheesey
Solved:
Last query:
Last reply:
Revision history for this message
slo_down (bdziubac) said :
#1

Hello,

i have solved the problem with the Subject.

U need to add in "moderncv.cls" in line 567:
\newcommand*{\subject}[1]{\def\@subject{#1}}

If you use classic-theme in "moderncvstyleclassic.sty" in line 287:
{\bfseries\@subject\\[1.5em]}%

Thats it. That's how i solved it. In our country the subject is also very important.

Best regards. Hope i could help.

Revision history for this message
slo_down (bdziubac) said :
#2

Btw in your tex file use this command

\date{\today}
\subject{Application as ...}
\opening{Dear ...,}

Revision history for this message
Cheesey (cheesey) said :
#3

Thank you very much, it worked for me. I had to make the change in moderncvstylecasual.sty, but it worked as well =)

Revision history for this message
Cheesey (cheesey) said :
#4

Okay, I think I have solved my problem more or less, thanks to you, slo_down!

I changed the lines in this file:

C:\Program Files (x86)\MiKTeX 2.9\tex\latex\moderncv\moderncvstylecasual.sty

To this:

%-------------------------------------------------------------------------------
% letter style definition
%-------------------------------------------------------------------------------
\renewcommand*{\makelettertitle}{%
  % recompute lengths (in case we are switching from letter to resume, or vice versa)
  \recomputeletterlengths%
  % ensure footer with personal information
  \makeletterfooter%
  % sender block
  \begin{minipage}[t]{.5\textwidth}
    \raggedright%
    \addressfont%
    {\bfseries\upshape\@firstname~\@familyname}\\%
    \@addressstreet\\%
 \@addresscity\\%
 \@mobile\\%
 \@email%
  \end{minipage}\\[1.5em]
  % recipient block
  \begin{minipage}[t]{.5\textwidth}
    \raggedright%
    \addressfont%
    {\bfseries\upshape\@recipientname}\\%
    \@recipientaddress\\%
  \end{minipage}
    % date
% \hfill% US style
% \\[1em]% UK style
 \begin{flushright}
 \@location , \@date\\[2em]% US informal style: "April 6, 2006"; UK formal style: "05/04/2006"
 \end{flushright}
  % subject
  {\bfseries\@subject\\[1.5em]}%
  % opening

I also changed the lines in this file:

C:\Program Files (x86)\MiKTeX 2.9\tex\latex\moderncv\moderncv.cls

To this:

%-------------------------------------------------------------------------------
% letter design commands definitions
%-------------------------------------------------------------------------------
% elements
\newcommand*{\recipient}[2]{\def\@recipientname{#1}\def\@recipientaddress{#2}}
\renewcommand*{\date}[1]{\def\@date{#1}}\date{\today}
\newcommand*{\location}[1]{\def\@location{#1}}
\newcommand*{\subject}[1]{\def\@subject{#1}}
\newcommand*{\opening}[1]{\def\@opening{#1}}
\newcommand*{\closing}[1]{\def\@closing{#1}}
\newcommand*{\enclosure}[2][]{%
  % if an optional argument is provided, use it to redefine \enclname
  \ifthenelse{\equal{#1}{}}{}{\renewcommand*{\enclname}{#1}}%
  \def\@enclosure{#2}}

I also excluded line 174 in moderncvstylecasual.sty, so my name is no listed in the footer. I excluded it with a "%":

% \strut{\bfseries\upshape\@firstname~\@familyname}\\% the \strut is required to ensure the line is exactly \baselineskip tall

Now the page looks exactly like I wanted it to look. Thank you very much =)

Revision history for this message
slo_down (bdziubac) said :
#5

Cool, that's great.

What about the position of the sender? Do you want to change it or is that ok now?

Let me know, maybe i could help again :)

Revision history for this message
Cheesey (cheesey) said :
#6

The position of the sender is fine for me, but thanks for your help!! =)

Revision history for this message
Ahmed (supersonic-102) said :
#7

Hello

I am doing what you guys are doing but it is not working

Could you please send me the files after modification.

Thanks a lot

Revision history for this message
Ulrich (ulrich-9) said :
#8

In later versions the line numbers are changed. As for v1.5.1:

moderncv.cls: from ~ line 584 to ~ line 597:

%-------------------------------------------------------------------------------
% letter design commands definitions
%-------------------------------------------------------------------------------
% elements
\newcommand*{\recipient}[2]{\def\@recipientname{#1}\def\@recipientaddress{#2}}
\renewcommand*{\date}[1]{\def\@date{#1}}\date{\today}
\newcommand*{\subject}[1]{\def\@subject{#1}}
\newcommand*{\opening}[1]{\def\@opening{#1}}
\newcommand*{\closing}[1]{\def\@closing{#1}}
\newcommand*{\enclosure}[2][]{%
  % if an optional argument is provided, use it to redefine \enclname
  \ifthenelse{\equal{#1}{}}{}{\renewcommand*{\enclname}{#1}}%
  \def\@enclosure{#2}}

moderncvstyleclassic.sty: from ~ line 275 to ~ line 285:

 % date
  \hfill% US style
% \\[1em]% UK style
  \@date\\[2em]% US informal style: "January 1, 1900"; UK formal style: "01/01/1900"
  % opening
  \raggedright%
  {\bfseries\@subject\\[1.5em]}%
  \@opening\\[1.5em]%
  % ensure no extra spacing after \makelettertitle due to a possible blank line
% \ignorespacesafterend% not working
  \hspace{0pt}\par\vspace{-\baselineskip}\vspace{-\parskip}}

Revision history for this message
Ahmed (supersonic-102) said :
#9

hey i need help i am customising the moderncv temp classic

i would need my name to appear in the center top line
then in the following lines i would like my contact infor as in banking style and on the right hand side of my contact info

Revision history for this message
Matthias Baur (matthiasbaur) said :
#10

Better for moderncvstyleclassic.sty would be:

Insert after "\@date\\[2em]% US in ..." (Line 278 in 1.5.1):

% subject
\ifthenelse{\isundefined{\@subject}}{}{{\bfseries\@subject\\[1.5em]}}%

With this, subject is only optional instead of mandatory.

Revision history for this message
Jimu (jimunu) said :
#11

Hi,
I can not apply the solution to version 2.0.0. The files have different content. Could you pls help?

Revision history for this message
Matthias Baur (matthiasbaur) said :
#12

Current way for 2.0.0 is:

Edit moderncv.cls and insert after " \renewcommand*{\date}[1]{\def\@date{#1}}\date{\today}":

  \newcommand*{\subject}[1]{\def\@subject{#1}}

Edit moderncvheadi.sty and insert after "\@date\\[2em]..."

  \ifthenelse{\isundefined{\@subject}}{}{{\bfseries\@subject\\[1.5em]}}