# Word breaking for two sentences

I have written following command:

\newcommand{\ger}[2]{{\noindent\raisebox{-0.2mm}
{\includegraphics[width=5.47mm,height=3.28mm]{Flag_1.pdf}}
\color{red} #1\nopagebreak\\\raisebox{-0.2mm}{\includegraphics{pol.pdf}}
\color{blue} \emph{#2}}\vspace{5pt}}


This is going to be used as follows:

\ger{First sentence}{Second sentence}


Question is, how to assert that these two sentences will be always on the same page with full content (there won't be any page breaks)? I tried to use \nopagebreak, but it still breaks sometimes part of the second sentence.

-

Instead of \\ you can use \par\nobreak to prevent page breaks:

\newcommand{\ger}[2]{{\noindent\raisebox{-0.2mm}
{\includegraphics[width=5.47mm,height=3.28mm]{Flag_1.pdf}}
\color{red} #1\par\nobreak\noindent\raisebox{-0.2mm}{\includegraphics{pol.pdf}}
\color{blue}\emph{#2}}\vspace{5pt}}

-

One solution is to put the whole thing in a \minipage, and make that mini page a float.

Edit

Per request, an example:

\newcommand{\ger}[2]{%
\begin{figure}
\begin{minipage}{\textwidth}
\noindent
\raisebox{-0.2mm}{\includegraphics[width=5.47mm,height=3.28mm]{Flag_1.pdf}}
\color{red}{#1}\\
\raisebox{-0.2mm}{\includegraphics{pol.pdf}}
\color{blue}{\emph{#2}}
\end{minipage}
\end{figure}}


You may want to add a \caption and a \label as well.

-
I think this is the simpler, cleaner solution as a concept, but I'm not going to vote it up, unless you'd like to provide sufficiently simple example code... –  Brent.Longborough Jun 17 '11 at 10:24
@Brent: Example code added. –  David Hammen Jun 19 '11 at 11:02
why a float? –  egreg Jun 19 '11 at 11:09
@egreg: A float isn't essential here. However, my experience is that tall boxes/minipages often create overfull/underfull vbox problems. At least in my usage, those tall boxes/minipages almost always result from describing something graphically or tabularly: A figure or a table. –  David Hammen Jun 19 '11 at 11:21
+1 as promised... –  Brent.Longborough Jun 19 '11 at 17:21