在表格中添加附加标题/更改行距

在表格中添加附加标题/更改行距

这与我之前提出的一个问题相关:

对齐表格中的图像和(子)表格

但我意识到我必须重新安排数据的显示方式,所以我将提出一个新问题(这肯定是最终的布局)

Q1.) 理想情况下,我希望能够在每个描述统计表下添加标题,可以吗?

Q2.) 我想减少描述统计表中使用的行距?可以吗?

谢谢

巴兹

\documentclass[12pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage[export]{adjustbox}

\newcommand{\subf}[2]{%
 {\small\begin{tabular}[t]{@{}c@{}}
  #1\\ \hline #2
 \end{tabular}}%
}


\begin{document}
\begin{figure}
\centering
\begin{tabular}{|c|c|}
\hline
\subf{\includegraphics[valign=T,width=60mm]{Steep3Hist.eps}}
  {Simulated Subset 3 Data}
 &
\subf{\includegraphics[valign=T,width=60mm]{Steep3Hist.eps}}
{Results for Simulated Subset 3 Data}\\
\hline
\begin{tabular}[t]{l|l}
\hline
Statistic & Value \\\hline
Max & 2 \\
min & 3 \\
Mean & 2 \\
Std & 3\\
Skew & 2 \\
Kurtosis & 3 \\
Percent Positive & 100\\
\end{tabular}

&
\begin{tabular}[t]{l|l}
\hline
Statistic & Value \\\hline
Max & 2 \\
min & 3 \\
Mean & 2 \\
Std & 3\\
Skew & 2 \\
Kurtosis & 3 \\
Percent Positive & 100\\
\end{tabular}\\
\hline
 \subf{\includegraphics[valign=T,width=60mm]{Steep3Hist.eps}}
 {Results for Simulated Subset 3 Data}
&
 \subf{\includegraphics[valign=T,width=60mm]{Steep3Hist.eps}}
{Results for Simulated Subset 3 Data}\\
\hline
\begin{tabular}[t]{l|l}
\hline
Statistic & Value \\\hline
Max & 2 \\
min & 3 \\
Mean & 2 \\
Std & 3\\
Skew & 2 \\
Kurtosis & 3 \\
Percent Positive & 100\\
\end{tabular}
&
\begin{tabular}[t]{l|l}
\hline
Statistic & Value \\\hline
Max & 2 \\
min & 3 \\
Mean & 2 \\
Std & 3\\
Skew & 2 \\
Kurtosis & 3 \\
Percent Positive & 100\\
\end{tabular}\\
\hline
\end{tabular}
\caption{Results of Simulation Study for the Steepener Strategy}
\end{figure}
\end{document} 

答案1

你问:

Q1.) 理想情况下,我希望能够在每个描述统计表下添加标题,可以吗?

Q2.) 我想减少描述统计表中使用的行距?可以吗?

A1. 您可以通过

\multicolumn{2}{c}{<Caption Text>}\\

指令位于四个环境的底部tabular

A2. 如果你加载了setspace包,你可以发出指令\setstretch{0.9} 四种tabular环境中的每一个。

这些建议应用于您的代码的结果:

在此处输入图片描述


附录:要将表格相关标题放在框架框中,您可以更改代码块

\addlinespace
\multicolumn{2}{c}{<Caption Text>}\\

\addlinespace
\hline
\multicolumn{2}{|c|}{<Caption Text>}\\
\hline

\documentclass[12pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[demo]{graphicx} % remove 'demo' option in real document
\usepackage{epstopdf}
\usepackage[export]{adjustbox}

%% Two additional packages
\usepackage{booktabs} % for '\addlinespace' macro
\usepackage{setspace} % for '\setstretch' macro

\newcommand{\subf}[2]{%
 {\small\begin{tabular}{@{}c@{}}
  #1\\  \hline  \addlinespace #2 \\ \addlinespace % some more whitespace
 \end{tabular}}%
}

\begin{document}
\begin{figure}
\centering
\begin{tabular}{|c|c|}
\hline
\subf{\includegraphics[valign=T,width=0.44\textwidth]{Steep3Hist.eps}}{Simulated Subset 3 Data}
 &
\subf{\includegraphics[valign=T,width=0.44\textwidth]{Steep3Hist.eps}}{Results for Simulated Subset 3 Data}\\
%\hline

\setstretch{0.9}
\begin{tabular}{l|l}
\hline
Statistic & Value \\
\hline
Max & 2 \\
min & 3 \\
Mean & 2 \\
Std & 3\\
Skew & 2 \\
Kurtosis & 3 \\
Percent Positive & 100\\
\addlinespace
\multicolumn{2}{c}{First set of descriptive stats}\\
\end{tabular}
&
\setstretch{0.9}
\begin{tabular}{l|l}
\hline
Statistic & Value \\\hline
Max & 2 \\
min & 3 \\
Mean & 2 \\
Std & 3\\
Skew & 2 \\
Kurtosis & 3 \\
Percent Positive & 100\\
\addlinespace
\multicolumn{2}{c}{Second set of descriptive stats}\\
\end{tabular}\\
\hline

 \subf{\includegraphics[valign=T,width=0.44\textwidth]{Steep3Hist.eps}}{Results for Simulated Subset 3 Data}
&
 \subf{\includegraphics[valign=T,width=0.44\textwidth]{Steep3Hist.eps}}{Results for Simulated Subset 3 Data}\\
%\hline

\setstretch{0.9}
\begin{tabular}{l|l}
\hline
Statistic & Value \\\hline
Max & 2 \\
min & 3 \\
Mean & 2 \\
Std & 3\\
Skew & 2 \\
Kurtosis & 3 \\
Percent Positive & 100\\
\addlinespace
\multicolumn{2}{c}{Third set of descriptive stats}\\
\end{tabular}
&
\setstretch{0.9}
\begin{tabular}{l|l}
\hline
Statistic & Value \\\hline
Max & 2 \\
min & 3 \\
Mean & 2 \\
Std & 3\\
Skew & 2 \\
Kurtosis & 3 \\
Percent Positive & 100\\
\addlinespace
\multicolumn{2}{c}{Fourth set of descriptive stats}\\
\end{tabular}\\
\hline
\end{tabular}
\caption{Results of Simulation Study for the Steepener Strategy}
\end{figure}
\end{document} 

相关内容