Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have two matrices side by side, like this:

\[
  \left[\begin{array}{cc}
    a & b \\
    c & d
  \end{array}\right] \qquad
  \left[\begin{array}{cc}
    e & f \\
    g & h
  \end{array}\right]
\]

The result is this:

I want to:

  1. have a caption to both matrices
  2. if possible, have it recognized as figure (so it appears on the figure list).
share|improve this question
2  
Similar question: Two figures side by side –  mkota Nov 24 '12 at 4:40
add comment

2 Answers 2

up vote 7 down vote accepted

Not entirely sure whether this satisfies all your constraints (since I'm not putting the sub-captions in the LoF):

enter image description here

\documentclass{article}
\begin{document}
\begin{figure}
  \begin{minipage}{.5\linewidth}
    \centering
    \[A=\left[\begin{array}{cc}
      a & b \\
      c & d
    \end{array}\right]\]
    Short caption for matrix~$A$
  \end{minipage}%
  \begin{minipage}{.5\linewidth}
    \centering
    \[A'=\left[\begin{array}{cc}
      e & f \\
      g & h
    \end{array}\right]\]
    Short caption for matrix~$A'$
  \end{minipage}
  \caption{A caption to the entire figure}
\end{figure}
\end{document}

The idea is to place two minipages of .5\linewidth inside a figure. Yes, the figure environment can contain anything inside of it, even mathematics, even a tabular, even an image. It merely acts as a place holder that floats around.

Within each minipage the contents can be supplied in whichever way you like. As I've done in the above example, a display equation is used, together with regular centred text below. You can modify the "short captions" to be \small or \footnotesize, if needed.

If the requirement is to have the "short captions" form part of the LoF, some more work is required.

share|improve this answer
add comment

In the following MWE you will find a solution for your problem using package subfig:

%http://tex.stackexchange.com/questions/84021/caption-on-side-by-side-matrices
\documentclass{article}

\usepackage{subfig}
\usepackage{amsmath}
\usepackage{array}

\begin{document}

\listoffigures

\section{My Work}

\begin{figure}[htb]
  \centering
  \subfloat[Image A][The Image A%
    \label{subfig:imageA}]{%
    \begin{math}
    \left[\begin{array}{cc}
    a & b \\
    c & d
    \end{array}\right]
    \end{math}
    }% 
   \qquad   % Distance Image A and B 
  \subfloat[Image B][The Image B%
    \label{subfig:ImageB}]{% 
    \begin{math}
    \left[\begin{array}{cc}
    e & f \\
    g & h
    \end{array}\right]
    \end{math}
  } 
  \caption{Image with two subfigures}
  \label{fig:ImageAB}
\end{figure} 

In figure~\ref{fig:ImageAB} you see two subfigure~\ref{subfig:imageA} and \ref{subfig:ImageB}.

\end{document}

With \subfloat you define a sub figure, \qquad is the distance between the two sub figures. You can reference the complete figure or both of the sub figures (see last sentence in MWE). A list of figures shows your figure as wanted.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.