Graphics, Figures & TablesSuppress page break before table

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
dadrivr
Posts: 8
Joined: Sat Sep 11, 2010 3:49 pm

Suppress page break before table

Post by dadrivr »

I have a large, horizontal table that spans multiple pages. LaTeX puts a page break before the table, but I don't want a page break. I want the text to fill the page before the table. I've tried \nopagebreak, but it doesn't work. How can I not allow a page break before the table and fill the page preceding the table with text? Here is a small example:

Code: Select all

\documentclass{article}

\usepackage{longtable}
\usepackage{threeparttablex}
\usepackage{lscape}
\usepackage{tabu}

\begin{document}

I do not want a page break here
\nopagebreak

\begin{landscape}
  \begin{ThreePartTable}
    \begin{longtabu}{X[l] X[l] X[l]} \hline 
    Column1 & Column2 & Column3   
    \end{longtabu}
  \end{ThreePartTable}
\end{landscape}

I want this text to go before the table

\end{document}

Recommended reading 2024:

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

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

tom
Posts: 73
Joined: Thu Apr 18, 2013 4:02 am

Suppress page break before table

Post by tom »

Hi!

The {landscape} environment will always add a page break. You can have sideways content in a portrait page using the rotating package. In that case, however, the table is not automatically broken at the margins. See example below.

Code: Select all

\documentclass{article}
\usepackage{blindtext, rotating}
\usepackage{longtable}
\usepackage{tabu}
\begin{document}
I do not want a page break here

\begin{sideways}
  \begin{minipage}{\linewidth}
    \begin{longtabu}{X[l] X[l] X[l]} \hline
      \blindtext&\blindtext&\blindtext\\
    \end{longtabu}
  \end{minipage}
\end{sideways}

I want this text to go before the table
\end{document}
Post Reply