2

I want to insert two figures side by side in one column, in a two column document, using minipage.

Here is a MWE:

\documentclass[a4paper, landscape, twocolumn]{article}
\usepackage{geometry}
\usepackage{graphicx}   
\usepackage{lipsum}  

\begin{document}    
\lipsum[1]  

\noindent
\begin{minipage}[t]{0.4\textwidth}
    \includegraphics[width=0.4\textwidth]{example-image-a}
\end{minipage}
%
\begin{minipage}[t]{0.4\textwidth}
    \includegraphics[width=0.4\textwidth]{example-image-a}
\end{minipage}

\lipsum[1]     
\end{document}

The result:

enter image description here

I can't understand why this doesn't work. Is this by design (of minipage)? If so, what alternative do I have?

I searched relevant topics without success.

2
  • 2
    .4\textwidth is almost the full width of the column, you want .4\columnwidth but if you have no captions you do not need minipage at all, simply use two \includegraphics Sep 23 at 9:44
  • Thanks, David, that was indeed obvious but... couldn't figure that out! Anyway, the real document has different things in the two columns (figures, text, so I'll stick with minipage.
    – kebs
    Sep 23 at 11:40
5

Use \columnwidth, rather than \textwidth (which gives the width of the full page, not the column):

\documentclass[a4paper, landscape, twocolumn]{article}
\usepackage{geometry}
\usepackage{graphicx}   
\usepackage{lipsum}  

\begin{document}    
\lipsum[1]  

\noindent
\begin{minipage}[t]{0.49\columnwidth}
    \includegraphics[width=\textwidth]{example-image-a}
\end{minipage}
%
\begin{minipage}[t]{0.49\columnwidth}
    \includegraphics[width=\textwidth]{example-image-a}
\end{minipage}

\lipsum[1]     
\end{document}

(Note each image is slightly less than half the column width, to allow for space between, etc.) Notice also that the \textwidth specified in \includegraphics is within the minipage environment, and as such returns the width of the minipage.

In fact, for this example you don't need to use minipage at all:

\documentclass[a4paper, landscape, twocolumn]{article}
\usepackage{geometry}
\usepackage{graphicx}   
\usepackage{lipsum}  

\begin{document}    
\lipsum[1]  

\noindent
    \includegraphics[width=0.5\columnwidth]{example-image-a}%
    \includegraphics[width=0.5\columnwidth]{example-image-a}

\lipsum[1]     
\end{document}

The result is as follows:

Two columns with images side-by-side in one column

3
  • Thanks, that so was obvious!
    – kebs
    Sep 23 at 11:41
  • About your edit: Yes, true that minipage is not needed when only two figures. But the real document has in fact a mix of text and a figure, so I'll stick with minipage. Thanks again.
    – kebs
    Sep 27 at 8:08
  • 1
    @kebs yes, I did wonder whether that was a requirement (which had been lost in the MWE), hence I gave both. (I'm not a fan of SE users who say "you shouldn't do it that way, do it this way". They tend to be the same users who also insist on really minimal MWEs...)
    – rbrignall
    Sep 27 at 13:06
3

enter image description here

If You want to use minipage You can take this:

\documentclass[a4paper, landscape, twocolumn]{article}
\usepackage{geometry}
\usepackage{graphicx}   
\usepackage{lipsum}  

\begin{document}    
\lipsum[1]  

\noindent


\begin{figure}[h]
\begin{minipage}[h]{0.49\linewidth}
\includegraphics[width=1\linewidth]{example-image-a}
\end{minipage}
\hfill
\begin{minipage}[h]{0.49\linewidth}
\includegraphics[width=1\linewidth]{example-image-b}
\end{minipage}
\caption{}
\label{ris:image1}

\end{figure}


\lipsum[1]     
\end{document}
1
  • Yes you are right, but my answer answers the question specifically, without unnecessary manipulation (as I think). Sep 23 at 12:05

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.