GeneralNewbie question about pagebreaks

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
ronanj
Posts: 3
Joined: Wed Nov 12, 2008 12:52 pm

Newbie question about pagebreaks

Post by ronanj »

Hi all,
I'm a newbie to latex and have been plugging away for about 3 weeks.
I have an issue where I want to ensure that some sections of text do not have a page break in them.
How can I force them on to a new page? I know I can add a page break before the section, but I want this to be done automatically at build time, i.e. the latex builder sees that there is a page break in this section of text and then moves the entire section to a new page.
Is this possible? If so how can I do it? Or I am I going about this the wrong way?
I suppose it's some sort of global document setting I'm looking for.

R

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

dmt
Posts: 82
Joined: Sat Mar 15, 2008 8:13 pm

Newbie question about pagebreaks

Post by dmt »

I've had this problem a lot myself. I have found the samepage environment useful here (though there are apparently other ways to do this as well.

You can do something like this I think:

Code: Select all

\begin{samepage}
lots of stuff that 
should stay together
\end{samepage}
ronanj
Posts: 3
Joined: Wed Nov 12, 2008 12:52 pm

Newbie question about pagebreaks

Post by ronanj »

Thanks for the info. But it doesn't work for me.
Here's what I'm trying

Code: Select all

\begin{samepage}
\hypertarget{thislink}{
\index{index1}
\index{index2}
\paragraph[{Text}]{\setlength{\rightskip}{0pt plus 5cm}\texttt{text}( {\em text})}\hfill}
\label{thislabel}
Blah blah
\begin{Desc}
\item[\texttt{text}]
\begin{description}
\item[\mbox{$\leftarrow$} {\em sec}]Float \end{description}
\end{Desc}
\begin{Desc}
\item[\texttt{text}]None 
\begin{Code}\begin{verbatim}  
Blah Blah
 \end{Desc}
\begin{Desc}
\item[]
Blah
\end{Desc}
\end{samepage}
This occurs at the end of a page and becomes split just after the index.
When I put the code in the samepage env nothing happened
User avatar
Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

Newbie question about pagebreaks

Post by Stefan Kottwitz »

Hi Ronanj,

the needspace package provides commands that could help. The documentation is contained in needspace.sty itself.

Stefan
LaTeX.org admin
ronanj
Posts: 3
Joined: Wed Nov 12, 2008 12:52 pm

Re: Newbie question about pagebreaks

Post by ronanj »

thanks.
That does exactly what i want.

R
Post Reply