# Want figure height to ignore side caption height

I use beside captions placed in a large margin area. Sometimes, the caption text is taller than the figure and this causes too much vertical space around the figure.

I'd like the effective height of the figure to ignore the height of the caption text in the margin. Just some vertical space around the figure as if the caption was not present. Because the caption is over in the margin, it's fine if caption text vertically overlaps the body text.

How can this be done? I'd like a way to do this such a that I do not need to hand tune each instance.

[EDIT 1] Fixed example code that only worked under xetex.

[EDIT 2] Updated sample problem PDF and showed fixed version using TH's cool \smashcaption.

Many Thanks!

Here's a really extreme example of the problem:

\documentclass{book}
%%
% Set page layout geometry
% The asymmetric option keeps the margin notes always on the same side of the page which is the way Tufte does it.
\usepackage[
letterpaper,
asymmetric,
includemp,
headheight=0.5in, % needs to be big enough for the Intel logo graphic
left=1.25in,
width=6.75in,
marginparsep=0.25in,
marginparwidth=2in,
bottom=1in,
top=1in,
nofoot,
{geometry}

\usepackage{lipsum}
\usepackage{floatrow}

\floatsetup[figure]
{
floatwidth=\linewidth,
capposition=beside,
capbesideposition={right,center},
capbesideframe=yes,
capbesidewidth=\marginparwidth,
}

\begin{document}
\lipsum[1]
\begin{figure}[ht]
\centering
\rule{8cm}{1cm}
\caption{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
tristique senectus et netus et malesuada fames ac turpis egestas. Mauris.}
\end{figure}
\lipsum[2]
\end{document}


Here's what it looks like:

Now with TH's \smashcaption fix:

-
Your example doesn't compile for me. – TH. Mar 25 '11 at 22:58
When I copy the code into a new document and try to compile it. I get the error ! Package floatrow Error: Undefined float separator 'marginparsep'. – TH. Mar 25 '11 at 23:18
Yes, I see that too now. Works under xetex (my default), but nothing else. Will correct. – srking Mar 25 '11 at 23:24
I removed the excessive whitespace from your images. – Hendrik Vogt Mar 26 '11 at 22:27

Commenting out the line that causes your example to not compile, here's a solution. Define a new macro \smashcaption as follows.

\makeatletter
\newcommand*\smashcaption{
\def\FR@makecaption##1##2{%
\vbox to\z@{%
\vss
\captionfont
{\captionlabelfont##1}\caption@lsep##2%
\par
\vss
}%
}%
\caption
}
\makeatother


Now replace \caption in your code with \smashcaption and you get what I believe you want.

-
Works really well! Thanks TH! Your macro will give me something to study as well. – srking Mar 25 '11 at 23:35
@srking: You can also just make that redefinition globally if you want. Then all \captions will have that effect. – TH. Mar 26 '11 at 0:11
My example neglected to mention I was using the caption package. I am trying to recreate the formatting like so but it's still not formatted correctly: % {\captionlabelfont ##1}{\space\textendash\space}{\captiontextfont ##2}% – srking Mar 26 '11 at 4:31
@srking: Does replacing my ##1: ##2 with that not work? I'd expect it to. – TH. Mar 26 '11 at 8:08
@TH - It seems that the caption package doesn't provide a means to extract the effective caption formatting. For example, \captionlabelfont correctly made the font boldface, but not the correct size. I ended up just rebuilding my simple format from scratch. In my case: \small{\textbf{##1}{\space\textendash\space}##2}. It took me two hours to debug line spacing problems in the paragraph due to \small fontsize inadvertently not being in effect at the end of the statement. I think your smash option would be a nice addition to the caption package. Cheers. – srking Mar 26 '11 at 15:39