i use below code to view 2 images A & B:
\documentclass{article}
\usepackage{subcaption}
\usepackage{graphicx}
\begin{document}
\vspace*{4cm}
\begin{figure}[ht!]
\centering
\begin{subfigure}{0.5\linewidth}
\includegraphics[width=3cm]{example-image-a}
\end{subfigure}
\\
\vspace*{3cm}
\begin{subfigure}{0.5\linewidth}
\includegraphics[width=5cm]{example-image-b}
\end{subfigure}
\end{figure}
\end{document}
When i use above code, no error but when i insert this code to my big main.tex file, get 2 errors:
Missing number, treated as zero and
Illegal unit of measure (pt inserted)
And number 0.5 of {0.5\linewidth} displayed with image.
How can i remove number 0.5?
Thanks
Best Answer
I can reproduce the issue if I change
\usepackage{subcaption}
into\usepackage{subfigure}
(or use both, withsubfigure
prior tosubcaption
).Either use
subfigure
(but bear in mind it is obsolete) orsubcaption
, not both.If you have to use a template that forces
subfigure
, then use the proper syntax that you find in its manual.