I am writing an article and I have to display figures side by side. I used the commands from the following link How to order 3 images horizontally? to do that. However, the figures are numbered in sequence, eg. Figure 1, Figure 2 Figure 3. I would like all of them to be part of same figure 1 and have subsections as (a) , (b) and (c).

migrated from stackoverflow.com Mar 15 '14 at 16:32

This question came from our site for professional and enthusiast programmers.

  • 1
    Welcome to TeX.SX! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. – egreg Mar 15 '14 at 16:40

You could also use the subcaption package and its subfigure environment. The following example sets up the subfigures so that they occupy the full width of the textblock. It also assumes that the graphs associated with each subfigure are all equally wide; if that's not the case, simply adjust the widths of the subfigures appropriately.

enter image description here

\usepackage[demo]{graphicx} % omit 'demo' for real document
\caption{First subfigure} \label{fig:1a}
\hspace*{\fill} % separation between the subfigures
\caption{Second subfigure} \label{fig:1b}
\hspace*{\fill} % separation between the subfigures
\caption{Third subfigure} \label{fig:1c}
\caption{A figure that contains three subfigures} \label{fig:1}
  • I always get the error "missing number, treated as zero", for \begin{subfigure}{0.31\textwidth} any ideas? – IceFire Apr 26 at 14:49
  • @IceFire - Do you load the subcaption or subfig package? (The answer shown above works only with the subcaption package...) – Mico Apr 26 at 15:17

You can use subfig package:


\subfloat[subfig-a's caption]{\includegraphics[height=1.8in]{...}}
\subfloat[subfig-b's caption]{\includegraphics[height=1.8in]{...}}
\subfloat[subfig-c's caption]{\includegraphics[height=1.8in]{...}}
  • Nice, but the subfig text is so tiny, how can I change that? – Pedro77 Sep 14 at 14:35
  • 1
    @Pedro77 Please refer to this thread. – herohuyongtao Sep 15 at 3:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy