
答案1
試試這個(在它自己的一個段落中):
\noindent\makebox[\linewidth][s]{I like the world because it is beautiful}
解釋:第二個可選參數用於框內的對齊。s
是為了stretch
.
編輯:按照@egreg的建議,我們可以使用巨集簡化輸入,並添加程式碼以避免任何 bad box
訊息。演示:
\newcommand\linefillwith[1]{\par\noindent\makebox[\linewidth][s]{\spaceskip=\fontdimen2\font plus 1fil minus \fontdimen4\font #1}}
\lipsum[11]\medskip
\linefillwith{\color{red}I like the world because it is beautiful}