This question already has an answer here:

Given a macro

% bold task titles
\newcommand{\mypar}[1]{{\bf #1:}}

%task decription template
    \mypar{#1} #2 \\
    \emph{Solution:} #3\\

I should like for the text generated by a task macro to be an atomic unit. I.e. it either fits entirely into the space left on a page or all of it (and everything following it) is pushed to the next page.

What can I do to this macro to enforce this?

marked as duplicate by Henri Menke, Community Jan 26 '16 at 8:58

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Enclose it in \begin{samepage}...\end{samepage}. – Henri Menke Jan 26 '16 at 8:37
  • Nope, that doesn't do anything, I'm afraid. – User1291 Jan 26 '16 at 8:46