Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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:

\documentclass{moderncv}
\moderncvstyle{classic}

\usepackage{lipsum} % just for dummy text

\firstname{John}
\familyname{Doe}

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

\makelettertitle
\lipsum[1]
\makeletterclosing

\clearpage

\makecvtitle

\section{Education}
\cventry{2009--present}{PhD Student}{here}{and}{there}{}
\end{document}

output

share|improve this question
add comment

3 Answers

up vote 20 down vote accepted

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

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

output

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

share|improve this answer
    
Awesome. Works perfect –  Pascal Oct 11 '12 at 6:47
    
@Werner Works great. But that resulted many hyphenation in my text. Is there any way to fully justify (like in word processors) ??? –  TheKojuEffect Oct 5 '13 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 '13 at 3:45
add comment

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:

\newlength{\currentparskip}

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    

      TEXT OF THE LETTER

    \end{minipage}

\makeletterclosing

\clearpage

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

share|improve this answer
add comment

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

% opening
\raggedright%
\@opening\\[1.5em]%

into

% opening
{\raggedright%
\@opening\\[1.5em]}%

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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