5

I cannot get my caption left justified correctly for wide floats. I have facing pages, and after many experiments, the closest I've come to success is a proper layout only for odd pages.

I would like both the wide figure and and the caption to be left justified on the page. I would like the caption to be much less wide that the float.

Here's my MWE:

\documentclass[openright,twoside]{book}
\usepackage[facing=yes]{floatrow}
\usepackage{caption}
\usepackage{lipsum}
\usepackage{tabulary}

%%
% 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.
\RequirePackage[
    letterpaper,
    asymmetric,
    includemp,
    inner=0.5in,
    bindingoffset=1.0in,
    width=6.75in,
    marginparsep=0.25in,
    marginparwidth=2in,
    showframe,
    ] {geometry}

\floatsetup[widefloat]
    {
    floatwidth=6.75in,
    objectset=raggedright,
    }
%
\captionsetup[widefloat]
    {
    margin={0pt,2.25in},
    justification=justified,
    font=small
    }

\begin{document}

\lipsum[2]

\begin{table*}[ht]
    \begin{tabulary}{\linewidth}{|L|l|l|l|l|l|l|}
        \hline
        foofoofoo & barbarbar & foofoofoo & barbarbar & foofoofoo & barbarbar & foofoofoo \\
        \hline
        \end{tabulary}
    \caption{Pellentesque habitant morbi tristique senectus et netus et malesuada
fames ac turpis egestas. Donec odio elit, dictum in, hendrerit sit amet,
egestas sed, leo. Praesent feugiat sapien aliquet odio. Integer vitae justo.}
\end{table*}

\clearpage
\lipsum[2]

\begin{table*}[ht]
    \begin{tabulary}{\linewidth}{|L|l|l|l|l|l|l|}
        \hline
        foofoofoo & barbarbar & foofoofoo & barbarbar & foofoofoo & barbarbar & foofoofoo \\
        \hline
        \end{tabulary}
    \caption{Pellentesque habitant morbi tristique senectus et netus et malesuada
fames ac turpis egestas. Donec odio elit, dictum in, hendrerit sit amet,
egestas sed, leo. Praesent feugiat sapien aliquet odio. Integer vitae justo.}
\end{table*}

\end{document}

Here's the trouble I get into (showframe is on). Notice that the wide table is correctly flushed left, but the caption is hanging on the wrong side.

enter image description here

----- EDIT -----

As far as I can tell, floatrow has a bug swizzling left and right margins. This hack uses the changepage package to undo the margin swizzle:

\newcommand{\widecapfix}
{
    \checkoddpage
    \ifoddpage
        \captionsetup{margin={0in,2.25in}}
    \else
        \captionsetup{margin={2.25in,0in}}
    \fi
}

So, I must insert \widecapfix into each wide figure usage just above the caption. Pretty gross I think.

2

If you are willing to transition your tables from an environment to a command structure, I modified a boxhandler package routine to achieve, I think, your desired result. The changes I had to make to the \ReciteTable command were two-fold: I had to place the table caption after, rather than before, the table content; and I had to force the caption to be left justified in relation to the oversized table.

\documentclass[openright,twoside]{book}
\usepackage{lipsum}
\usepackage{tabulary}
\usepackage{boxhandler}

%%
% 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.
\RequirePackage[
    letterpaper,
    asymmetric,
    includemp,
    inner=0.5in,
    bindingoffset=1.0in,
    width=6.75in,
    marginparsep=0.25in,
    marginparwidth=2in,
    showframe,
    ] {geometry}

\makeatletter
\renewcommand\ReciteTable[6][ht]{%
  \begin{table}[#1]%
    \begin{\LRTablePlacement}%
      \let\@makecaption\new@makecaption%
      \setlength\abovecaptionskip{\arabic{abovecaptionskipterm}\p@}%
      \setlength\belowcaptionskip{\arabic{belowcaptionskipterm}\p@}%
        \set@DataBoxWidth{#3}%
        \setlength\CaptionBoxWidth{#4}%
        \set@BoxOffsets%
        \if T#6%
          \rule{\@DataBoxOffset}{0in}%
          \makebox[\@DataBoxWidth][l]{#5}%
          \rule{\@DataBoxOffset}{0in}\\%
        \fi
        \rule{\@DataBoxOffset}{0in}%
        \usebox{#3}%
        \rule{\@DataBoxOffset}{0in}\\%
        \par%
        \parbox{\CaptionBoxWidth}{\bx@caption{#2}}%
        \rule{\@CaptionBoxOffset}{0em}%
        \rule{\@CaptionBoxOffset}{0em}%
        \if T#6%
          \rule{\@DataBoxOffset}{0in}\\%
          \makebox[\@DataBoxWidth][r]{#5}%
        \rule{\@DataBoxOffset}{0in}%
        \fi
      \let\@makecaption\old@makecaption%
      \setlength\abovecaptionskip \oldabovecaptionskip%
      \setlength\belowcaptionskip \oldbelowcaptionskip%
    \end{\LRTablePlacement}%
  \end{table}%
}
\makeatother

\begin{document}

\lipsum[2]

\constrainCaptionWidth{\textwidth}
\captionStyle{n}{l}
\setlength\TableDeadMargin{0em}

\bxtable[ht]{Pellentesque habitant morbi tristique senectus et netus et malesuada
fames ac turpis egestas. Donec odio elit, dictum in, hendrerit sit amet,
egestas sed, leo. Praesent feugiat sapien aliquet odio. Integer vitae justo.}
{%
\normalsize
    \begin{tabulary}{6.75in}{|L|l|l|l|l|l|l|}
        \hline
        foofoofoo & barbarbar & foofoofoo & barbarbar & foofoofoo & barbarbar & foofoofoo \\
        \hline
        \end{tabulary}
}

\clearpage
\lipsum[2]

\bxtable[ht]{Pellentesque habitant morbi tristique senectus et netus et malesuada
fames ac turpis egestas. Donec odio elit, dictum in, hendrerit sit amet,
egestas sed, leo. Praesent feugiat sapien aliquet odio. Integer vitae justo.}
{%
\normalsize
    \begin{tabulary}{6.75in}{|L|l|l|l|l|l|l|}
        \hline
        foofoofoo & barbarbar & foofoofoo & barbarbar & foofoofoo & barbarbar & foofoofoo \\
        \hline
        \end{tabulary}
}

\end{document}
2
  • thanks for the huge effort to help. Unfortunately, this problem is part of a class file and I can't ask users to change from standard table* and figure* environments. – srking Apr 9 '13 at 15:54
  • @srking No problem. It was easy, since I wrote boxhandler package. FYI, while it may seem drastic, our large organization has adopted the boxhandler way of doing figures & tables as its standard method, because we have a bizarre margin style that boxhandler nicely solves. – Steven B. Segletes Apr 9 '13 at 17:21

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.