# How do I fit a table in one page?

I have very basic knowledge of LaTeX and I have been using LibreOffice's Word2LaTeX conversion software to convert my tables. However, I cannot seem to fit the tables into one page when I put the code into Scientific Wordplace. It always takes two. Is there anyway I can put it in one?

Here is the code:

\documentclass[letterpaper]{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amssymb,amsfonts,textcomp}
\usepackage{color}
\usepackage{array}
\usepackage{supertabular}
\usepackage{hhline}
\usepackage{hyperref}
\hypersetup{pdftex, colorlinks=true, linkcolor=blue, citecolor=blue, filecolor=blue, urlcolor=blue, pdftitle=, pdfauthor=, pdfsubject=, pdfkeywords=}
\makeatletter
\newcommand\arraybslash{\let\\\@arraycr}
\makeatother
% Page layout (geometry)
\setlength\voffset{-1in}
\setlength\hoffset{-1in}
\setlength\topmargin{0.7874in}
\setlength\oddsidemargin{0.7874in}
\setlength\textheight{9.4251995in}
\setlength\textwidth{6.9251995in}
\setlength\footskip{0.0cm}
\setlength\headheight{0cm}
\setlength\headsep{0cm}
% Footnote rule
\setlength{\skip\footins}{0.0469in}
\renewcommand\footnoterule{\vspace*{-0.0071in}\setlength\leftskip{0pt}\setlength\rightskip{0pt plus 1fil}\noindent\textcolor{black}{\rule{0.25\columnwidth}{0.0071in}}\vspace*{0.0398in}}
% Pages styles
\makeatletter
\newcommand\ps@Standard{
\renewcommand\@oddhead{}
\renewcommand\@evenhead{}
\renewcommand\@oddfoot{}
\renewcommand\@evenfoot{}
\renewcommand\thepage{\arabic{page}}
}
\makeatother
\pagestyle{Standard}
\setlength\tabcolsep{1mm}
\renewcommand\arraystretch{1.3}

\bigskip

{\color{black}
\foreignlanguage{english}{\textbf{Table A2: }}\foreignlanguage{english}{List    of countries included in the estimations
(by legal origin)}~ \foreignlanguage{english}{\textbf{[R2]}}}

\begin{flushleft}
\tablefirsthead{}
\tablehead{}
\tabletail{}
\tablelasttail{}
\begin{supertabular}    {m{1.3275598in}m{0.7858598in}m{1.5775598in}m{0.7233598in}m{1.2858598in}m{0.7858598in}}
.
.
.
.
.

\end{supertabular}
\end{flushleft}
{\color{black}
~\textit{Notes}: The estimations include up to 78 countries listed in the table above. Figures in the table indicate
statehood experience accumulated over the period 1-1800 AD.}

\bigskip
\end{document}

• Welcome to TeX.SX! It would be very helpful if you could remove all unnecessary lines in your code example. – TeXnician Feb 10 '17 at 7:58
• Why does your code contains lots of \color{black} statements? – Mico Feb 10 '17 at 8:04
• @Mico I know this problem in connection with those Word2LaTeX converters. Probably this is the reason. – TeXnician Feb 10 '17 at 8:05
• @tish - The sooner you wean yourself off SWP and get used to "straight LaTeX", the better off you'll be. Really. Also, don't rely too much on Word2LaTeX, especially not for table-related content. The conversion code you posted should, in my view, be classified as being somewhere between hair-raising and atrocious. – Mico Feb 10 '17 at 9:09
• @tish Some of us DO teach this stuff to people in grad school. – cfr Feb 22 '17 at 2:13

## 2 Answers

When setting up tables in a LaTeX document, it's crucial to engage in no, or only very little visual, formatting. Please study the following code and draw some inferences for how to go about encoding tabular material the LaTeX way.

For sure, if you don't want to allow a page break in the middle of the tabular material, don't employ an environment, such as supertabular, which is designed to allow pagebreaks.

