32

I want to put several tables in the same table float like this:

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

When I build the document, table 2's caption is closer to the bottom of table 1, which makes things confusing. hspace{} doesn't seem to work in the table environment. I've worked out that the subfloat package appears to be causing the spacing behaviour of the captions. Is there anything else that I can do to introduce a blank horizontal break to space out the captions?

3
  • 2
    It looks fine with the article document class. Perhaps you could turn your code into a complete compilable file, a so-called minimal working example (MWE) that shows the behaviour?
    – Jake
    Aug 21, 2011 at 10:47
  • Yup, you're right. I probably should have stripped it down to the basics before asking. I found that the problem was caused by using the subfloat package, which I require for a couple of graph floats in my document. I updated the example to a MWE that reproduces the issue.
    – MattLBeck
    Aug 21, 2011 at 11:09
  • 1
    Simply use \vspace between the tabular environements, or something like \medskip or \bigskip.
    – user2574
    Aug 21, 2011 at 11:32

3 Answers 3

38

The spacing is caused by the caption package, which is loaded by subfig. You can adjust the two parameters aboveskip and belowskip provided by caption using something like \captionsetup{belowskip=12pt,aboveskip=4pt} in your preamble. Note that below and above have the meaning as it would make sense for figure captions below a figure: aboveskip is the space between the content and the caption (which would be above the caption for a figure caption that's set underneath the figure, but below it for a table caption that's set above the table), belowskip is the space between the caption and the surrounding text.

Here's your example with the aboveskip and belowskip adjusted:

\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}
17

Since you use subfig, you can adjust this by \captionsetup of the caption package, for example:

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

With these adjustments, you will get this output:

tables with captions

5

without loading another package use

\usepackage{subfig}

\let\belowcaptionskip\abovecaptionskip
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.