4

I usually load the caption package to fix the spacing between tables and their captions in the article class. Since I don't use any other features of the caption package, I decided to try using the dedicated package ftcap to fix it instead. However, when I try each package, I get slightly different amounts of vertical space on the page. With the following MWE, when I use ftcap, all of the text moves slightly higher up on the page compared to the output when I use caption. As far as I can tell, the space between the table and caption is identical between the two (presumably 10.0pt).

MWE:

\documentclass{article}

\usepackage{caption}  % a bit less than 1mm lower
%\usepackage{ftcap}  % a bit less than 1mm higher

\begin{document}
    
This is a paragraph.

\begin{table}
    \caption{This is a caption.}
    \begin{tabular}{c}
        This is a table.
    \end{tabular}
\end{table}

\end{document}

The following code can be used to see the difference more clearly:

\documentclass{article}

\usepackage{fgruler}
\textwidth=\paperwidth
\oddsidemargin=-1in
\parindent=0pt

\usepackage{caption}  % a bit less than 1mm lower
%\usepackage{ftcap}  % a bit less than 1mm higher

\begin{document}
    
\rule{2cm}{0.1pt}
This is a paragraph.

\begin{table}
    \caption{This is a caption.}
    \begin{tabular}{c}
        \rule{2cm}{0.1pt}
        This is a table.
    \end{tabular}
\end{table}

\end{document}

I've tried going through the documentation and implementation of both packages. caption is quite a bit more complex, so I haven't been able to make as much sense of it.

5
  • What am I looking for exactly? I don't see any difference when I switch from one package to the other.
    – cfr
    Commented Apr 26 at 1:07
  • 1
    I've added a modified example to your question which makes it easier (possible!) to see the difference. If you aren't happy with this edit, do feel free to roll back to your original version.
    – cfr
    Commented Apr 26 at 1:43
  • Thanks — that's helpful! The change in spacing is admittedly small, but I figure it could cause a difference in overall length in a document with a lot of tables.
    – inavda
    Commented Apr 26 at 2:15
  • Yes ... but why would somebody expect them to yield identical results? The implementation looks quite different, doesn't it? Does caption claim to produce the same spacing?
    – cfr
    Commented Apr 26 at 7:00
  • I suppose what's weird to me is that it seems like caption is adding space above the caption (however small that amount of space may be). I couldn't find any mention of such a space being added in the documentation, so I wanted to know if it was intentional or a bug in the implementation of caption.
    – inavda
    Commented Apr 26 at 7:32

1 Answer 1

3

The implementation of caption and ftcap are different.

As far as I can see, the difference is caused by caption adding a strut in the caption, which is not done by ftcap that doesn't modify the \caption command.

Let's do three examples. The top thin rule is added by the showframe option to geometry, showing the top edge of the type block.

ftcap with no \strut

\documentclass{article}
\usepackage[pass,showframe]{geometry}

\usepackage{ftcap}  % a bit less than 1mm higher

\begin{document}

\begin{table}[htp]
\centering
    \caption{This is a caption.}
Something
\end{table}

\end{document}

enter image description here

ftcap with \strut

\documentclass{article}
\usepackage[pass,showframe]{geometry}

\usepackage{ftcap}  % a bit less than 1mm higher

\begin{document}

\begin{table}[htp]
\centering
    \caption{\strut This is a caption.}
Something
\end{table}

\end{document}

enter image description here

caption

\documentclass{article}
\usepackage[pass,showframe]{geometry}

\usepackage{caption}  % a bit less than 1mm lower

\begin{document}

\begin{table}[htp]
\centering
    \caption{This is a caption.}
Something
\end{table}

\end{document}

enter image description here

There is also a tiny difference in the spacing between caption and the text.

Conclusion

Use either package, you can't hope that different implementations (in particular complex one such as caption's) produce the same output.

2
  • Thanks for the explanation! Is there any particular technical reason to add a strut in the caption or do you think it was just an aesthetic choice by the package creator?
    – inavda
    Commented Apr 26 at 20:49
  • 1
    @inavda I guess to ensure alignment with subcaptions, mainly.
    – egreg
    Commented Apr 26 at 21:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .