Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

My longtable exceeds the page length. Any help would be highly appreciated.

\documentclass[11pt,a4paper,oneside]{report}

\usepackage{fontenc}
\usepackage{setspace}
\usepackage{array}
\usepackage{covington}
\usepackage{pslatex}
\usepackage{float}
\usepackage{longtable}
\usepackage{booktabs}
\newcolumntype{R}{>{\raggedleft\arraybackslash}p{2cm}}
\usepackage{tocvsec2}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{colortbl}
\setlength{\evensidemargin}{1.96cm}
\setlength{\topmargin}{3.5 cm}
\setlength{\headheight}{1.36cm}
\setlength{\headsep}{1.00cm}
\setlength{\textheight}{20.84cm}
\setlength{\textwidth}{14.5cm}
\setlength{\marginparsep}{1mm}
\setlength{\marginparwidth}{3cm}
\setlength{\footskip}{2.36cm}
\usepackage{graphicx}
\usepackage{titlesec}
\usepackage[bottom,norule]{footmisc}
\usepackage[tableposition=t]{caption}
\usepackage[danish,english]{babel}
\usepackage{natbib}
\bibpunct{(}{)}{,}{a}{}{,}
\usepackage[a4paper]{geometry}
\geometry{top=4cm, bottom=3.5cm, left=5cm, right=3.5cm}
\footskip = 30pt
\renewcommand{\bibname}{References}
\usepackage[toc,page]{appendix}
\usepackage{longtable}
\usepackage[hidelinks]{hyperref}
\usepackage{bookmark}
\usepackage[bitstream-charter]{mathdesign}
\usepackage[T1]{fontenc}
\usepackage{multirow}
\usepackage{lscape}


\begin{document}

\newpage
\chapter{Data Collection}

\section{California Cities Selected and Represented in the Present Study}

\subsection{Cities Selection Method}

Northern California includes forty-eight counties, thirty-eight of which are represented in this study (see following sections for a complete list of included counties). 

Alpine County, Colusa County, Inyo County, Mariposa County, Modoc County, Mono County, Napa County, Plumas County, Sierra County, and Sutter County are not represented in this study.
In fact, we could not find online newspapers based in those counties that were suitable for the present research.

\newpage
\subsection{The North Coast Region}

\begin{figure}
\centering
\rule{4.88in}{4in}\caption{Map of the North Coast Region.\label{fig:North Coast Region}}

\end{figure}

The North Coast of California is a rural area that stretches on the Pacific coast from San Francisco Bay north to the Oregon border and includes Del Norte, Humboldt, Trinity, and Mendocino counties. Within the region there is no city with a population of over 100,000. 

According to Bright (1971), in 1870 the population of the North Coast region included eleven percent of immigrants from New York, nine percent from Missouri; three percent from Maine; and two percent from Ohio (see Appendix for details).

%(White \%, Black or African American \%, Hispanic or Latino \%, Asian \%, Other \%). The median age of the population in Del Norte County is - years old. 

\begin{longtable}{l r l r r}
\caption{Description of the Counties in the The North Coast Region\label{Description of the Counties in the The North Coast Region}}\\
\toprule
\textsc{County}&\textsc{Founded}&\textsc{Seat}&\textsc{Area (sqm)}&\textsc{Pop 2010}\\
\midrule
\endfirsthead
\caption[]{(continued)}\\
\toprule
\textsc{County}&\textsc{Founded}&\textsc{Seat}&\textsc{Area (sqm)}&\textsc{Pop 2010}\\
\midrule
\endhead
\bottomrule
\endlastfoot
Del Norte&1857&Crescent City&1,008&7,643\\ 
Humboldt&1853&Eureka&3,573&27,191\\ 
Lake&1861&Lakeport&1,258&4,753\\
Mendocino&1850&Ukiah&3,509&16,075\\
Trinity&1850&Weaverville&3,179&3,600\\  
\end{longtable}

\begin{longtable}{l l l}
\caption{Coverage for The North Coast Region\label{Coverage for The North Coast Region}}\\
\toprule
\textsc{County Name}&\textsc{City}&\textsc{Online Newspaper}\\
\midrule
\endfirsthead
\caption[]{(continued)}\\
\toprule
\textsc{County Name}&\textsc{City}&\textsc{Online Newspaper}\\
\toprule
\endhead
\bottomrule
\endlastfoot
Del Norte&Crescent City&Daily Triplicate\\ 
Humboldt&Eureka&Eureka Times-Standard\\ 
Lake&Lakeport&Lake County News\\
Mendocino&Ukiah&Ukiah Daily Journal\\
&Willits&Willits News\\ 
Trinity&Weaverville&Trinity Journal\\
\end{longtable}

\end{document}
share|improve this question
1  
Please make a minimal working example out of this! From a quick glance I spot that you load fontenc and longtable twice. Also you manually specify margins only to overwrite these values by \geometry. Less is more! ;) –  hakaze Aug 9 '12 at 12:57
1  
I have a question about the design of your tables: Both tables are fairly short, and I can't see a reason for spreading either table's contents across two pages. Have you considered using the table environment (and some tabular environment) instead of longtable? Separately, instead of \caption[]{(continued)}, you should probably write something like \multicolumn{3}{l}{(continued)}. –  Mico Aug 9 '12 at 14:23
    
