Page LayoutProblems Preventing Page Breaks

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
JohnSmith4242
Posts: 1
Joined: Thu Nov 24, 2011 3:47 pm

Problems Preventing Page Breaks

Post by JohnSmith4242 »

It seems the line I need is \nopagebreak is the command I need, but it doesn't work. Here is the situation

I have longtable and some header text that precedes it. I need to make sure the header text and the longtable are on the same page. So I just need to make sure that a new page is not started after my header text.

\nopagebreak has no effect for some reason

using a minipage will not work because it will not allow the longtable to function properly. I only want the table and text moved to a new page if there isn't room for any table rows, if Latex can fit any part of the table on the page, then it should.

Order is important, so no floats.
Attachments
prevent-page-break2.tex
In this document Latex should move the Section Header text to the next page
(374 Bytes) Downloaded 194 times
prevent-page-break.tex
This document renders correctly, but wouldn't if I used minipage.
(391 Bytes) Downloaded 191 times

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Problems Preventing Page Breaks

Post by Stefan Kottwitz »

Hi John,

the needspace package can help. It provides the command \needspace which checks if there's sufficient available space, as specified by you, and inserts a pageb reak if necessary.

Perhaps have a look at Prevent page breaks for further information.

Stefan
LaTeX.org admin
Post Reply