1

I need to put 2 figures side by side in LaTeX where the first figure needs to be given a caption and the second must not be given a caption. I have tried the following:

\usepackage{floatrow}

\begin{figure}[!h]
\begin{floatrow}
\ffigbox{\includegraphics[scale = 0.8]{Figure3}}{\caption{PTST based on total duration}\label{case1}}
\ffigbox{\includegraphics[scale = 0.8]{app1}}{\caption{A zoom}\label{zoom}}
\end{floatrow}
\end{figure}

but I am getting the error do not use float package with float row since I also have \usepackage{float} for other images (I need this).

2 Answers 2

4

You can use the subcaption package.

Try something like this.

\documentclass{article}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{subcaption}


\begin{document}
\begin{figure}
\centering
\begin{subfigure}{0.49\textwidth}
\centering
\includegraphics[width = \textwidth]{tikzexample2.png}
\caption{Left figure}
\label{fig:left}
\end{subfigure}
\begin{subfigure}{0.49\textwidth}
\centering
\includegraphics[width = \textwidth]{tikzexample2.png}
\caption{Right figure}
\label{fig:right}
\end{subfigure}
\caption{Combined figure}
\label{fig:combined}
\end{figure}
\end{document}

It yields the following output.

output example

4

May be is not what you wanted (since you have accepted a answer with two subcaptions) but is what your asked ("the second must not be given a caption"):

MWE

\documentclass{article}
\usepackage{graphicx,lipsum}
\begin{document}
\lipsum[2]

\begin{figure}[h] % Do not use only [h] in real documents.
\begin{minipage}[t]{.45\linewidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{ figure}
\end{minipage}\hfill
\begin{minipage}[b]{.45\linewidth}
\includegraphics[width=\linewidth]{example-image-b}
\end{minipage}
\end{figure}
\lipsum[3]

\end{document}
4
  • If the figures are not in same height can the smaller one horizontally centered?
    – alper
    Aug 22, 2023 at 18:05
  • 1
    @alper Sorry, do you mean one image over the other as centering A over B with {\centering A\\B\par}? Then, is just replace "A" and "B" by the images Or really do you mean side by side as in the answers, but the smaller being vertically centered? Then you can use [c][x][c]{y} as minipage arguments, where x is the height and y the width (obviously with the same x in both minipages) or use adjustbox. See tex.stackexchange.com/questions/367302/….
    – Fran
    Aug 22, 2023 at 20:46
  • mean side by side as in the answer, but the smaller being vertically centered? Yes sir I meant this.
    – alper
    Aug 23, 2023 at 7:56
  • 1
    @alper, Then, in the MWE of my answer remove the caption, remove also the options [t] and [b] (to return to the default [c]) and change example-image-b by example-image-16x9 (an image with smaller height) . Is this what you expect? But as said, you can also use adjustbox and avoid the minipages. Another example here centering vertically several images.
    – Fran
    Aug 23, 2023 at 9:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .