# How can I put picture in a table!

I can put a picture in a table (cheer!), but I want to put a picture with a caption in my table and it's caption will disappear. My table includes both a picture and a tikz. how can I do it?

This is code:

\begin{table}[h!]
\begin{center}‎
\begin{tabular}{|c‎‎|c|}‎
\hline
\begin{figure}[h]‎
‎   \centering‎
‎\includegraphics[width=3cm]{Pics/01_01.bmp}‎‎‎\\\caption{My Caption‎‎ ‎‎‎$B$‎}
‎   \label{Gauss1}‎
\end{figure}‎‎‎
&
\begin{tikzpicture}
\begin{axis}
[grid=major,samples=30,mark=none]
{x^3};
\end{axis}
\end{tikzpicture}‎
\\ \hline
\end{tabular}
\caption{fig Analysis}
\label{tbl:mro}
\end{center}
\end{table}

• Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Rmano Jun 17 '16 at 9:45
• You can use a plain \includegraphics{…}\\\captionof{figure}{A caption}. – Bernard Jun 17 '16 at 9:53
• @Bernard Thank you, but it doesn't work. – Nosrati Jun 17 '16 at 10:13
• Could you post a minimal (non-) working example? – Bernard Jun 17 '16 at 10:35
• Don't use the figure environment. Just use \includegraphics on its own. – Ian Thompson Jun 17 '16 at 11:46

But you can put one inside a minipage inside a tabular. Also, you can use \captionof{figure} inside a table.

Note: table and figure are floats, whose purpose is to move stuff to the top or bottom of the page. If you don't want your stuff to move, don't use floats; use a minipage and \captionof instead.

\documentclass{article}
\usepackage{pgfplots}
\usepackage{caption}

\begin{document}

\begin{table}
\centering

\begin{tabular}{|c|c|}
\hline
\begin{minipage}[c]{3cm}
‎\includegraphics[width=3cm]{example-image}‎‎‎
\captionof{figure}{My Caption‎‎ ‎‎‎$B$‎}
‎    \label{Gauss1}‎
\end{minipage}‎‎‎
&
\begin{tikzpicture}[baseline=(current bounding box.center)]
\begin{axis}
[grid=major,samples=30,mark=none]
{x^3};
\end{axis}
\end{tikzpicture}‎ \\
\hline
\end{tabular}

\caption{fig Analysis}
\label{tbl:mro}

\end{table}

\end{document}


• Don't use center in a table or figure environment, \centering is better. If, for some reasons (there can be) caption cannot be used, capt-of is the package of choice for \captionof. – egreg Jun 17 '16 at 15:21
• @egreg - Mea culpa. – John Kormylo Jun 17 '16 at 15:57