[Tex/LaTex] Subfigure space adjustment — \subfigcapskip and \subfigtopskip

floatsspacingsubfloats

I want to adjust the space in a subfigure environment. Specifically, using \subfigcapskip to increase the space between the subfigure and subcaption, and using \subfigtopskip to reduce the space on the top of the subfigure, simultaneously. I know that I can use either \subfigcapskip or \subfigtopskip in the following way, but how can I use \subfigcapskip and \subfigtopskip simultaneously?

\documentclass[9.5pt,conference,compsocconf,letterpaper]{IEEEtran}
\usepackage{graphicx}
\usepackage{subfigure}


\begin{document}

\begin{figure}[]
    \centering
    \begin{minipage}[htp]{0.5\textwidth}
        {\subfigcapskip = 20pt \subfigure[text A]{\includegraphics[width=0.47\textwidth]{a.eps}}}
        \subfigure[text B]{\includegraphics[width=0.47\textwidth]{b.eps}}
        \caption{text C}
    \end{minipage}
\end{figure}


\end{document}

Best Answer

The subfigure package is deprecated. With IEEEtran you can use subfig, with the option caption=false that doesn't load the incompatible package caption.

I repeat the figure twice, one with the default setting, one with a setting for farskip and nearskip to show the difference.

Note that the demo option for graphicx is just not to bother with a real file; the kantlipsum package provides mock text.

\documentclass[9.5pt,conference,compsocconf,letterpaper]{IEEEtran}
\usepackage[demo]{graphicx} % demo is just for the example
\usepackage[caption=false]{subfig}
\usepackage{kantlipsum} % just for the example

\begin{document}

\kant[1]

\begin{figure}[htp]
\centering
\subfloat[text A]{\includegraphics[width=0.47\columnwidth]{a.eps}}\hfill
\subfloat[text B]{\includegraphics[width=0.47\columnwidth]{b.eps}}
\caption{text C}
\end{figure}

\kant[2]

\begin{figure}[htp]
\captionsetup[subfloat]{farskip=0pt,nearskip=0pt}
\centering
\subfloat[text A]{\includegraphics[width=0.47\columnwidth]{a.eps}}\hfill
\subfloat[text B]{\includegraphics[width=0.47\columnwidth]{b.eps}}
\caption{text C}
\end{figure}

\kant

\end{document}

enter image description here