I use minipage
as a way to prevent page break in the middle of something. Most of the time, it is for preventing page break in middle of some "small" enumerated list as it looks ugly to have enumerated list start on one page and continue to the next.
I tried other solutions such as How to prevent a page break before an itemize list? but that did not work for me, as I still got page break in middle of one enumerated list in my actual long document.
minipage
works for all cases, but I have small problem. It makes the enumerated list look "bad". Spacing is lost above and below (even though I have empty line before and after the minpage) and the whole list is shifted more to the right more now than before, which is not good.
Here is a MWE, with and without minipage showing the effect.
My question is what to do to keep the enumerated list looking the same as when not using minipage, but still use minipage to prevent page breaks? I prefer solution that uses minipage instead of having to fix the enumerated list itself, as I use minipage for other things where I do not want page break in the middle of, and not just for lists. longtime ago I used to use samepage
package, but I had some issues and I stopped using it.
Using minipage
Not using minipage (better formatted)
Code
\documentclass[12pt]{article}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amstext}
\usepackage{amsmath}
\usepackage{xspace}
\usepackage{theorem}
\begin{document}
Knowing the order of the poles of $r$ and $\mathcal{O}(\infty)$ is all what
is needed to determine the necessary conditions for each case. These conditions are
the following
\begin{minipage}{\textwidth}
\begin{enumerate}
\item Case $1$. Either no pole exists, or if poles exist, the order must be either one or even.
If $\mathcal{O}(\infty)$ is less $3$, then it must be even otherwise it can be even or odd.
\item Case $2$. $r$ must have at least one pole which is either of order 2 or odd order greater than 2.
There are no conditions on $\mathcal{O}(\infty)$.
\item Case $3$. $r$ must have a pole of either order $1$ or $2$. No other order is allowed.
$\mathcal{O}(\infty)$ must be at least $2$.
\end{enumerate}
\end{minipage}
If the conditions for each case are not satisfied then there is no need to try that
case as there will be no Liouvillian solution to the DE.
\end{document}
This is screen shot from my actual document showing case where enumerated list spans one page when not using minipage