控制表格标题周围的间距

控制表格标题周围的间距

我想将多个表格放在同一个表格浮点中,如下所示:

\documentclass[a4paper, 12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{subfig}
\begin{document}

\begin{table}

\caption{Internal exon scores}\label{tab:internal}
\begin{tabular}{|c|l|l|}
\hline
Ranking&Exon Coverage&Splice Site Support\\
\hline
E1&Complete coverage by a single transcript&Both splice sites\\
E2&Complete coverage by more than a single transcript&Both splice sites\\
E3&Partial coverage&Both splice sites\\
E4&Partial coverage&One splice site\\
E5&Complete or partial coverage&No splice sites\\
E6&No coverage&No splice sites\\
\hline
\end{tabular}

\caption{External exon scores}\label{tab:external}
\begin{tabular}{|c|l|l|}
\hline
Ranking&Exon Coverage&Internal Splice Site Coverage\\
\hline
X1&Complete coverage by one or more transcripts&Splice site covered\\
X2&Exon coverage >= 80\%&Splice site covered\\
X3&Exon coverage < 80\%&Splice site covered\\
X4&Exon coverage < 80\%&Splice site not covered\\
X5&No coverage&Splice site not covered\\
\hline
\end{tabular}

\end{table}
\end{document}

当我创建文档时,表 2 的标题更靠近表 1 的底部,这让人感到困惑。hspace{}似乎在表格环境中不起作用。我发现该subfloat包似乎导致了标题的间距行为。我还能做些什么来引入空白的水平分隔符来分隔标题吗?

答案1

间距是由caption包,由 加载。您可以在序言中使用类似的东西来调整提供的subfig两个参数aboveskip和。请注意,和具有以下含义,因为它们对于图形下方的图形标题有意义:是内容和标题之间的空间(将是belowskipcaption\captionsetup{belowskip=12pt,aboveskip=4pt}belowaboveaboveskip多于图形标题的标题设置在图形下方,但以下表格标题(位于表格上方)belowskip是标题与周围文本之间的空间。

aboveskip以下是经过调整后的示例belowskip

\documentclass[a4paper, 12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{subfig}

\captionsetup{belowskip=12pt,aboveskip=4pt}
\begin{document}

\begin{table}

\caption{Internal exon scores}\label{tab:internal}
\begin{tabular}{|c|l|l|}
\hline
Ranking&Exon Coverage&Splice Site Support\\
\hline
E1&Complete coverage by a single transcript&Both splice sites\\
E2&Complete coverage by more than a single transcript&Both splice sites\\
E3&Partial coverage&Both splice sites\\
E4&Partial coverage&One splice site\\
E5&Complete or partial coverage&No splice sites\\
E6&No coverage&No splice sites\\
\hline
\end{tabular}

\caption{External exon scores}\label{tab:external}
\begin{tabular}{|c|l|l|}
\hline
Ranking&Exon Coverage&Internal Splice Site Coverage\\
\hline
X1&Complete coverage by one or more transcripts&Splice site covered\\
X2&Exon coverage >= 80\%&Splice site covered\\
X3&Exon coverage < 80\%&Splice site covered\\
X4&Exon coverage < 80\%&Splice site not covered\\
X5&No coverage&Splice site not covered\\
\hline
\end{tabular}

\end{table}
\end{document}

答案2

由于您使用subfig,您可以\captionsetup通过caption包,例如:

\captionsetup[table]{aboveskip=0pt}
\captionsetup[table]{belowskip=10pt}

通过这些调整,您将获得以下输出:

带标题的表格

答案3

无需加载其他包即可使用

\usepackage{subfig}

\let\belowcaptionskip\abovecaptionskip
    

相关内容