[Tex/LaTex] How to adjust subfigure caption width

subfigsubfloatstex-core

I'm trying to put subfigures side by side. I used the following code.

\begin{figure}
\begin{centering}
\begin{minipage}[b][1\totalheight][t]{0.45\columnwidth}%

\subfigure[subfig a]{\label{fig:sa}}
\includegraphics[scale=0.15]{clust3-actual12-outlier-removed}
\end{minipage}

\begin{minipage}[b][1\totalheight][t]{0.45\columnwidth}%

\subfigure[subfig b]{\label{fig:sb}}
\includegraphics[scale=0.10]{clust11_long-actual75-outlier-removed}
\end{minipage}

\end{centering}
\caption{Figure}
\end{figure}

I am getting the following output

enter image description here

I get error if I try the more usual

 \begin{subfigure}
   ...
 \end{subfigure}

This may have something to do with the ICML template I'm working on (here)

How do I adjust the caption width in my working \subfigure syntax?

Best Answer

to have sub figures in line, you shouldn't have empty line between them (unless you wish to create a line break between the subfloasts). additionally consider:

  • \subfigure is defined with deprecated package subfigure. It is superseded by the subfig package, with syntax \subfloat[...][<title>]{....} (see mwe below)
  • with \subfloat the width of caption is equal to width of sub image.
  • use of minipages is superfluous.

enter image description here

\documentclass{article}
\usepackage[demo]{graphicx} % remove 'demo' option in real document
\usepackage{subfig}

\begin{document}
    \begin{figure}
\centering
\subfloat[subfigure a]{\label{fig:sa}
    \includegraphics[scale=0.15]{clust3-actual12-outlier-removed}}
%
\subfloat[subfigure b]{\label{fig:sb}
    \includegraphics[scale=0.10]{clust11_long-actual75-outlier-removed}}
\caption{Figure}
\label{fig:s}
    \end{figure}
\end{document}