Graphics, Figures & TablesThe content of the table exceeds the length of the page

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
NELLLY
Posts: 113
Joined: Thu Nov 26, 2009 2:21 am

The content of the table exceeds the length of the page

Post by NELLLY »

Hi
I need to put 48 lines at the same table. When I use

Code: Select all

\renewcommand{\baselinestretch}{1}
\setlength{\tabcolsep}{0.5cm}
\begin{table}[H]
\begin{center}
\caption{
\begin{tabular}{ccccccc}\hline

Contents

\end{tabular}
\end{center}
\end{table}
the contents of the table exceeds the length of the page. Is there a solution?

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

The content of the table exceeds the length of the page

Post by Stefan Kottwitz »

Hi,

you could use the longtable package, which allows page breaks in tables and provides some useful features for that.

There are further packages for this purpose, such as supertabular, xtab, stabular, ltxtable and ltablex. You can read about that in short in the section Generating multi-page tables in Creating tables with LaTeX.

Stefan
LaTeX.org admin
NELLLY
Posts: 113
Joined: Thu Nov 26, 2009 2:21 am

Re: The content of the table exceeds the length of the page

Post by NELLLY »

Hi
I rewrite my table with longtable. But now, the caption of the table takes two lines instead of one and I need the columns to be larger. What can I do?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

Re: The content of the table exceeds the length of the page

Post by Stefan Kottwitz »

Perhaps somebody can tell you that if you would post the code of your longtable, of course without real contents - in a compilable example. Who might know how you write captions or columns.

Stefan
LaTeX.org admin
NELLLY
Posts: 113
Joined: Thu Nov 26, 2009 2:21 am

The content of the table exceeds the length of the page

Post by NELLLY »

Hi
Below the code

Code: Select all


\renewcommand{\baselinestretch}{1}
\begin{center}
\begin{longtable}{ccccccc}
\caption{}\label{ }\\ \hline
~~&1&$2$3&4&5&6\\\hline
\endfirsthead
\multicolumn{7}{c}%
{\tablename\ \thetable\ -- \textit{Continued from previous page}} \\
\hline
 ~~&X&Y&Z&A&B&C$\\
\hline
\endhead
\hline \multicolumn{7}{r}{\textit{Continued on next page}} \\
\endfoot
\hline
\endlastfoot
 
CONTENTS OF THE TABLE
 
\end{longtable}
\end{center}


wish this help.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

The content of the table exceeds the length of the page

Post by Stefan Kottwitz »

Hi,

I recommended to post a compilable example. This code
  • is not compilable
  • does not show the used document class
  • does not show page dimensions etc.
  • does not show used packages (longtable? caption? multicol? ..) and options
so it's not possible to test and to fix. I guess you will understand that I use my time to solve problems where users provide information. See you in another topic, if it's clear of if there's a complete example.

Stefan
LaTeX.org admin
NELLLY
Posts: 113
Joined: Thu Nov 26, 2009 2:21 am

The content of the table exceeds the length of the page

Post by NELLLY »

Hi
Sorry for the incompletness

Code: Select all

\documentclass [12pt]{report}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setlength{\topmargin} {-3cm} \setlength{\headheight} {1.5cm}
\setlength{\headsep} {1cm} \setlength{\oddsidemargin} {1cm}
\setlength{\textheight} {21cm} \setlength{\textwidth} {15cm}
\renewcommand{\baselinestretch}{1.5}
%\makeatletter
%\renewcommand*\l@section{\@dottedtocline{1}{0em}{2.3em}}
%\renewcommand*\l@subsection{\@dottedtocline{2}{0em}{3.2em}}
%\makeatother
\setcounter{tocdepth}{4} \setcounter{secnumdepth}{3}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[pdftex]{graphicx}
\usepackage[T1]{fontenc}
\usepackage{titlesec}
\usepackage{titletoc}
%\usepackage{fancychapters}
\usepackage[Lenny]{fncychap}
\usepackage{lettrine}
\usepackage{dropping}
\usepackage{float}
\usepackage{tabularx}
\usepackage{rotating}
\usepackage{amsmath}
\usepackage{longtable}
\usepackage{booktabs}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{fancyhdr}
\pagestyle{fancy}

\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\fancyhf{} \fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
\renewcommand{\headrulewidth}{0.5pt}
\addtolength{\headheight}{0.5pt}
\renewcommand{\footrulewidth}{0pt}

\fancypagestyle{plain}{%
  \fancyhead{}
  \renewcommand{\headrulewidth}{0pt}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%





\begin{document}

\makeatletter
\renewcommand{\fnum@figure}{\small\textit{\figurename~\thefigure}}
\makeatother
\title{XYZ}

\tableofcontents %\pagestyle{myheadings}
 \hyphenpenalty 10000
\listoftables
\listoffigures
%%%%%%%%%%%%%%My Lenny style%%%%%%%%
\ChNameVar{\fontsize{14}{6}\usefont{OT1}{phv}{m}{n}\selectfont\rm\bfseries}
\ChNameUpperCase
\ChNumVar{\fontsize{60}{62}\usefont{OT1}{ptm}{m}{n}\selectfont}
\ChTitleVar{\itshape\Huge\bfseries\center} \ChRuleWidth{2pt} %\rm

\begin{center}
\begin{longtable}{ccccccc}
\caption{XXX}\label{ XXX}\\ \hline
~~&xxx&$x^*$&$x^*$&$x^*$&$x^*$&$xx^*$\\\hline
\endfirsthead
\multicolumn{7}{c}%
{\tablename\ \thetable\ -- \textit{Continued from previous page}} \\
\hline
 ~~&XYZ&$X^*$&$XYZ^*$&$X^*$&$Z^*$&$XY^*$\\
\hline
\endhead
\hline \multicolumn{7}{r}{\textit{Continued on next page}} \\
\endfoot
\hline
\endlastfoot
 ~~&1&11&1&1&11&11.11\\
 ~~&1&11&1&1&11&111.11\\
 ~~&1&11&1&1&1.11&111.11\\
 ~~&1&11&1&1&11.11&111.11\\

\end{longtable}
\end{center}


\end{document}

Post Reply