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
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
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- Stefan Kottwitz
- Site Admin
- Posts: 10359
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Putting on the same line a matrix and a figure
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
-
- Posts: 4
- Joined: Mon May 09, 2011 6:59 pm
Re: Putting on the same line a matrix and a figure
I usually use:
\begin{pmatrix}
.. & .. \\
.. & ..
\end{pmatrix}
Thx a lot,
Giovanni
- Stefan Kottwitz
- Site Admin
- Posts: 10359
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Putting on the same line a matrix and a figure
Stefan
-
- Posts: 4
- Joined: Mon May 09, 2011 6:59 pm
Putting on the same line a matrix and a figure
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: 10359
- Joined: Mon Mar 10, 2008 9:44 pm
Putting on the same line a matrix and a figure
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
-
- Posts: 4
- Joined: Mon May 09, 2011 6:59 pm
Re: Putting on the same line a matrix and a figure
Thx