表格对于一页来说太大

表格对于一页来说太大

我做了一个表格,但它太大了,无法在一页上显示。有人知道如何更改表格以使其适合吗?提前谢谢。

\documentclass[12pt]{article} 
\usepackage{geometry} 
\geometry{a4paper} 
\usepackage{eurosym}
\usepackage{graphicx} 
\usepackage{float} 
\usepackage{wrapfig} 
\usepackage{lipsum} 
\usepackage[applemac]{inputenc}   
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{pdflscape}
\usepackage{afterpage}
\usepackage{fancyref}
\renewcommand{\arraystretch}{1.5}
\linespread{1.2}

\begin{document}

\begin{table}[h!]
\centering
\begin{tabular}{||c | c | c||} 
 \hline
 Non-agricultural & Agricultural & Service \\ [0.5ex] 
 \hline\hline
 Fishing & Paddy rice & Electricity \\ 
 Coal & Wheat & Gas \\
 Oil & Cereal grains & Water \\
 Gas & Vegetables,fruits,nuts & Construction \\
 Minerals & Oil seeds & Trade \\
 Wool & Sugar cane/beet & Transport \\
 Textiles & Plant-based fibers & Sea transport \\
 Waring apparel & Crops nec & Air transport \\
 Leather products & Cattle,sheep,goats,horse & Communication \\
 Forestry & Animal products & Financial services nec \\
 Wood products & Raw milk & Insurance \\
 Paper products & Meat:cattle,sheep,goats,horse & Business services nec \\
 Petroleum,coal products & Meat products nec & Recreation and other services \\
 Chemical,rubber,plastic & Vegetable oils and fats & PubAdmin/Defence/Health/Educat \\
 Mineral products nec & Dairy products & Dwellings \\
 Ferrous metals  & Processed rice &  \\
 Metals nec & Sugar &  \\
 Metal products & Food products &  \\
 Motor vehicles/parts& Beverages and tobacco &  \\
 Transport equipment nec &  &  \\
 Electronic equipment&  &  \\
 Machinery and equipment nec &  &  \\
 Manufactures nec &  &  \\ [1ex] 
 \hline
\end{tabular}
\caption{Sector aggregation}
\label{table:1}
\end{table}

\end{document}

答案1

您的表格将轻松放在一页上 - 并在文本块的宽度之内 -如果您 (a) 让列的内容根据需要“换行”并且 (b) 省去指令\renewcommand{\arraystretch}{1.5}。 (实际上,即使重新定义,表格也会适合\arraystretch,但结果看起来不太好,IMNSHO。)

具体来说,我建议您使用tabularx环境而不是环境tabular,并利用booktabs包的线条绘制宏(已在您的示例中加载)。认真考虑省略表格中的所有垂直线:相信我,它们不会被遗漏,并且表格将具有更加开放的外观。

一个有用的技巧:使用\slash宏而不是硬编码/符号来允许在斜杠字符后换行(如果需要)。

在此处输入图片描述

\documentclass[12pt,a4paper]{article} 
\usepackage{geometry}
\usepackage{booktabs}
\usepackage{tabularx,ragged2e}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}

%% Commented out instructions not needed for this example
%\usepackage{eurosym}
%\usepackage{graphicx} 
%\usepackage{float} 
%\usepackage{wrapfig} 
%\usepackage{lipsum} 
%\usepackage[applemac]{inputenc}   
%\usepackage{pdflscape}
%\usepackage{afterpage}
%\usepackage{fancyref}
%\renewcommand{\arraystretch}{1.5}
%\linespread{1.2}

\begin{document}

\begin{table}
\begin{tabularx}{\textwidth}{@{}LLL@{}} 
 \toprule
 Non-agricultural & Agricultural & Service \\ 
 \midrule
 Fishing & Paddy rice & Electricity \\ 
 Coal & Wheat & Gas \\
 Oil & Cereal grains & Water \\
 Gas & Vegetables, fruits, nuts & Construction \\
 Minerals & Oil seeds & Trade \\
 Wool & Sugar cane\slash beet & Transport \\
 Textiles & Plant-based fibers & Sea transport \\
 Waring apparel & Crops nec & Air transport \\
 Leather products & Cattle, sheep, goats, horse & Communication \\
 Forestry & Animal products & Financial services nec \\
 Wood products & Raw milk & Insurance \\
 Paper products & Meat: cattle, sheep, goats, horse & Business services nec \\
 Petroleum, coal products & Meat products nec & Recreation and other services \\
 Chemical, rubber, plastic & Vegetable oils and fats & PubAdmin\slash Defence\slash Health\slash Educat \\
 Mineral products nec & Dairy products & Dwellings \\
 Ferrous metals  & Processed rice &  \\
 Metals nec & Sugar &  \\
 Metal products & Food products &  \\
 Motor vehicles\slash parts& Beverages and tobacco &  \\
 Transport equipment nec &  &  \\
 Electronic equipment&  &  \\
 Machinery and equipment nec &  &  \\
 Manufactures nec &  &  \\
 \bottomrule
\end{tabularx}
\caption{Sector aggregation}
\label{table:1}
\end{table}

\end{document}

相关内容