在TeX中创建一个牢不可破的块

fre*_*ley 16 latex page-break tex

我想在TeX中执行以下操作:

\begin{nobreak}  

Text here will not split over pages, it will remain
as one continuous chunk. If there isn't enough room
for it on the current page a pagebreak will happen
before it and the whole chunk will start on the next
page.  

\end{nobreak}
Run Code Online (Sandbox Code Playgroud)

这可能吗?

phi*_*mue 30

你可以试试

\begin{samepage}
 This is the first paragraph. This is the first paragraph. 
 This is the first paragraph. This is the first paragraph. 
 \nopagebreak
 This the second. This the second. This the second. 
 This the second. This the second. This the second. 
 This the second. This the second. 
\end{samepage}
Run Code Online (Sandbox Code Playgroud)

samepage阻止LaTeX在一个段落内进行samepage分页,即在环境中,分页仅在段落之间.因此,您还需要nopagebreak防止LaTeX在两个段落之间进行分页.


Ste*_*joa 9

快速测试表明也minipage有这种行为.

\begin{minipage}{3in}
One contiguous chunk.
\end{minipage}

\begin{minipage}{3in}
Another contiguous chunk.
\end{minipage}
Run Code Online (Sandbox Code Playgroud)

  • 如果您希望与文档的其余部分保持相同的宽度,也可以使用 `\textwidth` 作为 minipage 的必需参数:`\begin{minipage}{\textwidth}` (4认同)