Math & Science ⇒ Putting on the same line a matrix and a figure
-
- Posts: 4
- Joined: Mon May 09, 2011 6:59 pm
Putting on the same line a matrix and a figure
Hi all!
Does anyone of you know how to put on the same line a matrix and an image in the figure environment? I would be really grateful in your help!
Giovanni
Does anyone of you know how to put on the same line a matrix and an image in the figure environment? I would be really grateful in your help!
Giovanni
Last edited by soldigiovanni on Wed May 11, 2011 2:00 pm, edited 1 time in total.
NEW: TikZ book now 40% off at Amazon.com for a short time.

- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Putting on the same line a matrix and a figure
Hi Giovanni,
welcome to the board!
Just write the matrix, using inline math such as $...$ or \(...\), and write \includegraphics{...} after it without a line break or a paragraph break respl. empty line. If both fits on the line, it works. Also within a figure environment.
Stefan
welcome to the board!
Just write the matrix, using inline math such as $...$ or \(...\), and write \includegraphics{...} after it without a line break or a paragraph break respl. empty line. If both fits on the line, it works. Also within a figure environment.
Stefan
LaTeX.org admin
-
- Posts: 4
- Joined: Mon May 09, 2011 6:59 pm
Re: Putting on the same line a matrix and a figure
Ah ok perfect! Now my doubt is: how can i insert the matrix with $...$ or \(...\)?
I usually use:
\begin{pmatrix}
.. & .. \\
.. & ..
\end{pmatrix}
Thx a lot,
Giovanni
I usually use:
\begin{pmatrix}
.. & .. \\
.. & ..
\end{pmatrix}
Thx a lot,
Giovanni
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Putting on the same line a matrix and a figure
Just insert that environment there, matrices also work in inline math mode.
Stefan
Stefan
LaTeX.org admin
-
- Posts: 4
- Joined: Mon May 09, 2011 6:59 pm
Putting on the same line a matrix and a figure
Thx Stefan! It works.
And if I would like to adjust the position of the matrix and of the figure, how can I do? The matrix appears below, while the image on the right upper. I paste you the code:
Thx! I'm writing my master thesis 
Giovanni
And if I would like to adjust the position of the matrix and of the figure, how can I do? The matrix appears below, while the image on the right upper. I paste you the code:
Code: Select all
\begin{figure}
\begin{tabular}{cc}
$\begin{pmatrix}
0 & 0 & 0 & 0 & 0 & 0 &0 \\
0 & 1 & 1 & 0 & 1 & 1 &0 \\
0 & 1 & 0 & 1 & 0 & 1 &0 \\
0 & 1 & 0 & 1 & 0 & 1 &0 \\
0 & 1 & 0 & 1 & 0 & 1 &0 \\
0 & 1 & 1 & 1 & 1 & 1 &0 \\
0 & 1 & 1 & 0 & 1 & 1 &0 \\
0 & 0 & 0 & 0 & 0 & 0 &0 \nonumber
\end{pmatrix} $ &
\includegraphics[scale = 0.3, keepaspectratio = 0.3]{variance} \\
\end{tabular}
\end{figure}

Giovanni
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Putting on the same line a matrix and a figure
Hi Giovanni,
to make code more readable, you can insert code tags. I just did it for you. When writing or editing, a Code button is available above the edit field.
For vertical centering, you could use \vcenter:
You don't need to use tabular here.
Stefan
to make code more readable, you can insert code tags. I just did it for you. When writing or editing, a Code button is available above the edit field.
For vertical centering, you could use \vcenter:
Code: Select all
\begin{figure}
$\begin{pmatrix}
0 & 0 & 0 & 0 & 0 & 0 &0 \\
0 & 1 & 1 & 0 & 1 & 1 &0 \\
0 & 1 & 0 & 1 & 0 & 1 &0 \\
0 & 1 & 0 & 1 & 0 & 1 &0 \\
0 & 1 & 0 & 1 & 0 & 1 &0 \\
0 & 1 & 1 & 1 & 1 & 1 &0 \\
0 & 1 & 1 & 0 & 1 & 1 &0 \\
0 & 0 & 0 & 0 & 0 & 0 &0 \nonumber
\end{pmatrix} $
$\vcenter{\hbox{\includegraphics[scale = 0.3, keepaspectratio = 0.3]{variance}}}$
\end{figure}
Stefan
LaTeX.org admin
-
- Posts: 4
- Joined: Mon May 09, 2011 6:59 pm
Re: Putting on the same line a matrix and a figure
Awesome!
Thx
Thx