2

I have a two column document that contains full page boxes. These boxes sometimes contain table or figure captions, which generally look best at the top of the second column of the box.

However, the caption when placed above the table/figure does not align vertically with the text in the first column. The image below shows a close-up of the left column and caption name, both underlined here to emphasize the baselines are not aligned.

Close-up of the left column and the caption. Both are underlined to emphasize the baseline

MWE:

\documentclass[parskip=half-]{scrreprt}
\usepackage[twocolumn,landscape]{geometry}
\usepackage{multicol}
\newlength{\currentparskip}
%\usepackage{microtype}
\usepackage{newfloat}
\usepackage{float}
\usepackage{tikz}
\usepackage[tikz]{mdframed}
\usepackage{caption}

\usepackage{ulem}  % for underline
\usepackage{lipsum}

\DeclareFloatingEnvironment[listname={List of boxes}, name = {Box}]{boxe}

\makeatletter
\newenvironment{bigbox*}[2]{%
  \setlength{\currentparskip}{\parskip}
  \@dblfloat{boxe}%
  \begin{mdframed}
  \caption{#1}\label{#2}%
  \setlength{\columnsep}{1mm}  % deliberately narrow to exhibit baselines
  \begin{multicols}{2}
  \setlength{\parskip}{\currentparskip}% restore the value
}{%
  \end{multicols}\end{mdframed}
  \end@dblfloat
}
\makeatother


\begin{document}
\lipsum

\begin{bigbox*}{This is the box title}{box:box}
\uline{Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae,
felis. Curabitur dictum gravida mauris. Nam arcu libero,
nonummy eget, consectetuer id, vulputate a, magna. Donec
vehicula augue eu neque. Pellentesque habitant morbi tris-
tique senectus et netus et malesuada fames ac turpis egestas.
Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et
lectus vestibulum urna fringilla ultrices. Phasellus eu tellus
sit amet tortor gravida placerat. Integer sapien est, iaculis
in, pretium quis, viverra ac, nunc. Praesent eget sem vel
leo ultrices bibendum. Aenean faucibus. Morbi dolor nulla,
malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor
semper nulla. Donec varius orci eget risus. Duis nibh mi,
congue eu, accumsan eleifend, sagittis quis, diam. Duis eget
orci sit amet orci dignissim rutrum.}

\lipsum[2]
\columnbreak
\begin{table}[H]
\captionsetup{justification=raggedright, name={\uline{Table}}, font={small}, singlelinecheck=false}
\captionabove{\underline{Table caption}}
\begin{tabular}{lllllllll}
a & b & c &a & b & c &a & b & c \\
a & b & c &a & b & c &a & b & c \\
a & b & c &a & b & c &a & b & c \\
\end{tabular}
\end{table}

 Integer sapien est, iaculis in, pretium quis, viverra ac, nunc.
Praesent eget sem vel leo ultrices bibendum. Aenean
faucibus. Morbi dolor nulla, malesuada eu, pulvinar at,
mollis ac, nulla. 

Curabitur auctor semper nulla. Donec
varius orci eget risus. Duis nibh mi, congue eu, accumsan
eleifend, sagittis quis, diam. Duis eget orci sit amet orci
dignissim rutrum

Curabitur auctor semper nulla. Donec
varius orci eget risus. Duis nibh mi, congue eu, accumsan
eleifend, sagittis quis, diam. Duis eget orci sit amet orci
dignissim rutrum
\end{bigbox*}
\lipsum

\end{document}

I tried adding (combinations of) the following (before \begin{table}[H]), but it had no effect:

\newlength{\oldcaptionskip}
\setlength{\oldcaptionskip}{\abovecaptionskip}
\setlength{\abovecaptionskip}{0pt}
\newlength{\oldintextsep}
\setlength{\oldintextsep}{\intextsep}
\setlength{\intextsep}{0pt}

I also tried adding position=above as per the caption package documentation and putting these lengths within \captionsetup, but it made no difference.

As this is a grid problem (which I understand is a task in which LaTeX is weak), I tried \usepackage[fontsize=10pt, baseline=12pt]{grid} but it made the discrepancy even more pronounced.

I understand I can just \vspace*{-magic number pt} this problem, but I think there's just something I'm overlooking in the captionsetup.

My task does require font={small} to maintain consistency. I would nonetheless be interested in solutions that don't work with different fonts in the table caption.

1

One could align the top lines with \strut, both times typeset in \normalsize:

\strut\uline{Lorem ipsum dolor sit amet, consectetuer adipiscing elit.

and

\captionabove{{\normalsize\strut}\uline{Table caption}}

(Please note that I changed \underline to \uline additionally (so both times \uline is used) since the outcome is slightly different.)

enter image description here

Your example, modified:

\documentclass[parskip=half-]{scrreprt}
\usepackage[twocolumn,landscape]{geometry}
\usepackage{multicol}
\newlength{\currentparskip}
%\usepackage{microtype}
\usepackage{newfloat}
\usepackage{float}
\usepackage{tikz}
\usepackage[tikz]{mdframed}
\usepackage{caption}

\usepackage{ulem}  % for underline
\usepackage{lipsum}

\DeclareFloatingEnvironment[listname={List of boxes}, name = {Box}]{boxe}

\makeatletter
\newenvironment{bigbox*}[2]{%
  \setlength{\currentparskip}{\parskip}
  \@dblfloat{boxe}%
  \begin{mdframed}
  \caption{#1}\label{#2}%
  \setlength{\columnsep}{1mm}  % deliberately narrow to exhibit baselines
  \begin{multicols}{2}
  \setlength{\parskip}{\currentparskip}% restore the value
}{%
  \end{multicols}\end{mdframed}
  \end@dblfloat
}
\makeatother


\begin{document}
\lipsum

\begin{bigbox*}{This is the box title}{box:box}
\strut\uline{Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae,
felis. Curabitur dictum gravida mauris. Nam arcu libero,
nonummy eget, consectetuer id, vulputate a, magna. Donec
vehicula augue eu neque. Pellentesque habitant morbi tris-
tique senectus et netus et malesuada fames ac turpis egestas.
Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et
lectus vestibulum urna fringilla ultrices. Phasellus eu tellus
sit amet tortor gravida placerat. Integer sapien est, iaculis
in, pretium quis, viverra ac, nunc. Praesent eget sem vel
leo ultrices bibendum. Aenean faucibus. Morbi dolor nulla,
malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor
semper nulla. Donec varius orci eget risus. Duis nibh mi,
congue eu, accumsan eleifend, sagittis quis, diam. Duis eget
orci sit amet orci dignissim rutrum.}

\lipsum[2]
\columnbreak
\begin{table}[H]
\captionsetup{justification=raggedright, name={\uline{Table}}, font={small}, singlelinecheck=false}
\captionabove{{\normalsize\strut}\uline{Table caption}}
\begin{tabular}{lllllllll}
a & b & c &a & b & c &a & b & c \\
a & b & c &a & b & c &a & b & c \\
a & b & c &a & b & c &a & b & c \\
\end{tabular}
\end{table}

 Integer sapien est, iaculis in, pretium quis, viverra ac, nunc.
Praesent eget sem vel leo ultrices bibendum. Aenean
faucibus. Morbi dolor nulla, malesuada eu, pulvinar at,
mollis ac, nulla. 

Curabitur auctor semper nulla. Donec
varius orci eget risus. Duis nibh mi, congue eu, accumsan
eleifend, sagittis quis, diam. Duis eget orci sit amet orci
dignissim rutrum

Curabitur auctor semper nulla. Donec
varius orci eget risus. Duis nibh mi, congue eu, accumsan
eleifend, sagittis quis, diam. Duis eget orci sit amet orci
dignissim rutrum
\end{bigbox*}
\lipsum

\end{document}

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.