# Problem with babel, ragged2e and parbox

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:

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...

-
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
Look at the log for possible messages about missing hyphenation patterns – egreg Apr 19 '11 at 13:24
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

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}

-
This is great, thank you. – ℝaphink Apr 19 '11 at 13:41