# matrix and figure side by side

I would like to put a matrix next to a figure in my text. Currently the display is as can be seen in the image. I prefer the matrix on the left and the tree on the right.

I am using this:

\usepackage{amsmath}
\usepackage{graphicx}
\includegraphics[scale=.8]{Graficos/arbolR1.pdf}
\caption{R-vine from Matrix M. Tree 1.}
\label{fig:R-vine1}

\begin{figure}
\centering
\small
\label{M}
$$M= \begin{pmatrix} 5&&&&&&&&\\ 8&1&&&&&&&\\ 2&8&2&&&&&&\\ 3&2&8&3&&&&&\\ 4&3&7&8&4&&&&\\ 9&4&9&7&8&8&&&\\ 7&9&3&9&7&9&7&&\\ 6&7&4&4&9&7&9&6&\\ 1&6&6&6&6&6&6&9&9\\ \end{pmatrix}$$
\caption{Matrix Structure}
\end{figure}


I will appreciate any help!!!!

• As long as you are using figures that happens. Have a look at subcaption. – TeXnician Oct 18 '17 at 19:26

Please see the following MWE (I used minipage for this):

\documentclass{article}

\usepackage{amsmath}
\usepackage{graphicx}

\begin{document}

\begin{figure}
\centering
\begin{minipage}[b]{.45\textwidth}
\includegraphics[width=\textwidth]{example-image-a}
\caption{First caption}\label{first}
\end{minipage}\hfill
\begin{minipage}[b]{.45\textwidth}
%\begin{figure}
\centering
\small
\label{M}
$$M= \begin{pmatrix} 5&&&&&&&&\\ 8&1&&&&&&&\\ 2&8&2&&&&&&\\ 3&2&8&3&&&&&\\ 4&3&7&8&4&&&&\\ 9&4&9&7&8&8&&&\\ 7&9&3&9&7&9&7&&\\ 6&7&4&4&9&7&9&6&\\ 1&6&6&6&6&6&6&9&9\\ \end{pmatrix}$$
\caption{Matrix Structure}\label{second}
%\end{figure}
\end{minipage}
\end{figure}

\end{document}


with the result:

• +1 for giving more options than existing here (tex.stackexchange.com/a/305131/120578). That answer is specific for tabular... So not a duplicate. Commenting just to show more existing solutions. – koleygr Oct 18 '17 at 19:55
• @WilmerRojas, If your problem is solved please accept the answer. – koleygr Oct 18 '17 at 21:52