
附圖左側為正常排版\parbox
。第一/第二行填滿單詞,其餘單字彎曲到第三行。我感興趣的是:如何justify
自動將最後一行的文字如附圖右側所示?簡而言之,[s]
像\parbox
上面一樣添加一個選項 arg \makebox
。
\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}
答案1
這裡沒有什麼特別的\parbox
,你在主頁上看到相同的段落對齊方式,通常最後一行允許很短,但如果你希望該空間為 0pt 你可以設置
\setlength\parfillskip{0pt}
由於這使得獲得合理的段落設定變得更加困難,您可能還應該使用\sloppy
允許其他空間拉伸更多來補償。
\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}