Home General LaTeX tips and tricks → Tables next to drawings [Previous Page] [Question index] [Next Page]

25. How can you get tables and drawings side by side in a figure?


Answer

Doing this is fairly well documented in the usual places, but nevertheless it took me enough tweaking before I finally got it right that I thought it couldn't hurt to devote a separate page to it.

The trick is to remember that a figure in LaTeX does not necessarily refer to just a single drawing or table, but that you can for example use minipages to create a single figure out of individual components. Once you realise that, the rest just becomes a matter of playing with scaling and placement factors. Experimenting is the key, and using dummy drawings that consist entirely of a black box will help enormously.


Example usage

In the document:


The results for each of the three systems are given in
Figures~\ref{fig:sor-v},~\ref{fig:sor-s} and~\ref{fig:sor-f}, while
Figure~\ref{fig:sor-sor} provides an aggregate view of the same results.

\begin{figure}[htb]
  \centering
  \begin{minipage}[c]{0.38\textwidth}
    \centering
    \input{benchmarks/sor-v.tab}
  \end{minipage}
  \begin{minipage}[c]{0.58\textwidth}
    \includegraphics[width=\textwidth]{benchmarks/sor-v}
  \end{minipage}
  \figcaption{SOR;\@\vnus{} version, compiled by \rotan{}.}\label{fig:sor-v}
\end{figure}

\textit{Analysis:} These figures illustrate that the benchmarks obtained

...

In this listing the file benchmarks/sor-v.eps will contain the graph, and benchmarks/sor-v.tab contains the LaTeX code for the table (it is in a separate file because this code is in fact generated by my filter program from the original data file (see the thesis sources for more details)).

Note that the two minipage width factors (0.38\textwidth and 0.58\textwidth) together add up to 0.9 instead of 1.0, because I did not want the figure to be as wide as a normal line of text.


Result

After' screenshot

[Previous page] [Question index] [Next page]

Leo Breebaart (leo@lspace.org)
Last updated: 27 June 2016