# How to hold all lines in a defined environment? [duplicate]

\def\Grammercaption{\textbf{Grammer}}
\def\grammer{\bgroup\ignorespaces\Grammercaption\fontsize{10}{13pt}\selectfont}
\def\grammer{\egroup}


I want all lines of text within this environment stick together. So that no page break is issued here.

## marked as duplicate by lockstep, Mensch, clemens, Martin Schröder, WernerFeb 15 '13 at 18:47

• You might be after something like \newenvironment{grammer}{\noindent\minipage{\linewidth}\Grammercaption\fontsize{10}{13pt}\selectfont}{\endminipage} that you can then use as \begin{grammer}...\end{grammer}. – Werner Dec 6 '12 at 6:43
• I also recommend using the minipage environment. You may have to tweak the \parindent setting inside the minipage environment because minipage sets it to opt. – user10274 Dec 6 '12 at 6:50