2

I have a small picture of a graph and I would like to align it with its adjacency matrix, defined within math environment, side by side on a page. I tried to use subfig package, but the matrix is then misaligned (it begins vertically in the middle of the picture).

EDIT: I have

\begin{figure}[H]
\centering
\includegraphics{Graph1.png}
\qquad\qquad
\begin{minipage}{1.2in}
\begin{math}
\begin{matrix}
1 & 0 & 1 & 1 & 0 & 1\\
0 & 1 & 0 & 1 & 0 & 1\\
1 & 0 & 1 & 0 & 1 & 1\\
1 & 1 & 0 & 1 & 1 & 0\\
0 & 0 & 1 & 1 & 1 & 0\\
1 & 1 & 1 & 0 & 0 & 1
\end{matrix}
\end{math}
\end{minipage}
\end{figure}

If you include it in a document, you will see the matrix is "misaligned" - it is lower than the image. I would like them verticaly centered to the center.

If I add

\parbox{1.2in}{\includegraphics{Graph1.png}}

then it is working, but I get Overfull \hbox.

  • Hi Jakub, Welcome to TeX.SE!! Could you provide a screenshot of what you're looking for, ideally with MWE. I'm confident this problem can be solved, perhaps with minipages – cmhughes Mar 26 '12 at 15:24
5

Maybe

\raisebox{-.5\height}{\includegraphics{Graph1.png}}

does what you want?

  • Nice, that got me rid of the Overfull. Thank you. – Jakub Zaverka Mar 26 '12 at 15:56
  • Another way, with amsmath, is \begin{gathered}\includegraphics{Graph1.png}\end{gathered} – egreg Mar 26 '12 at 23:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.