我尝试做的事情可能与 MS Word 中的“与下一个/上一个保持同步”非常相似。我有一个连续两行的公式及其描述。如果这两行不能在同一页,我希望它们移至下一页。
\begin{equation}
Incoming\ Radiation, F_\lambda = S_\lambda.\cos \phi
\label{eq:SolSpecIrrad}
\end{equation}
Where $\phi$ is the solar zenith angle. % This line is getting pushed
% to the next page, as the equation is the last
% thing on the previous page.
答案1
您可以将其放入minipage
,或使用samepage
-package。我在这里添加了mathtools
-package,我建议您使用它。正如 David Carlisle 所评论的那样,您不应该在数学环境中拼出完整的单词,因为每个单独的字母都将排版为变量。您可以将它们放入\text{Word}
。
代码
\documentclass[11pt]{article}
\usepackage{mathtools}
\begin{document}
\vspace*{17.5cm}
\noindent\begin{minipage}{\textwidth}
\begin{equation}
\text{Incoming Radiation}, F_\lambda = S_\lambda.\cos \phi
\label{eq:SolSpecIrrad}
\end{equation}
Where $\phi$ is the solar zenith angle.
\end{minipage}
\end{document}
答案2
\postdisplaypenalty
对于特殊情况,设置为 10000:
\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{lipsum} % just for the example
\newcommand{\commentedequationtext}{} % initialize
\newenvironment{commentedequation}[1]
{\renewcommand\commentedequationtext{#1}%
\postdisplaypenalty=10000
\equation}
{\endequation\commentedequationtext}
\begin{document}
\vspace*{6\baselineskip}
\lipsum[1-3]
\begin{commentedequation}{where $\phi$ is the solar zenith angle.}
\label{eq:SolSpecIrrad}
\text{Incoming Radiation:}\quad F_\lambda = S_\lambda\cdot\cos \phi
\end{commentedequation}
\end{document}
您将会看到,如果5\baselineskip
使用,则等式将出现在第 1 页。
答案3
我已经设法用嵌套来做你需要的事情tcolorbox
。我用红色画只是为了演示一个很长的等式,里面的白色背景区域是描述框。
\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{breakable}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{lipsum}
\begin{document}
\begin{tcolorbox}[colframe=red,colback=red!10,breakable,
]
\begin{equation}
Incoming\ Radiation, F_\lambda = S_\lambda.\cos \phi
\label{eq:SolSpecIrrad}
\end{equation}
\lipsum[1]
\lipsum[2-4]
Equation stuff, equation stuff, equation stuff, equation stuff, equation stuff, equation stuff, equation stuff,
\begin{tcolorbox}[boxsep=0mm,left=0mm,width=\linewidth,boxrule=0pt,arc=0pt]
Where $\phi$ is the solar zenith angle. % This line is getting pushed
% to the next page, as the equation is the last
% thing on the previous page.
Description, description, description, description, %description, description, description
\end{tcolorbox}
\end{tcolorbox}
\lipsum[7]
\end{document}