Including images in a report is very common in LaTeX. Structuring your work nicely is probably the most obvious reason why you want to put two figures/tables side-by-side. Another reason might be to save space, wherever a smaller size of an image is sufficient. The following code can be used to place two figures side-by-side by creating a minipage
:
\begin{figure}[ht] \begin{minipage}[b]{0.45\linewidth} \centering \includegraphics[width=\textwidth]{filename1} \caption{default} \label{fig:figure1} \end{minipage} \hspace{0.5cm} \begin{minipage}[b]{0.45\linewidth} \centering \includegraphics[width=\textwidth]{filename2} \caption{default} \label{fig:figure2} \end{minipage} \end{figure}
Note, for certain figure manipulations such as width
, loading the graphicx package is required:
\usepackage{graphicx}
The same “local column” – effect can be achieved for tables. The following code shows you how:
\begin{table}[ht] \begin{minipage}[b]{0.45\linewidth}\centering \begin{tabular}{|c|c|c|} \hline 1&1&1\\ \hline 2&2&2\\ \hline \end{tabular} \end{minipage} \hspace{0.5cm} \begin{minipage}[b]{0.45\linewidth} \centering \begin{tabular}{|c|c|c|} \hline 1&1&1\\ \hline 2&2&2\\ \hline \end{tabular} \end{minipage} \end{table}
You can also have more than two column simply by adding another \minipage
in between the table-command and reduce the width of each \minipage
(0.33\linewidth
in addition to the \hspace
). LaTex will automaticaly place objects onto the next line, if space is not sufficient.
Remark: Using the subfigure-package is another way to place figures or tables side-by-side. You might want to have a look at this post on subfigures.