I am writing a cover letter and CV using moderncv. Everything works fine so far, but the text in the cover letter is not justified. I think it is good that it is not hyphenated, but it would look much nicer if the text was justified.

Here is a minimal example:


\usepackage{lipsum} % just for dummy text


\recipient{Prof.\ Dr.\ Foo Bar}{}
\opening{Dear Professor Dr.\ Bar,}
\closing{Yours sincerely,}
\enclosure[Attached]{curriculum vit\ae}




\cventry{2009--present}{PhD Student}{here}{and}{there}{}


6 Answers 6


Add the following to your document preamble, after loading the moderncv style (classic):

\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\patchcmd{\makeletterhead}% <cmd>
  {\raggedright \@opening}% <search>
  {\@opening}% <replace>
  {}{}% <success><failure>


The above patch just removes the necessary \raggedright from the template at the correct location (just before calling \@opening).

  • @Werner Works great. But that resulted many hyphenation in my text. Is there any way to fully justify (like in word processors) ??? Oct 5, 2013 at 2:58
  • @TheKojuEffect: Try adding \makeatletter\\hyphenpenalty=\@M\makeatletter to your document preamble. This should assign an large enough (infinite) penalty to automatically hyphenate any words at a line break, effectively removing the ability to hyphenate in the document. For more on penalties, see What are penalties and which ones are defined? If this doesn't work, see How to prevent LaTeX from hyphenating the entire document?
    – Werner
    Oct 5, 2013 at 3:45

You can simply include:


and right after \makelettertitle put:


Works fine for me both with classic and with casual.

  • I believe this is the simplest answer here. Thanks!
    – Gabriel
    Feb 8, 2017 at 15:28
  • 4
    This seems to insert an extra newline after \makelettertitle.
    – Szabolcs
    Dec 29, 2017 at 15:05

Just fix the "bug" in moderncv templates. If you use banking style, go to moderncvstylebanking.sty and change

% opening


% opening

Note that this simply enclose the raggedright command, so it won't affect the entire document from this point onwards. You can do the same for each of the other styles.

  • 1
    Even if Wener's answer works, I believe this is a better, perhaps correct, way of doing it.
    – BRabbit27
    Apr 25, 2014 at 8:26
  • 1
    The fact that \raggedright is not enclosed in a group with \@opening is actually not a bug, it's the intended design. AFAIK, the convention for letters is not to justify the text, but to have it flushed left. Obviously (and thankfully!), some people might have a different preference than the "conventional wisdom", and an easy way to select what you prefer would probably be a welcome addition to moderncv.
    – Xavier
    Aug 16, 2015 at 19:29
  • @Xavier If you are correct, then the "correct" way of doing so would be to apply 'raggedright' separately for the opening the the body of the letter, and not tying the two.
    – emem
    Aug 17, 2015 at 10:32

On ModernCV version 2.0, the answer provided by Werner needs to be updated to:

\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\patchcmd{\makeletterhead}% <cmd>
  {\raggedright \@opening}% <search>
  {\@opening}% <replace>
  {}{}% <success><failure>
  • 1
    I'll update my answer to reflect this. There's no need for an additional answer.
    – Werner
    Aug 16, 2015 at 19:05
  • 1
    yeah, i tried to comment on it, but didn't have enough "brownie points" for a comment! sorry, SE rules apparently.
    – maccouch
    Aug 17, 2015 at 9:52

I have a not so elegant solution using \minipage. That works fine for the casual style but it should work for the other ones as well.

Before \begin{document}, add:


Then, when writing the letter, after the \makelettertitle command, put:

\setlength{\currentparskip}{\parskip}% save the value of paragraph spacing
\begin{minipage}{\textwidth} %create minipage
    \setlength{\parskip}{\currentparskip}% restore the value    





The paragraph spacing is zero in the \minipage, so one has to restore the value so that the text spacing would be ok.


The current solutions didn't work for me. Here's what did:


And then after \makelettertitle I added:


Worked on both casual and classic styles on Overleaf.

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.