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}


\parfillskipis a tex primitive so the texbook or the free texbytopic,\sloppyshould be in any basic latex tutorial, but offical documentation is the latex book, there are thousands of examples of both on this site – David Carlisle Feb 17 '19 at 09:54\setlength\parfillskip{0pt}in\parbox, will it affect folloing paragraph ? – lyl Feb 17 '19 at 10:32{..}but won't affect the paragraphs outside the box – David Carlisle Feb 17 '19 at 10:35\newcommand{\parboxa}{\sloppy\setlength\parfillskip{0pt}\parbox}, but it does not work(has no effect of justify,e.g.\parboxa[t]{4em){this is an example}). Could you please have a look at this and kindly help me with a solution? – lyl Feb 18 '19 at 12:48\newcommand{\parboxa}[2][c]\parbox[#1]{\sloppy\setlength\parfillskip{0pt}#2}– David Carlisle Feb 19 '19 at 08:03\parboxnormalises some settings (@parboxrestore) so for example if you have a parbox or a minipage in a list you get locally normal justified setting not the paragraph shape from the itemized list. so you need the settings inside the parbox (or change @parboxrestore) – David Carlisle Feb 19 '19 at 12:45\parboxhas also two other optional arguments(heightandinner-align, not just two arguments, so how to redefine my\parboxa? – lyl Feb 20 '19 at 01:05\sloppy\setlength\parfillskip{0pt}works all right except that when there is\\in text, the line before\\loses justify align,e.g.\parbox{5em}{\sloppy\setlength\parfillskip{0pt}M M\\M M M M}, the first line(M M) fails to justify align. Is there a better way to solve it? – lyl Feb 28 '19 at 02:22\\(which you should almost never use in text anyway even with standard settings and especially not in this context) explicitly means to force a line break leaving the line short. Simply do not use that. If you really need a forced line break use\linebreakor if you are ending the paragraph use a blank line. (What document type are you producing, using zero parfillskip and forced line breaks is very rare thing, and almost certainly to produce very ugly typesetting with weirdly spaced words trying to meet the constraints placed on the text???) – David Carlisle Feb 28 '19 at 07:37