2

So I am still new to LaTeX. I have a figure that has 2 graphics side by side each with their own respective captions. My problem is that by default, LaTeX wants to allign the leftmost side of the left graphic with the lefthand side of my column of text. This is what I have as of now...

\begin{figure}[H]
\begin{minipage}[b]{0.45\textwidth}
\includegraphics[scale=0.5]{figure1.png}
\caption{Figure 1 caption}
\label{fig:fig1}
\end{minipage}
\quad
\begin{minipage}[b]{0.45\textwidth}
\includegraphics[scale=0.5]{figure2.png}
\caption{Figure 2 caption}
\label{fig:fig2}
\end{minipage}
\end{figure}

The double graphics aspect of this code works very well. I just need the whole figure to be centered with the page so that it doesn't look lopsided to the right like it currently is.

  • If you know it is on an odd or even page (or you are using [oneside]) then simply \hspace*{-3cm}\begin{minipage}[b]{0.45\textwidth}.. where 3cm is replaced by whatever offset you need – David Carlisle Feb 25 '15 at 14:25
2

One option is to use adjustbox package.

\documentclass{article}
\usepackage{showframe}  %% just for demo
\usepackage{adjustbox}
\begin{document}
  \begin{figure}[htb]
\begin{adjustbox}{center,width=\textwidth}     %%<-------- this added
\begin{minipage}[b]{0.55\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{Figure 1 caption}
\label{fig:fig1}
\end{minipage}
\quad
\begin{minipage}[b]{0.55\textwidth}
\includegraphics[width=\linewidth]{example-image-b}
\caption{Figure 2 caption}
\label{fig:fig2}
\end{minipage}
\end{adjustbox}  %% <------------- and this
\end{figure}
\end{document}

enter image description here

Your Answer

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