13

I am trying to get two pictures on the same line in LaTeX. I found some example on the Internet that works very well but there is some strange black frame around the pictures. Here is the code:

\begin{figure}[!htb]\centering
   \begin{minipage}{0.48\textwidth}
     \frame{\includegraphics[width=.7\linewidth]{RL.png}}
     \caption{Interpolation for Data 1}\label{Fig:Data1}
   \end{minipage}
   \begin {minipage}{0.48\textwidth}
     \frame{\includegraphics[width=.7\linewidth]{RC1.png}}
     \caption{Interpolation for Data 2}\label{Fig:Data2}
   \end{minipage}
\end{figure}

What can I do to remove them?

Olivier
  • 208
Rectifier
  • 765

2 Answers2

32

Delete the surrounding \frame{...} from your code; \frame is a kernel command which draws a tight frame around its argument.

Use \centering inside each minipage to center each image inside it, and optionally use \hfill between them; in this case, the external \centering is not required:

\documentclass{article}
\usepackage{graphicx}

\begin{document}

\begin{figure}[!htb]
   \begin{minipage}{0.48\textwidth}
     \centering
     \includegraphics[width=.7\linewidth]{example-image-a}
     \caption{Interpolation for Data 1}\label{Fig:Data1}
   \end{minipage}\hfill
   \begin{minipage}{0.48\textwidth}
     \centering
     \includegraphics[width=.7\linewidth]{example-image-b}
     \caption{Interpolation for Data 2}\label{Fig:Data2}
   \end{minipage}
\end{figure}

\end{document}

enter image description here

Gonzalo Medina
  • 505,128
8

Another solution can be achieved with these lines:

\usepackage{subfigure}

\begin{figure} \centering \subfigure[]{\includegraphics[width=0.24\textwidth]{monalisa.jpg}} \subfigure[]{\includegraphics[width=0.24\textwidth]{monalisa.jpg}} \subfigure[]{\includegraphics[width=0.24\textwidth]{monalisa.jpg}} \subfigure[]{\includegraphics[width=0.24\textwidth]{monalisa.jpg}} \caption{(a) blah (b) blah (c) blah (d) blah} \label{fig:foobar} \end{figure}

And the result will be:

enter image description here

If you change width=0.24\textwidth for width=0.5\textwidth, the images will be re-distributed automatically:

enter image description here

The original answer comes from here. It is always useful to have multiple options on the same page! Of course, there are more options like multiple sub-caption etc. For more information, see here.

Olivier
  • 208
Leos313
  • 639