Longtable 超出页面长度

Longtable 超出页面长度

我的长表超出了页面长度。任何帮助都将不胜感激。

\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}

答案1

此答案是为了回答 OP 在之前的评论中提出的一些问题而发布的。此帖子的主要目的是演示可以使用环境或longtable/table环境创建完全相同的“短”表布局,即适合单个页面的表tabular

当您比较代码中的差异时,您会注意到每种类型在运行所需的“开销”方面都有一些优点和缺点。例如,需要longtable您认真提供表格第一页(最后一页)和其余页面的页眉和页脚格式。当然,您只需为环境提供一次此信息tabular。但是,对于环境,tabular您需要记住提供指令\centering以防您希望材料居中,并且您需要记住提供[h]放置说明符以覆盖 LaTeX 的浮动放置算法。相比之下,longtable环境将始终尝试“从这里”开始,即[h]内置说明符。

最后,我认为表格创建开销的差异不应该决定您使用哪种表格。相反,假设表格适合一页,您应该决定是否允许将表格的内容跨页拆分。如果应该将它们放在一起,您应该不是longtable无论如何都要使用环境。

\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}

在此处输入图片描述

答案2

您应该尝试提供最小工作示例 (MWE),而不是完整的序言和内容。另请参阅上面 @hakaze 的评论。

[htbp]但是,你应该为环境提供放置选项figure,以便 LaTeX 可以方便地放置你的图形。使用\begin{figure}[htbp],你的问题就可以解决了。

\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}

相关内容