How can I put two images next to each other?

Post a reply


This question is a means of preventing automated form submissions by spambots.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:

BBCode is ON
[img] is ON
[flash] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: How can I put two images next to each other?

How can I put two images next to each other?

by Stefan Kottwitz » Mon Oct 18, 2021 6:45 pm

I prefer using the subcaption package, since it's the perfect companion to the excellent caption package by the same author.

Here is a quick example:

Code: Select all

\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\begin{document}
\begin{figure}[ht]
  \subcaptionbox*{First subfigure}[.45\linewidth]{%
    \includegraphics[width=\linewidth]{example-image-a}%
  }%
  \hfill
  \subcaptionbox*{Second subfigure}[.45\linewidth]{%
    \includegraphics[width=\linewidth]{example-image-b}%
  }
  \caption{Two images}
\end{figure}
\end{document}
This gives us:
subfigures.png
subfigures.png (19.92 KiB) Viewed 271684 times
There are further examples in the LaTeX Cookbook, Chapter 4, Working with Images.

Stefan

How can I put two images next to each other?

by Reader » Thu Oct 07, 2021 1:15 pm

In Chapter 6, Inserting images, in the section Arranging several images, I see that there are several packages for placing images next to each other or above each other.

Which one of the mentioned packages shall I choose?

Can you show an simple code example?

Top