@hakaze: thanks, I have fixed tha (in my file). –  Costanza Aug 9 '12 at 17:48
1  
@Costi - longtable environments are meant to be used for tables that are, well, too long to fit on a single page; as you can appreciate, there's considerable overhead involved in creating the page breaks that may occur. Ordinary table environments have the virtue (possibly a curse) of always being typeset on a single page. In cases such as the ones represented by your tables, I can't see any reason for ever letting the tables be split across pages. It's actually much easier to define table rather than longtable environments. Give it a try. –  Mico Aug 9 '12 at 19:10
1  
@Costi: I've posted an answer that addresses some of the questions you've posed. As you'll see, there's no reason why the material in a short table has to look different depending on whether it's typeset with a longtable environment or a table/tabular pair of environments. My suggestion is that if a table is short and if its contents should not ever be broken up across pages, then you should definitely want to use the table/tabular pair of environments. –  Mico Aug 10 '12 at 2:38
show 2 more comments

2 Answers

up vote 1 down vote accepted

This answer is posted in response to some questions the OP posted to earlier comments. The main point of this posting is to demonstrate that it's possible to create the exact same layout of a "short" table, i.e., one that fits on a single page, using either the longtable environment or the table/tabular environments.

As you compare the differences in code, you'll notice that the each type has some advantages and some disadvantages in terms of "overhead" that's needed to get it going. For instance, a longtable requires you to be diligent about providing formats for the table's headers and footers for both the first (last) page and for the remaining pages. Of course, you only need to provide this information once for a tabular environment. However, for a tabular environment you need to remember to provide the \centering instruction in case you want the material centered, and you need to remember to provide a [h] placement specifier if you want to override LaTeX's float placement algorithm. In contrast, a longtable environment will always try to start "right here", i.e., a [h] specifier is built in.

In the end, I don't think differences in table-creating overhead should determine whether you use one form or the other. Rather, assuming the table fits on a single page, you should decide whether the material of the table should be allowed to be broken across pages or not. If it's supposed to be kept together, you should not use a longtable environment in any case.

\documentclass[11pt,a4paper,oneside]{report}
\usepackage[a4paper,margin=1in]{geometry}
\usepackage{longtable,booktabs}
\setlength\belowcaptionskip{1\baselineskip} % or whatever is required
\begin{document}
\begin{longtable}{l r l r r}
\caption{Description of Counties in North Coast Region} \label{tab:description1}\\
\toprule
\textsc{County}&\textsc{Founded}&\textsc{Seat}&\textsc{Area (sqm)}&\textsc{Pop 2010}\\
\midrule
\endfirsthead
\multicolumn{3}{l}{(continued)}\\
\toprule
\textsc{County}&\textsc{Founded}&\textsc{Seat}&\textsc{Area (sqm)}&\textsc{Pop 2010}\\
\midrule
\endhead
\bottomrule
\endlastfoot
Del Norte&1857&Crescent City&1,008&7,643\\ 
Humboldt&1853&Eureka&3,573&27,191\\ 
Lake&1861&Lakeport&1,258&4,753\\
Mendocino&1850&Ukiah&3,509&16,075\\
Trinity&1850&Weaverville&3,179&3,600\\  
\end{longtable}

\begin{table}[h]
\caption{Description of Counties in North Coast Region} \label{tab:description2}
\centering
\begin{tabular}{l r l r r}
\toprule
\textsc{County}&\textsc{Founded}&\textsc{Seat}&\textsc{Area (sqm)}&\textsc{Pop 2010}\\
\midrule
Del Norte&1857&Crescent City&1,008&7,643\\ 
Humboldt&1853&Eureka&3,573&27,191\\ 
Lake&1861&Lakeport&1,258&4,753\\
Mendocino&1850&Ukiah&3,509&16,075\\
Trinity&1850&Weaverville&3,179&3,600\\  
\bottomrule
\end{tabular}
\end{table}

%% second table

\begin{longtable}{l l l}
\caption{Coverage for the North Coast Region}
\label{tab:coverage1}\\
\toprule
\textsc{County Name}&\textsc{City}&\textsc{Online Newspaper}\\
\midrule
\endfirsthead
\multicolumn{3}{l}{(continued)}\\
\toprule
\textsc{County Name}&\textsc{City}&\textsc{Online Newspaper}\\
\toprule
\endhead
\bottomrule
\endlastfoot
Del Norte&Crescent City&Daily Triplicate\\ 
Humboldt&Eureka&Eureka Times-Standard\\ 
Lake&Lakeport&Lake County News\\
Mendocino&Ukiah&Ukiah Daily Journal\\
&Willits&Willits News\\ 
Trinity&Weaverville&Trinity Journal\\
\end{longtable}

