5

I'm trying to indent the first line of each paragraph in the cover letter of the moderncv template. So far I added this at the beginning of the .tex to justify it, but I haven't found a way to indent.

\documentclass[11pt,a4paper,sans]{moderncv} % Font sizes: 10, 11, or 12; paper sizes: a4paper, letterpaper, a5paper, legalpaper, executivepaper or landscape; font families: sans or roman

\moderncvstyle{casual} % CV theme - options include: 'casual' (default), 'classic', 'oldstyle' and 'banking'
\moderncvcolor{blue} % CV color - options include: 'blue' (default), 'orange', 'green', 'red', 'purple', 'grey' and 'black'
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
\patchcmd{\makelettertitle}% <cmd>
    {\raggedright \@opening}% <search>
    {\@opening}% <replace>
    {}{}% <success><failure>
\makeatother

Can I add anything in there to indent? Or should I do something else?

-- Edit --

This is the letter part in the code

 \clearpage

 \recipient{Empresa contratante}{A coruña, España} % Letter recipient
 \date{\today} % Letter date
 \opening{Estimados Srs,} % Opening greeting
 \closing{Atentamente,} % Closing phrase
 \enclosure[Adjunto]{Curriculum vit\ae{}} % List of enclosed documents

 \makelettertitle % Print letter title

 This is the part where I write my letter and I want it to be indented

 \end{adjustwidth}

 \makeletterclosing % Print letter signature
  • Welcome to TeX.SX! The problem is interesting, but a minimal example of code is needed. – egreg Jun 17 '15 at 8:46
  • I added a little more code, I don't know if it was what you needed. Thanks! – Álvaro Jun 17 '15 at 8:52
  • Could you add also \documentclass and the other bits that make the example compilable? – egreg Jun 17 '15 at 8:59
  • Done! Sorry, I'm a first timer in LaTex – Álvaro Jun 17 '15 at 9:11
1

Since you are already patching \makelettertitle, you can add the settings there:

\makeatletter
% patch \makelettertitle to use justification and normal indentation
\patchcmd{\makelettertitle}% <cmd>
  {\raggedright \@opening}% <search>
  {\parindent=11pt % or what you think best
   \parskip=0pt plus 0.1pt % remove the blank lines between paragraphs
   \@opening}% <replace>
  {}{}% <success><failure>

% patch \makeletterclosing to have the closing flush left
\patchcmd{\makeletterclosing}
  {\@closing}
  {\vspace{1.5em}\noindent\@closing}% the same vertical space as at the start
  {}{}
\makeatother

enter image description here

  • Okay, it worked to perfection, thanks!! But I would prefer the closing to be in the left as the opening is... Is there a way to do it? – Álvaro Jun 17 '15 at 10:25
  • @Álvaro You need to add \noindent; see the modified code. – egreg Jun 17 '15 at 10:37
  • Thank you! Perfect answer. Can't validate it because I don't have enough rep yet... – Álvaro Jun 17 '15 at 10:45
2

For moderncv documents, I usually use this hack to force indentation, placing it at the beginning of part I want to have indentation in:

\leftskip 0.1in
\parindent -0.2in 

And then to change back to normal, this at the end of the section:

\leftskip 0in
\parindent 0in 
0

I just add {\hskip 0.5em} at the beginning of each paragraph. Maybe not systematic as the other answers, but this works fine for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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