我有一个文档,其中显示的方程式经常在使用创建的环境之后立即出现幻想VRB包。如何防止中间出现分页符?
\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage{mathtools}
\usepackage{fancyvrb}
\DefineVerbatimEnvironment{code}{Verbatim}{commandchars=\\\{\},}
\begin{document}
\rule{1pt}{467pt}
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
\begin{code}
Int( x^2 , x ) ;
\end{code}
% *** Don't break here! ***
\begin{equation*}
\int x^2 \, \mathrm{d} x
\end{equation*}
\end{document}
答案1
答案2
\setbox0=\vbox{
这样够了吗?我用...把牢不可破的东西围起来}\box0
。
\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage{mathtools}
\usepackage{fancyvrb}
\DefineVerbatimEnvironment{code}{Verbatim}{commandchars=\\\{\},}
\usepackage{needspace}
\begin{document}
\rule{1pt}{467pt}
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
\setbox0=\vbox{%
\begin{code}
Int( x^2 , x &%$$\{\}[])^&# ;
\end{code}
% *** Don't break here! ***
\begin{equation*}
\int x^2 \, \mathrm{d} x
\end{equation*}
}\box0
\end{document}