# Why \parbox makes inter-word spacing very wide and how to fix it?

How to keep \parbox and at the same time get rid of excessive spacing between words?

\documentclass[varwidth]{standalone}
\begin{document}
\parbox{40mm}
{ \everypar{\parshape 2 0mm 40mm 5mm 35mm}
This is sentence 1. This is sentence 2.
This is sentence 3. This is sentence 4.
This is sentence 5. This is sentence 6.
\par
}
\end{document}


• The width of the box plus the words in the box leave TeX with no options: 'change the content' is really the only way out – Joseph Wright May 24 at 19:12
• Well because you've got a very small box with right justification. The nature of the sentences, with your long word sentence which doesn't break very nicely and nowhere else to break each line means the result can't be otherwise. Where else would you break? You can't break, so to achieve justification, you get, well, that. That's always gonna happen if you have justification and narrow columns or pages or whatever. What's the alternative? It's not \parbox, the same would happen if you set the margins really wide to give the same amount of space for your text – Au101 May 24 at 19:16

## 2 Answers

Well because you've got a very small box with right justification. The nature of the sentences, with your long word sentence which doesn't break very nicely and nowhere else to break each line means the result can't be otherwise. Where else would you break? You can't break the line elsewhere, so to achieve justification, you get, well, that. That's always gonna happen if you have justification and narrow columns or pages or whatever. What's the alternative? It's not \parbox, the same would happen if you set the margins really wide to give the same amount of space for your text

Would you like to remove the default right justification?

\documentclass[varwidth]{standalone}
\begin{document}
\parbox{40mm}
{ \everypar{\parshape 2 0mm 40mm 5mm 35mm}\raggedright
This is sentence 1. This is sentence 2.
This is sentence 3. This is sentence 4.
This is sentence 5. This is sentence 6.
\par
}
\end{document}


• No, I mean justification. Such method does require additional horizontal spcaing between the words, which is exactly why your original result was so inelegant. My code doesn't remove right-alignment only by virtue of the accident that your dummy sentences are the same length, try adding This is sentence 12345. This is sentence 12346. as your next line and see what you get – Au101 May 24 at 19:36

\parbox calls \sloppy in its initialization code. You can reset it to \fussy but this can easily lead to overfull lines. (I removed the periods as the larger space after them makes it difficult to see a difference):

\documentclass{article}

\begin{document}
\parbox{40mm}
{\everypar{\parshape 2 0mm 40mm 5mm 35mm}
This is sentence This is sentence
This is sentence  This is sentence
This is sentence This is sentence
}

\bigskip
\parbox{40mm}
{\everypar{\parshape 2 0mm 40mm 5mm 35mm}
\fussy
This is sentence  This is sentence
This is sentence  This is sentence
This is sentence  This is sentence
}
\end{document}


• well see the first and the last line (and look into the log): there are both overfull (by 3.46683pt and 6.1932pt). – Ulrike Fischer May 24 at 20:15
• There are always differences in spacing from line to line, but with such a short linewidth TeX has much less options and it is much more obvious. – Ulrike Fischer May 24 at 20:25