1

I have many tables that I want to squeeze in one page. The output of my current code shows lot of space between two tables. I want to reduce the space between the tables as small as possible and want to defined the page size also as small as possible so that the space around the table is very small.

\documentclass{article}
\usepackage[paperwidth=1.70in, paperheight=3.0in]{geometry}
\usepackage{emptypage}
\usepackage{float}
\begin{document}
\thispagestyle{empty}
\begin{table}[H] \begin{center}
\caption{1}
\begin{tabular}{|c|c|c|}
\hline
1 & 2 & 3 \\
10 & 20 & 30 \\
100 & 200 & 300 \\
\hline
\end{tabular}
\end{center} \end {table} 
\begin{table}[H] \begin{center}
\caption{2}
\begin{tabular}{|c|c|c|}
\hline
1 & 2 & 3 \\
10 & 20 & 30 \\
100 & 200 & 300 \\
\hline
\end{tabular}
\end{center} \end {table}
\end{document}
1
  • 1
    (always) use \centering rather than \begin{center} inside table as table adds vertical space so you do not want extra space from center May 12, 2015 at 10:32

1 Answer 1

2

It sounds as if you would be happier with the standalone class:

% arara: pdflatex

\documentclass[border=1mm]{standalone} % a little border for easier screenshot trimming. You can leave this away or put whatever size pleases you.
\usepackage{caption} % replace this by `capt-of` if you want to obtain the old (not beautiful) vertical spacing of the caption but have the possibility to use `\captionof{table}{...}`
\usepackage{booktabs}
\usepackage{siunitx}

\begin{document}
\begin{minipage}{.24\textwidth} % I do not know, what the full \textwidth is refereed to here... Just put some value as 5cm in order to fit your tables. 
    \centering
    \captionof{table}{1}
    \begin{tabular}{*{3}{S[table-format=3.0]}}
        \toprule
        1 & 2 & 3 \\
        10 & 20 & 30 \\
        100 & 200 & 300 \\
        \bottomrule
    \end{tabular}
    \vskip10pt % or what ever you wish
    \captionof{table}{2}
    \begin{tabular}{*{3}{S[table-format=3.0]}}
        \toprule
        1 & 2 & 3 \\
        10 & 20 & 30 \\
        100 & 200 & 300 \\
        \bottomrule
    \end{tabular}
\end{minipage}
\end{document}

enter image description here


Tightest possible packaging would be:

% arara: pdflatex

\documentclass{standalone}
\usepackage{capt-of}
\usepackage{booktabs}
\usepackage{siunitx}

\begin{document}
\begin{minipage}{69pt}
    \vskip-10pt
    \centering
    \captionof{table}{1}
    \begin{tabular}{@{}*{3}{S[table-format=3.0]}@{}}
        \toprule
        1 & 2 & 3 \\
        10 & 20 & 30 \\
        100 & 200 & 300 \\
        \bottomrule
    \end{tabular}
    \vskip-10pt
    \captionof{table}{2}
    \begin{tabular}{@{}*{3}{S[table-format=3.0]}@{}}
        \toprule
        1 & 2 & 3 \\
        10 & 20 & 30 \\
        100 & 200 & 300 \\
        \bottomrule
    \end{tabular}
\end{minipage}
\end{document}

You could still reduce the column separator if you need to. Search this site for hints.

3
  • This is strange that when I use any text it gives me error " siunitx error: "invalid-number"! Invalid numerical input 'e'. E & " !!!!
    – d.putto
    May 12, 2015 at 10:59
  • I think \usepackage{siunitx} is not required. Removing it (and corresponding option {@{}*{3}{S[table-format=3.0]}@{}} ) resolved my problem. Is there any specific reason for using siunitx?
    – d.putto
    May 12, 2015 at 11:27
  • @d.putto If you need text, just get rid of it. If you need numbers and just a few times text, put the text in braces. If you type numbers only, like in your example, the S column results in good alignment even for decimal numbers and alike. See the manual of siunitx
    – LaRiFaRi
    May 12, 2015 at 11:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .