[Tex/LaTex] Automatically justify text in \parbox

parbox

The left part of the attached figure showes the nomal typeset of \parbox.
The first/second lines are fully filled with words, and the rest words are bent to the third line.
What interests me is: how to justify words of the last line autometically as shown on the right part of the attatched figure? Briefly speaking, add a option arg [s] to \parbox just like the \makebox does.

\documentclass{article}
%\usepackage{...}
\begin{document}

\parbox[s]{15em}{How to spread align the rest words which are not enough to fill the width of parbox?}% I just want the option arg of \parbox in this example works like \makebox[s] does.

\end{document}

`

Best Answer

There is nothing special about \parbox here, you see the same paragraph justification in the main page, normally the last line is allowed to be short but if you want that space to be 0pt you can set

\setlength\parfillskip{0pt}

As this makes it much harder to get a reasonable paragraph setting you probably should also use \sloppy to allow other spaces to stretch more to compensate.

enter image description here

\documentclass{article}
%\usepackage{...}
\begin{document}

\parbox{15em}{%
\sloppy\setlength\parfillskip{0pt}
How to spread align the rest words which are not
  enough to fill the width of
  parbox?}

\end{document}
Related Question