I would like to have two figures side by side in my document. I found an example on here with the following code
\begin{figure}
\centering
\begin{minipage}{.5\linewidth}
\centering
\includegraphics[width=.4\linewidth]{image}
\captionof{figure}{A figure}
\label{fig: test1}
\end{minipage}%
\begin{minipage}{.5\linewidth}
\centering
\includegraphics[width=.4\linewidth]{image}
\captionof{figure}{Another figure}
\label{fig: test2}
\end{minipage}
\end{figure}
However when I try to compile it it comes up with the following errors:
template.tex error line 195 Argument of \caption@ydblarg has an
extra } \end{figure}template.tex error line 195 Paragraph ended before \caption
@ydblarg was complete \end{figure}
How can I fix this to make it work?
Best Answer
try to use
subfigure
instead ofminipage
.How about this code :