1

I've done a table but it is way too big in order to be displayed on one page. Does someone know a way how to change the table so that it fits? Thanks in advance.

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

Your table will fit easily on one page -- and within the width of the text block -- if you (a) let the contents of the columns "wrap" as needed and (b) dispense with the \renewcommand{\arraystretch}{1.5} instruction. (Actually, the table will fit even if \arraystretch is redefined, but the result doesn't look as good, IMNSHO.)

Specifically, I suggest you employ a tabularx environment instead of the tabular environment and make use of the line-drawing macros of the booktabs package (which is already being loaded in your example). Give serious thought to omitting all vertical lines in the table: trust me, they won't be missed, and the table will have a much more open look.

A useful trick: Use the \slash macro instead of the hard-coded / symbol to allow linebreaks, if needed, after the slash characters.

enter image description here

\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}
  • thx a lot mico, awesome problem solving. thank you very much, made my day. cheers!! – escazu wtf Apr 3 '15 at 18:49
  • I have another question regarding this table... As I have a line spread of 1.5 (given format for thesis), the line spread in the table is also large, and that's why the table doesn't show all the names properly on one page. How can I punctually change the line spread for a table, so that it fits on one page?? Thx – escazu wtf Apr 3 '15 at 18:58
  • 1
    @escazuwtf - You're welcome! On your follow-up question: Please check this site for postings on how best to affect the linespread in a LaTeX document. My advice would be: Don't set low-level parameters such as \linespread directly. Instead, load the setspace package and issue the instruction \setstretch{1.5}. That way, the line spread in tabular-like material and in footnotes will remain "normal", i.e., at 1.0. – Mico Apr 3 '15 at 22:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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