# Allow floatfoot to left-align beneath figure, but extend past right

I can set my \caption and my \floatfoot as separate widths, using the following example, based on the answer to my previous question: Different width for caption and floatfoot with floatrow

\documentclass{article}
\usepackage{floatrow}
\usepackage[demo]{graphicx}
\usepackage{siunitx}
\usepackage{caption}

\begin{document}

\begin{figure}
\RawCaption%
{\caption{Selected Interatomic Distances of Protons in $\beta$-Pinene Normal Lactone}%
\label{fig:noeDistances}}\vskip\captionskip
\floatbox[{\captop}]{figure}[\FBwidth]
{}
{\includegraphics{nOeDistances}
\floatfoot{\textsuperscript{1}All distances reported are in \si{\angstrom}.%
\\ \textsuperscript{2}Selected carbon numbering is given in cyan.}}
\end{figure}

\end{document}


However, I've found that in this case the second footnote wraps because the figure width is quite small. The result I had intended to achieve, would be that the \floatfoot would be left aligned to the figure, but be able to extend past the right of the figure.

I did try setting the width of the \floatbox to something greater than \FBwidth using the calc package, and then use \FBwidth*\real{1.5}, but this predictably puts half the extra space on each side of the float. Resulting in the \floatfoot no longer being left-aligned.

I've also considered manually calculating the width of the image, then setting the margins myself, something like:

\def\mygraphic{\includegraphics{nOeDistances}}
\newlength\graphicwidth
\setlength\graphicwidth{\widthof{\mygraphic}}
\newlength\leftMarg
\newlength\rightMarg
\setlength\leftMarg{\textwidth-\graphicwidth/2}
\setlength\rightMarg{0pt}


But I'm just not familiar enough to complete the idea.

-
I have a possible simple solution, but it is so ugly that I prefer to wait to see if someone else provides a better approach. If no better solution appears, I will post mine. –  Gonzalo Medina Jul 20 '12 at 22:57

This is a solution I really don't like, but (as I said in a comment) I will post it since no one else has provided a better approach.

The idea is to set the \floatbox width to something greater than \FBwidth and then manually (this is the part I don't like) correcting the alignment for the \floatfoot material.

\documentclass{article}
\usepackage{floatrow}
\usepackage[demo]{graphicx}
\usepackage{siunitx}
\usepackage{caption}

% a length to store the current \FBwidh value for latter use
\newlength\mylena

\begin{document}

\begin{figure}
\RawCaption%
{\caption{Selected Interatomic Distances of Protons in $\beta$-Pinene Normal Lactone}%
\label{fig:noeDistances}}\vskip\captionskip
\floatbox[{\captop}]{figure}[1.4\FBwidth\setlength\mylena\FBwidth]
{}
{\includegraphics{nOeDistances}
\floatfoot{\hspace*{0.15\mylena}\textsuperscript{1}All distances reported are in \si{\angstrom}.%
\hfill\null\\\hspace*{0.15\mylena}\textsuperscript{2}Selected carbon numbering is given in cyan.}}
\end{figure}

\end{document}


-
Thanks, works great! I got the MWE working, but not in my document. It turns out that this method and the xifthen or mhchem package do not work. I found a way to not use those packages however. Using either of those generates an error staying: "! Package calc Error: \let ' invalid at this point." One question I do have is how do you generate the values of 1.4 and 0.15? The 1.4 is however much I need for the floatfoot to not run onto a second line of text. However, I'm not sure about the 0.15. Was there a way you determined that, or simply by experimenting? (I hope there is a formula) –  J M Jul 22 '12 at 3:33
@JM unfortunately the value 0.15 was determined by trial and error (that's why I don't like my solution). I initially thought that a factor of 1.4 for \FBwidth will have to be balanced with 0.2 (= 1/2*(1.4-1)), but this was not the case; I couldn't find an explicit formula relating those two values :-( –  Gonzalo Medina Jul 22 '12 at 16:39
Not a problem. I've found that I'm only likely to use a few various values for the \FBwidth modification, and that it's not too difficult to play around with the factors used then for the \hfill` It works great for what I need, and looks awesome too :) –  J M Jul 22 '12 at 17:33