1

multicols environment of multicol package produces page break in starred version. How can we prevent this page break?

\documentclass{book}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{multicol}
\begin{document}
    \begin{proof}
        \begin{enumerate}
            \begin{multicols*}{4}
                \item First
                \columnbreak
                \item Second
                \columnbreak
                \item Third
                \columnbreak
                \item Fourth
            \end{multicols*}
        \end{enumerate}
    \end{proof}
Can you help me to stay in the same page?
\end{document}
  • You are putting the multicols* environment inside a nested list environment. Moving it out helps a bit, but not much. Really, I don't think you should be trying to use multiple columns here. It really doesn't make any sense. What are you actually trying to do? – cfr Oct 11 '16 at 1:28
  • If you must use multicols, why can't you just use \begin{multicols}{4} \begin{proof} \begin{enumerate} \item First \item Second \item Third \item Fourth \end{enumerate} \end{proof} \end{multicols} Can you help me to stay in the same page? ? – cfr Oct 11 '16 at 1:33
  • @cfr This is just an illustrating example to show the issue! In my real work, each item is an answer to a small exercise of linear equation. To demonstrate a step by step solution, the answer is written downward. Since the width of solution content is too short, I decided to put them into four columns. Additionally, each solution length is not equal, I chose starred-version of multicols. – Say OL Oct 11 '16 at 2:01
  • If you are using \columnbreak, why do you need the *? Anyway, I really wouldn't use multiple columns here. – cfr Oct 11 '16 at 2:24
  • 2
    both enumerate and proof are list environments which allow a page break after the environment so multicols (which was never designed to be nested in such a place anyway) really has very little control over the page breaking after \end{proof} You could always put all the text that needs to stay together in a minipage – David Carlisle Oct 11 '16 at 9:12
1

Note that the first line of the proof is shorter than others due to the proof name. You need to decide whether to put the minipage on the first line or not. If yes, use the calculated width for the minipage. If no, use \strut\newline for the first line.

\documentclass{book}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{multicol}
\usepackage{showframe}

\newlength{\tempdima}

\begin{document}
    \begin{proof}%
      \settowidth{\tempdima}{\textit{Proof}.}%
      \rule{\dimexpr \linewidth-\tempdima-\labelsep}{1pt}\linebreak
      \begin{minipage}{\linewidth}
        \begin{enumerate}
          \begin{multicols*}{4}
            \item First
            \columnbreak
            \item Second
            \columnbreak
            \item Third
            \columnbreak
            \item Fourth
          \end{multicols*}
        \end{enumerate}
      \end{minipage}
    \end{proof}
\noindent Can you help me to stay in the same page?
\end{document}

demo

  • \struct\newline seems look better :) – Say OL Oct 11 '16 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.