6

I'd like to have an eqnarray environment (or equivalent) within a table caption. If I do this naively,

\begin{table*}
  % table stuff
  \caption{\label{tab:my_tab}
    \begin{eqnarray}
      a &=& b \\ c &=& d
    \end{eqnarray}
  }
\end{table*}

LaTeX falls over with LaTeX Error: \begin{table*} ended by \end{eqnarray}. How can I get what I want (I don't mind no equation numbers)?

Walter
  • 1,227
  • 3
  • 12
  • 15

1 Answers1

15

Yes you can, if you enclose it in minipage:

\caption{\label{tab:my_tab}\leavevmode\\\begin{minipage}{\linewidth}
  \begin{align}
    a &= b \\ c &= d
  \end{align}
  \end{minipage}
}
  • The \leavevmode\\ is there to make the equation push below the text Table:
  • As well, notice that eqnarray is deprecated and you may use align from \usepackage{amsmath}.
  • And as @David points out, don't forget to make a short caption as well for the List of tables.
  • Last point, numbering equations at such place is rather strange, as barbara pointed out. You can use \begin{align*}...\end{align*} to suppress it.
yo'
  • 51,322
  • is a label really wanted on the multi-line equation, or (in this case) two labels? i find that mighty peculiar. – barbara beeton Dec 06 '12 at 18:03
  • @barbarabeeton That's a matter of the taste of the author, but I'll add a notice on suppressing it. – yo' Dec 06 '12 at 18:04
  • @tohecz - This does not seem to be working when I'm trying to use equations in the caption of a tikzpicture (encapsulated inside a figure env). Is there some other way to go about it? – TCSGrad Aug 22 '13 at 12:54
  • @TCSGrad The caption has to go outside tikzpicture (but inside figure). You can ask a follow-up question where you explain that this solution does not work for you. If you construct a Minimal (non)-Working Example, I'm sure we'll manage to solve the problem ;) – yo' Aug 22 '13 at 20:59
  • @tohecz - The question with MWE is here: http://tex.stackexchange.com/questions/129834/how-to-have-aligned-equations-in-a-caption-of-a-tikzpicture – TCSGrad Aug 24 '13 at 00:51