页面中紧密排列的表格

页面中紧密排列的表格

我有许多表格,我想将它们挤进一页。我当前代码的输出显示两个表格之间有很大空间。我想尽可能缩小表格之间的空间,并希望将页面大小定义得尽可能小,以便表格周围的空间非常小。

\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

听起来你会对这standalone门课更满意:

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

在此处输入图片描述


最紧密的包装可能是:

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

如果需要,您仍然可以缩小列分隔符。请在此站点搜索提示。

相关内容