# All-or-nothing placing of macro-generated text [duplicate]

This question already has an answer here:

Given a macro

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

\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

• Enclose it in \begin{samepage}...\end{samepage}. – Henri Menke Jan 26 '16 at 8:37