标题,水平距离,表格

标题,水平距离,表格

我能否获得一些帮助,在每个表格上方添加一个标题,增加表格之间的水平距离。如果可能的话,还可以在每个表格下方添加一个标题。谢谢

\begin{table}[!htb]
\tiny \setlength{\tabcolsep}{1.pt}
\begin{minipage}{.33\linewidth}
\centering

\caption{First Table}
\label{tab:first_table}

\begin{tabular}{c|c|c|c}
    \toprule
    \textbf{Term} & Default & Fully paid & \textbf{Ratio} \\ \hline
    $36$ months & $5881$ & $37473$ &  0.135 \\
    $60$ months & $2712$ & $6715$ &0.287 \\ \hline
    Pearson's & d.f & $pvalue$ \\
    $\chi^2 =1313$ & $1$ & $\approx 0$ \\
    \bottomrule
\end{tabular}\hfill
\end{minipage}
\begin{minipage}{.3\linewidth}
\centering

\caption{Second Table}
\label{tab:second_table}

\begin{tabular}{c|c|c|c}
    \toprule
    \textbf{Home Ow.} & Default & Fully paid & \textbf{Ratio} \\ \hline
    Mortg. & $3733$ & $20911$ &  0.15 \\
    Own & $710$ & $3456$ &  0.17 \\
    Rent& $4150$ & $19821$ &  0.173 \\ \hline
    Pearson's & d.f & $pvalue$ \\
    $\chi^2 =43.7$ & $2$ & $\approx 0$ \\
    \bottomrule
\end{tabular}
\end{minipage}\hfill
\begin{minipage}{.3\linewidth}
\centering
\caption{Third Table}
\label{tab:third_table}

\medskip

\begin{tabular}{c|c|c|c}
    \toprule
    \textbf{Inq.L.6mths} & Default & Fully paid & \textbf{Ratio} \\ \hline
    $0$ & $3609$ & $22371$ &  0.139 \\
    $1$ & $2565$ & $12322$ & 0.170 \\
    $2$& $1495$ & $6134$ &  0.195 \\ 
    $\geq 3$ & 924  & 3361 & 0.215 \\ \hline
    Pearson's & d.f & $pvalue$ \\
    $\chi^2 =277$ & $3$ & $\approx 0$ \\
    \bottomrule
\end{tabular}    
\end{minipage} 
\end{table}

答案1

像这样?

在此处输入图片描述

(红线表示页面布局)。由于您没有提供有关文档的任何信息,因此我设计了它。让我强调一下,我的解决方案(和任何一个一样)依赖于页面布局和使用的包,所以我担心下面的建议不会在您的文档中起作用(但可以按原样工作:-)):

\documentclass{article}
\usepackage{geometry}
\usepackage{booktabs, makecell, tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\usepackage[skip=1ex,labelfont=bf]{caption}
\usepackage{siunitx}

%-------------------------------- show page layout, only for test
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

    \begin{document}
\begin{table}[htb]
\sisetup{group-minimum-digits=4}
\small
\setlength{\tabcolsep}{2 pt}
\begin{tabularx}{\linewidth}{@{}*{3}{C} @{}}
    \caption{First Table}
    \label{tab:first_table}
\begin{tabular}{ c S[table-format=4.0]
                   S[table-format=5.0]
                   S[table-format=1.3]
                }   
    \toprule
\textbf{Term}   & {Default} & {\makecell[b]{Fully\\ paid}}  & {\textbf{Ratio}}  \\
    \midrule
36 months       & 5881      & 37473                         &   0.135           \\
60 months       & 2712      & 6715                          &   0.287           \\
    \midrule
Pearson's       & {d.f}     & {\textit{pvalue}}             &                   \\
$\chi^2 =1313$  & {1}       & {$\approx 0$}                 &                   \\
    \bottomrule
\end{tabular}
    &
\caption{Second Table}
    \label{tab:second_table}
\begin{tabular}{ c S[table-format=4.0]
                   S[table-format=5.0]
                   S[table-format=1.3]
                }
    \toprule
\textbf{Term}   & {Default} & {\makecell[b]{Fully\\ paid}}  & {\textbf{Ratio}}  \\
           \midrule
Mortg.          & 3733      & 20911                         &  0.15             \\
Own             & 710       & 3456                          &  0.17             \\
Rent            & 4150      & 19821                         &  0.173            \\
    \midrule
Pearson's       & {d.f}     & {\textit{pvalue}}             &                   \\
$\chi^2 =43.7$  & {2}       & {$\approx 0$}                 &                   \\
    \bottomrule
\end{tabular}
    &
\caption{Third Table}
    \label{tab:third_table}
\begin{tabular}{ c S[table-format=4.0]
                   S[table-format=5.0]
                   S[table-format=1.3]
                }
    \toprule
\bfseries\makecell[b]{Inq. L.\\6 months}
                & {Default} & {\makecell[b]{Fully\\ paid}}  & {\textbf{Ratio}}  \\                        \midrule
$0$             & 3609      & 22371                         &  0.139            \\
$1$             & 2565      & 12322                         & 0.170             \\
$2$             & 1495      & 6134                          &  0.195            \\
$\geq 3$        & 924       & 3361                          & 0.215             \\
    \midrule
Pearson's       & {d.f}     & {\textit{pvalue}}             &                   \\
$\chi^2 =277$   & {3}       & {$\approx 0$}                 &                   \\
    \bottomrule
\end{tabular}
\end{tabularx}
\end{table}
\end{document}

相关内容