\begin{table}[h]
\caption{Coverage for the North Coast Region}
\label{tab:coverage2}
\centering
\begin{tabular}{ l l l }
\toprule
\textsc{County Name}&\textsc{City}&\textsc{Online Newspaper}\\
\midrule
Del Norte&Crescent City&Daily Triplicate\\ 
Humboldt&Eureka&Eureka Times-Standard\\ 
Lake&Lakeport&Lake County News\\
Mendocino&Ukiah&Ukiah Daily Journal\\
&Willits&Willits News\\ 
Trinity&Weaverville&Trinity Journal\\
\bottomrule
\end{tabular}
\end{table}
\end{document}

enter image description here

share|improve this answer
    
I've done that, but now my pages are messed up. The figures don't go where I placed them, and even the command \newpage does not work. –  Costanza Aug 10 '12 at 6:25
    
@Costi - see tex.stackexchange.com/a/66237/5001 for a suggestion for how to force LaTeX to always force a float to be placed immediately, i.e., to basically not treat it as a "float" at all. Separately, what do you mean by \newpage does not work? Do you mean, "I can't force LaTeX to output the pending float, or floats"? If so, have a look at tex.stackexchange.com/q/45609/5001 for an examination of the differences between \newpage and \clearpage. –  Mico Aug 10 '12 at 10:32
add comment

You should try to provide a minimum working example (MWE) instead of your full preamble and content. Also the comments of @hakaze above.

However, you should provide the placement options [htbp] to the figure environment so as to enable LaTeX to conveniently place your figure. With \begin{figure}[htbp], your problem can be solved.

\documentclass[11pt,a4paper,oneside]{report}
\usepackage{fontenc}
\usepackage{setspace}
\usepackage{array}
\usepackage{longtable}
\usepackage{booktabs}
\newcolumntype{R}{>{\raggedleft\arraybackslash}p{2cm}}
\usepackage{graphicx}
\usepackage[a4paper]{geometry}
\geometry{top=4cm, bottom=3.5cm, left=5cm, right=3.5cm}
\footskip = 30pt

\begin{document}

\newpage
\chapter{Data Collection}

\section{California Cities Selected and Represented in the Present Study}

\subsection{Cities Selection Method}

Northern California includes forty-eight counties, thirty-eight of which are represented in this study (see following sections for a complete list of included counties).

Alpine County, Colusa County, Inyo County, Mariposa County, Modoc County, Mono County, Napa County, Plumas County, Sierra County, and Sutter County are not represented in this study.
In fact, we could not find online newspapers based in those counties that were suitable for the present research.

\newpage
\subsection{The North Coast Region}

\begin{figure}[htbp]
\centering
\rule{4.88in}{4in}\caption{Map of the North Coast Region.\label{fig:North Coast Region}}

\end{figure}

The North Coast of California is a rural area that stretches on the Pacific coast from San Francisco Bay north to the Oregon border and includes Del Norte, Humboldt, Trinity, and Mendocino counties. Within the region there is no city with a population of over 100,000.

According to Bright (1971), in 1870 the population of the North Coast region included eleven percent of immigrants from New York, nine percent from Missouri; three percent from Maine; and two percent from Ohio (see Appendix for details).

%(White \%, Black or African American \%, Hispanic or Latino \%, Asian \%, Other \%). The median age of the population in Del Norte County is - years old.

\begin{longtable}{l r l r r}
\caption{Description of the Counties in the The North Coast Region\label{Description of the Counties in the The North Coast Region}}\\
\toprule
\textsc{County}&\textsc{Founded}&\textsc{Seat}&\textsc{Area (sqm)}&\textsc{Pop 2010}\\
\midrule
\endfirsthead
\caption[]{(continued)}\\
\toprule
\textsc{County}&\textsc{Founded}&\textsc{Seat}&\textsc{Area (sqm)}&\textsc{Pop 2010}\\
\midrule
\endhead
\bottomrule
\endlastfoot
Del Norte&1857&Crescent City&1,008&7,643\\
Humboldt&1853&Eureka&3,573&27,191\\
Lake&1861&Lakeport&1,258&4,753\\
Mendocino&1850&Ukiah&3,509&16,075\\
Trinity&1850&Weaverville&3,179&3,600\\
\end{longtable}

\begin{longtable}{l l l}
\caption{Coverage for The North Coast Region\label{Coverage for The North Coast Region}}\\
\toprule
\textsc{County Name}&\textsc{City}&\textsc{Online Newspaper}\\
\midrule
\endfirsthead
\caption[]{(continued)}\\
\toprule
\textsc{County Name}&\textsc{City}&\textsc{Online Newspaper}\\
\toprule
\endhead
\bottomrule
\endlastfoot
Del Norte&Crescent City&Daily Triplicate\\
Humboldt&Eureka&Eureka Times-Standard\\
Lake&Lakeport&Lake County News\\
Mendocino&Ukiah&Ukiah Daily Journal\\
&Willits&Willits News\\
Trinity&Weaverville&Trinity Journal\\
\end{longtable}

\end{document}
share|improve this answer
    
Great! It works now. Is there anything else that looks weird in my preamble? –  Costanza Aug 9 '12 at 17:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.