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 have the following code:

\documentclass{minimal}
\usepackage[french]{babel}
\usepackage[newcommands]{ragged2e}

\begin{document}
  \begin{center}
    \parbox{9cm}{
      \textsc{
Jesus a dit~: \og Je suis le bon berger~;
 le bon berger donne sa vie pour les brebis \fg{}
      }
    }
  \end{center}
\end{document}

The paragraph usually gives good results, but with this specific sentence, I get something ugly:

ragged2e with babel

The case is quite rare (I have tens of other boxes that work fine) so I could just force the carriage return for this one, but I'd like to understand why it does this...

share|improve this question
    
I don't get the same output; instead, the second instance of the word "berger" is split as "ber-ger". –  egreg Apr 19 '11 at 12:18
    
@egreg: that'd be better indeed if such was the case for me. –  ℝaphink Apr 19 '11 at 12:38
    
@Raphink: are you sure that French hyphenation is enabled? Is that really the example? –  egreg Apr 19 '11 at 12:42
1  
Look at the log for possible messages about missing hyphenation patterns –  egreg Apr 19 '11 at 13:24
1  
The line break after \textsc{ is adding a space before 'Jesus'. To avoid this either use %, i.e. \textsc{%, to make LaTeX ignore the line break or avoid the line break altogether. –  Martin Scharrer Apr 19 '11 at 13:40
show 4 more comments

1 Answer

up vote 5 down vote accepted

Well it certainly is better if you activate the hyphenation pattern for french. This will "split" the berger. It also helps if you remove the stretchable space in the spacing command inserted by \og. But the main problem is that the centering commands of ragged2e changes the spaceskip but doesn't reset it at the start of the \parbox. This forces LaTeX to stretch the only stretchable space available (after the \og) as much as possible. I would say this is a bug.

\documentclass{article}

\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage{lipsum}
\usepackage[newcommands]{ragged2e}
\makeatletter
% \def\FBguill@spacing{\penalty\@M\hskip.8\fontdimen2\font}
\makeatother
\begin{document}
\parbox{9cm}{%
    \lipsum[1]\par
    \scshape
     Jesus a dit~: \og Je suis le bon berger~;
     le bon berger donne sa vie pour les brebis \fg{}
    }


\begin{center}
   \parbox{9cm}{%
   \lipsum[1]\par
    \scshape
   Jesus a dit~: \og Je suis le bon berger~;
   le bon berger donne sa vie pour les brebis \fg{}
    }
\end{center}

\makeatletter 
%correcting the spaceskips:

\begin{center}
  \parbox{9cm}{%
    \@raggedtwoe@spaceskipfalse
    \@raggedtwoe@everyselectfont
    \lipsum[1]\par
    \scshape
   Jesus a dit~: \og Je suis le bon berger~;
   le bon berger donne sa vie pour les brebis \fg{}
    }
\end{center}

\end{document}
share|improve this answer
    
This is great, thank you. –  ℝaphink Apr 19 '11 at 13:41
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.