3

I'd like to create a figure consisting of two subfigures without using the caption or subcaption package since these two packages seem to destroy my template. But all the solutions for subfigures I could find in the Internet use these two packages. What other possibilities do I have? I want the two figures in a 2-column layout to cover both columns and each figure should be 1 column width.

  • You could use the subfig package without caption package: \usepackage[caption=false]{subfig}. (Actually this still loads caption3.sty but this does not make any harm since this will not re-define anything but only provide a library for typesetting captions used by the subfig package internally.) – Axel Sommerfeldt Sep 12 '13 at 7:26
4

Using minipages and a new counter you can produce your subfigures without any packages at all; you can also define a command to provide subcaptions:

\documentclass[twocolumn]{article}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{chngcntr}

\newcounter{mysfig}
\counterwithin{mysfig}{figure}

\renewcommand\themysfig{\thefigure(\alph{mysfig})}
\makeatletter
\newcommand\Scaption[1]{%
\refstepcounter{mysfig}%
\vskip.5\abovecaptionskip
  \sbox\@tempboxa{\small\themysfig~#1}%
  \ifdim \wd\@tempboxa >\hsize
    \small\themysfig~#1\par
  \else
    \global \@minipagefalse
    \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
  \fi
  \vskip\belowcaptionskip}
\makeatother

\begin{document}
\lipsum[1-2]
\begin{figure*}
\stepcounter{figure}
\begin{minipage}[t]{\columnwidth}
\begin{minipage}[b]{\columnwidth}
\includegraphics[width=\linewidth]{example-image-a}\par
\end{minipage}
\Scaption{this is the caption for the left subfigure}
\label{sfig:testa}
\end{minipage}\hfill
\begin{minipage}[t]{\columnwidth}
\begin{minipage}[b]{\columnwidth}
\includegraphics[width=\linewidth]{example-image-b}
\end{minipage}
\Scaption{this is the caption for the right subfigure, spanning two lines}
\label{sfig:testb}
\end{minipage}%
\end{figure*}
\lipsum[1-5]
References to subfigures~\ref{sfig:testa} and~\ref{sfig:testb}

\end{document}

enter image description here

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.