\documentclass[letterpaper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[textwidth=6.925in,textheight=9.425in]{geometry}
\usepackage{array} % for '\newcolumntype' macro
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\usepackage{caption,booktabs}

\begin{document}

\begin{table}[p]                        % place the table on a page by itself
\setlength\tabcolsep{1mm}
\captionsetup{labelfont=bf}
\renewcommand\thetable{A\arabic{table}} % just for this example
\setcounter{table}{1}                   % just for this example

\caption{List of countries included in the estimations (by legal origin) \textbf{[R2]}}

\begin{tabular}{@{}p{1.32756in}C{0.78in}p{1.57756in}C{0.78in}p{1.28586in}C{0.78in}@{}}
\toprule
Common Law LO & avg = 0.243 & Armenia    & 0.561   & Senegal & 0.448 \\
Australia     & 0.000       & Azerbaijan & 0.462   &         &       \\
\dots \\
\bottomrule
\end{tabular}

\medskip
\textit{Notes}: The estimations include up to 78 countries listed in the table above. Figures in the table indicate
statehood experience accumulated over the period 1--1800 AD.
\end{table}

\end{document}


This is an answer to your other question, which you deleted as I was about to post it. While I assume you don't want an answer now, having put the effort it, I hope it may be of use to somebody. In essence, the question is sufficiently similar to this one that it seems legitimate to post it here. If not, I can delete it later when I'm less aware of having just spent time on something no longer wanted.

The code does not give an error but it come more closely approximate to recognised best practice.

Consider the following rewrite, but note that I'm not entirely clear what represents what e.g. what is really a maths variable and what text. Also, if these are statistics, you should probably be using siunitx.

Key points:

1. A table is a float. It is designed to move automatically somewhere else. Hence, anything crucial to that table needs to be in the float: caption, notes, whatever.

2. Never number enumerated things. Always let TeX keep count for you: items in lists, tables, figures, sections, references, pages, equations, paragraphs. Whatever it is, if it needs numbering, get TeX to count. TeX won't mind re-counting when you decide to add a second item after finishing the 404th, and it won't forget to change the numbers if you move the third figure after the fifth.

3. Use booktabs for rules.

4. Use caption for help formatting captions.

5. \label{<key>} in a table is useless unless a \caption precedes it. There is nothing for it to refer to if you've written Table 1 rather than \caption{...}.

\documentclass{article}
\usepackage{caption,tabularx,array,booktabs}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\begin{document}

\begin{table}[htbp]
% everything that must remain with the table needs to go in the table environment, because it may move
% use \caption to create the caption - never hard-code numbered items
\caption{Descriptive statistics and correlation coefficients of key variables}\label{tab:tab1}
% it's a switch - personally, I think it is better to use it as one
\scriptsize
% don't add extra vertical space with the center environment
{% limit the effect with a group
\centering
\begin{tabularx}{\linewidth}{lccccC}% make the tabular as wide as the line, using all the available space in the last column, which is the only multiline one anyway

\toprule
Variable &
Mean&
Std. Dev.&
Min.&
Max.&
Correlation coefficient with $FinDev$\\
\midrule
%       $State\, x\, German\, LO$ & % should this really all be presented as maths variables?
State $x$ German $LO$ &
0.086&
0.224&
0&
0.938&
0.24 \\

%       $State\, x\, Scandinavian\, LO$ & % ditto
State $x$ Scandinavian $LO$ & % ditto
0.019&
0.105&
0&
0.771&
0.30 \\
\bottomrule

\end{tabularx}

}% end of centring
\smallskip

% if the notes should stay with the table, they need to be in the table
\emph{Notes}: The descriptive statistics provided in the table include the 127 countries used in the baseline regressions.
Sources and definition of data are described in the text and Appendix 1.
\end{table}

\end{document}


• +1. Two minor points: Since the width of the tabularx environment is set to \textwidth, \centering has no effect and amy be omitted; and, the funky $x$ particles must surely be $\times$. :-) – Mico Feb 22 '17 at 5:30
• @Mico I actually included the \centering just to show how to avoid the use of center, which was used in the original code. However, you're right that I could have omitted it here. I didn't originally use tabularx but ended up there later. (You are possibly also right about the xs. I really don't know what is supposed to be maths and what not, since originally all of it was maths.) – cfr Feb 22 '17 at 23:34