# Horizontal positioning of caption in sidecap figure

I need to control the horizontal spacing between my figure and the related caption, which I am putting on the right of it by sidecap. How can I achieve it? Using floatrow instead of sidecap, is not an option for me due to some proprietary documentclass I need to work on which is not compatible with floatrow. I tried by setting skip in the caption package in the preamble, but it does not work apparently.

The MWE is:

\documentclass{article}
\usepackage[demo]{graphicx}
% Some basic caption settings
\usepackage[style=base,skip=0pt]{caption}  %% skip here does not seem to have any effect
\captionsetup{font=footnotesize,labelfont=bf,labelsep=period}
% caption on the top right
\usepackage[rightcaption]{sidecap}
\sidecaptionvpos{figure}{t}

\begin{document}
\begin{SCfigure}
\includegraphics[width=0.8\textwidth]{name}
\caption*{This is going to be a long caption, and I need to have it as much as possible within the figure space, so I want to control the horizontal space between figure and caption optimally...}
\end{SCfigure}

\end{document}

• Have you thought about an own caption format? – TeXnician Feb 16 '17 at 13:06
• @TeXnician Not really. Could you elaborate more on that? How could I do that? Is it the fastest solution? Perhaps using minipage... – maurizio Feb 16 '17 at 13:07

You could individually style it with your own caption style. This has only one main disadvantage: If you use a \parbox as I would suggest you have a fixed width of the caption for each figure (which is not very practical unless you typeset the caption into the margin).

\documentclass{article}
\usepackage[demo]{graphicx}
% Some basic caption settings
\usepackage[style=base]{caption}  %% skip here does not seem to have any effect
\DeclareCaptionFormat{side}{\hspace*{1cm}\parbox{4cm}{#1#2#3}}
\captionsetup{format=side,font=footnotesize,labelfont=bf,labelsep=period}
% caption on the top right
\usepackage[rightcaption]{sidecap}
\sidecaptionvpos{figure}{t}

\begin{document}
\begin{SCfigure}
\includegraphics[width=0.8\textwidth]{name}
\caption*{This is going to be a long caption, and I need to have it as much as possible within the figure space, so I want to control the horizontal space between figure and caption optimally...}
\end{SCfigure}

\end{document}

• I see what you mean. Well, in practice SCfigure has also an additional optional relwidth argument which somehow limits the max extension of the caption. Let me try it. My point is that there seems not to be a direct way to control this space. I was looking for something like \sidecaptionvpos but there is not an equivalent for hpos within the caption it seems... – maurizio Feb 16 '17 at 13:17
• Ok, it did the trick, although indeed, it is not the ideal solution, insofar as it requires every time manually changing \parbox or \hspace* values when the figure changes or is rescaled.... – maurizio Feb 16 '17 at 14:06
• @maurizio I know, maybe there will be one with another solution in the future. – TeXnician Feb 16 '17 at 14:08