0

Assuming I am using an [H] float, I'd like to create equal space above the caption, and below the table (for a table with caption above), and that same space above a figure, and below the caption (for a figure with caption below). Additionally, I'd like the spacing between the caption and table or figure to be the same. I thought this would be easy with the caption package, but I am struggling.

How would you do it? I'd like to avoid patching my floats with vspace etc. as it might mess things up on a float page.

The space under the table, and caption of figure, are clearly larger than the specified amount, and the distance above is noticeable smaller. Also, the skip setting in caption doesn't seem to do anything with floatrow, although the documentation says it should cooperate.


\documentclass[parskip=full]{scrartcl}

\usepackage{mwe}
\usepackage{printlen}

\usepackage{graphicx}

\usepackage{booktabs}

\usepackage[%
skip=1  0pt,
]{caption} %

\usepackage{floatrow} 

\floatsetup[table]{capposition=top}
\floatsetup[figure]{capposition=bottom}


\newlength{\parskiplength}
\setlength{\parskiplength}{13.6pt}

\setlength{\floatsep}{\parskiplength}
\setlength{\textfloatsep}{\parskiplength}
\setlength{\intextsep}{\parskiplength}

\captionsetup{belowskip=0pt}
\captionsetup{aboveskip=0pt}


\newcommand{\blah}{Here is some text. Blah blah  blah  blah  blah  blah  blah  blah  blah  blah  blah  blah  blah  blah  blah  blah  blah  blah  blah  blah  blah.}

\begin{document}

    parskip:\uselengthunit{pt}\printlength{\parskip}\\
    baselineskip:\uselengthunit{pt}\printlength{\baselineskip}\\


\section{A figure}

\blah

\blah

\begin{figure}[H]
    \includegraphics[width=\textwidth]{example-image-duck}
    \caption{A caption}
\end{figure}

\blah

\newpage

\section{A table}

\blah

\begin{table}[H]
    \caption{A caption}
    \begin{tabular}{ll}
        \toprule
        Alpha & Beta \\
        Gamma & Delta \\
        \bottomrule
    \end{tabular}
\end{table}

\blah

\end{document} 
2
  • 3
    H makes the environment nota float so your comment about float pages seems mis-placed, an H enviornment will never be on a float page. Jan 28, 2020 at 1:10
  • Ah; very good point. Would you recommend using the center environment instead then, if I absolutely need an H "float"? Jan 28, 2020 at 3:21

1 Answer 1

1

Below the duck you have

...\glue 13.6
...\glue(\parskip) 13.6 plus 1.36008
...\glue(\baselineskip) 5.99585
...\hbox(7.60416+0.0)x418.25555, glue set 0.38042
....\hbox(0.0+0.0)x0.0
....\OT1/cmr/m/n/10.95 H
....\OT1/cmr/m/n/10.95 e
....\OT1/cmr/m/n/10.95 r
....\OT1/cmr/m/n/10.95 e

so both \intextsep (13.6pt) and \parskip (13.6pt plus 1.36008pt) and the baselineskip to the next line of text Here....

4
  • So how do I prevent that? Jan 28, 2020 at 5:16
  • @likethevegetable set \intextsep to 0pt and rely on \parskip space? Jan 28, 2020 at 10:29
  • how did you produce that output? The \glue 13.6 etc. etc. I'm assuming that's the primitive TeX output? I feel like seeing that would really help me learn. Jan 29, 2020 at 20:38
  • @likethevegetable \showoutput Jan 29, 2020 at 21:15

You must log in to answer this question.

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