tags:

views:

186

answers:

2

I'm trying to create a LaTex document which has a "testday" and a verse full of "testItemToDo" and I want any page break to occur before the "testday" but never between a "testday" and the verse of "testItemToDo". How can I modify my LaTex file

\documentclass{article}
\begin{document}
\LARGE
{*}{*}to do\\
\begin{verse}
{*}today\nopagebreak
\begin{verse}
testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo
\end{verse}
{*}testDay\nopagebreak
\begin{verse}
testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo
\end{verse}
{*}testDay\nopagebreak
\begin{verse}
testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo
\end{verse}
{*}testDay\nopagebreak
\begin{verse}
testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo
\end{verse}
{*}testDay\nopagebreak
\begin{verse}
testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo
\end{verse}
\end{verse}
\end{document}
A: 

\nopagebreak[number]

The \nopagebreak command prevents LaTeX form breaking the current page at the point of the command. With the optional argument, number, you can convert the \nopagebreak command from a demand to a request. The number must be a number from 0 to 4. The higher the number, the more insistent the request is.

Or you can change your verse to a minipage... though if the list is longer than a page, latex will probably puke.

Mica
+2  A: 

Surround your testday and verse with a \begin{samepage} and \end{samepage}, i.e.:

\begin{samepage}
{*}testDay
\begin{verse}
testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo\\*testItemToDo
\end{verse}
\end{samepage}

This still allows the verse to break a page fine, provided you get rid of some \\*.

Ramashalanka