I want to have equations with item lists as part of a paragraph such that there is no page break between the equation and the item list, but there can be a page break in the middle of the paragraph.
Currently I am using:
\def\formula#1#2{
\begin{samepage}
\begin{align}
#1
\end{align} where
\begin{itemize}
#2
\end{itemize}
\end{samepage}
}
For example used like The formula is given by: \formula{f(x)=x^2}{\item $x$ is some variable}
.
However, this seems to cause the whole paragraph it is used in not to have a page break.
I've tried using the minipage
environment, but that causes the minipage to start where the line ended; it is shifted to the right so that part of the sentence after which the formula started was printed to its left. Introducing a line break (\\*
) between the sentence and the formula then causes errors, since I sometimes do use the command as a separate paragraph, in which case there is no line to end.
I've also tried \nopagebreak[4]
, but that didn't seem to do anything at all.
How can I keep the equation and the itemize on the same page without necessarily having the whole paragraph on that page as well?
Best Answer