如何保留\parbox
并同时消除单词之间过多的间距?
\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}
答案1
因为你的右对齐框很小。句子的性质,你的长单词sentence
不能很好地换行,而且没有其他地方可以换行,这意味着结果只能是其他方式。你还能在哪里换行?你不能在其他地方换行,所以为了实现对齐,你只能这样做。如果你有对齐和窄列或页面或其他东西,这种情况总是会发生。有什么替代方案?不是\parbox
,如果你将边距设置得非常宽以给文本提供相同的空间,也会发生同样的情况
您想删除默认的右对齐吗?
\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}
答案2
\parbox 在其初始化代码中调用 \sloppy。您可以将其重置为 \fussy,但这很容易导致行过满。(我删除了句号,因为句号后面的空间较大,很难看出区别):
\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}