So, I have been trying to add three images in a single line.
When I use only the 'figure' function like this
\begin{figure}[t]
\includegraphics[width=0.3\linewidth]{./Figures/img1}
\includegraphics[width=0.3\linewidth]{./Figures/img2}
\includegraphics[width=0.3\linewidth]{./Figures/img3}
\end{figure}
I get the result that I want.
But once I try using 'subfigure' function like this
\begin{figure}[t]
\begin{subfigure}
\includegraphics[width=0.3\linewidth]{./Figures/img1}
\end{subfigure}
\begin{subfigure}
\includegraphics[width=0.3\linewidth]{./Figures/img2}
\end{subfigure}
\begin{subfigure}
\includegraphics[width=0.3\linewidth]{./Figures/img3}
\end{subfigure}
\end{figure}
I just get three empty boxes in a row and with 'relax.png' writtten inside them. Moreover, I get a load of errors as well which weren' there when I only used figures.
Best Answer
Don't use both packages.
will throw the error
while
throws
The
subfigure
package is considered deprecated, so I'd recommendsubcaption
. They differ in use however:\usepackage{subfigure}
: defines a\subfigure
macro, used as\subfigure[<subcaption>]{<figure>}
\usepackage{subcaption}
: defines an environment, used asNote that you have to specify a width for the environment, similar to
minipage
. Hence, a working version of your code snippet would be