### Learn how to vertically align two figures on latex / Como alinhar duas figuras verticalmente no latex

Putting two figures side-by-side using the subfig package is very easy. When the figures have the same size (height), they are shown as expected. However, when a big and a small figure should be arranged side by side, it may not be that trivial task.

Here you can see what I do to put two figures side-by-side when they are different in size. In this example I put a figure and a tabular side-by-side, but you can (and must of course) adjust it as you need.

\newsavebox{\leftfig}
\newsavebox{\rightfig}
\begin{figure}[!h]
\centering
\sbox{\leftfig}{\includegraphics[width=5.5cm]{nameOfaFigure.eps}}%
\sbox{\rightfig}{
[m] = \begin{tabular}{|cccccc|}
0 &1 &1 &0 &0 &0\\
1 &0 &1 &1 &0 &0\\
1 &1 &0 &0 &1 &0\\
0 &1 &0 &0 &1 &1\\
0 &0 &1 &1 &0 &1\\
0 &0 &0 &1 &1 &0
\end{tabular}
}%
\subfloat[subfloat 1\label{fig:graph}]{%
\begin{minipage}[b]{0.49\linewidth}\centering%
\usebox{\leftfig}
\end{minipage}
}%
\hfill%
\subfloat[subfloat 2\label{fig:matrix}]{%
\begin{minipage}[b]{0.49\linewidth}\centering%
\raisebox{1.5cm}{\usebox{\rightfig}}
\end{minipage}
}%
\caption{The caption goes here}
\label{fig:label of the whole figure}
\end{figure}

Anúncios

#### 0 Responses to “Learn how to vertically align two figures on latex / Como alinhar duas figuras verticalmente no latex”

1. Deixe um comentário