我想将文本换行到 内\framebox
,这样它就会继续在下一行,而不会超出边距。
最小工作示例:
\documentclass[]{report}
\begin{document}
\framebox{\textit{If this script fails, you can try the following:
lower the degree (d), decrease the number of simplices, increase
the order of continuity (if possible) or increase the number of
datapoints in the listed simplices}}.
\end{document}
有任何想法吗?
答案1
\framebox
设置a 中的内容\parbox
:
\documentclass{article}
\begin{document}
\noindent
\framebox{\parbox{\dimexpr\linewidth-2\fboxsep-2\fboxrule}{\itshape%
If this script fails, you can try the following: lower the degree~(d),
decrease the number of simplices, increase the order of continuity (if possible)
or increase the number of datapoints in the listed simplices.}}
\end{document}
计算(使用\dimexpr
)确保盒子的宽度排除内容和框架之间的间隙(两侧各有2 个间隙\fboxsep
和 2 个宽度)。此外,由于您可能对段落缩进不感兴趣\fboxrule
外部这个区块,我已经用过了\noindent
。
请注意,此块不能跨越页面边界。