0

Is there a way to reduce the white space between the figure and the caption in this MWE:

\documentclass{iopart}
%\documentclass{article}
\usepackage{graphicx}
\usepackage{mwe}
\usepackage{sidecap}
\begin{document}
\begin{SCfigure}[50]
    \includegraphics[width=0.6\linewidth]{example-image-a}
    \caption{Long long long long long long long long long long long 
    long long long long long long long long long long long long long 
    long long long caption}
\end{SCfigure}
\end{document}

enter image description here

I would like this to look more like in the same example with the article document class:

enter image description here

1

This is a consequence of how iopart indents captions; set \mathindent to zero in the SCfigure environment to avoid the issue.

\documentclass{iopart}
\usepackage{graphicx}
\usepackage{sidecap}
\usepackage{etoolbox}

\usepackage{showframe} % just for the example

\AtBeginEnvironment{SCfigure}{\mathindent=0pt }

\begin{document}

\begin{SCfigure}[50]
\includegraphics[width=0.6\linewidth]{example-image-a}

\caption{Long long long long long long long long long long long 
  long long long long long long long long long long long long long 
  long long long caption}

\end{SCfigure}

\begin{figure}[htp]
\centering
\includegraphics[width=0.6\linewidth]{example-image-a}

\caption{Long long long long long long long long long long long 
  long long long long long long long long long long long long long 
  long long long caption}

\end{figure}

\end{document}

enter image description here

  • Thank you, this is way more elegant than the hack that I found. – bers Oct 26 '18 at 8:24
  • @bers Yours would change the appearance of all captions, which I don't think is what people at IOP wants. If you aren't submitting to them, I suggest not using iopart at all. – egreg Oct 26 '18 at 8:51
  • You sure are aware that I can use my patch in a group cotaining just the figure in question, so that other captions would not be impacted. Still, your solution is better (just not for the reason you mention). – bers Oct 26 '18 at 9:02
0

This works:

\usepackage{xpatch}
\makeatletter
\patchcmd{\@makecaption}{\begin{indented}
\item[]}{}{}{err}
\patchcmd{\@makecaption}{\end{indented}}{}{}{err}
\makeatother

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.