# Horizontally shifting subfloat captions in figure environement!

When using subfloat, the caption centers with regards to the figure width. However I want to center it with regards to the axes. How to horizontally shift the captions (manually) for all the subfloats in a figure environment, to center to axes?

(My figures are in PDF format.)

-

To shift the sub-captions to the left or right one could use the margin= option offered by the caption package. The following example document will shift the sub-captions 2cm to the right:

\documentclass{article}
\usepackage{subfig}
\usepackage[demo]{graphicx}
\begin{document}
\begin{figure}
\centering
\captionsetup[subfigure]{oneside,margin={2cm,0cm}}
\subfloat[]{\includegraphics[width=4cm]{test1}}
\hspace{1cm}
\subfloat[]{\includegraphics[width=4cm]{test1}}
\caption{Caption text}
\end{figure}
\end{document}


Please note the usage of the additional option oneside which will make sure that the extra sub-caption margins will not be swapped in twoside documents.

(Of course this trick will work in conjunction with the subcaption package as well.)

-

If you are willing to change the format of your figure calls to \bxfigure{caption}{image}, the boxhandler package can do this for you with their \FigureDeadMargin setting and the use of a \rule. It would look something like

\documentclass{article}
\usepackage{boxhandler}
\begin{document}

\captionStyle{n}{}