1

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?

enter image description here

Thanks

  • 4
    Sorry but how should we know what your big main file is doing to break the code? Make a copy of your main file add only the body of your example and then start to remove packages to find the culprit. – Ulrike Fischer Jan 28 at 9:33
3

I can reproduce the issue if I change \usepackage{subcaption} into \usepackage{subfigure} (or use both, with subfigure prior to subcaption).

Either use subfigure (but bear in mind it is obsolete) or subcaption, not both.

If you have to use a template that forces subfigure, then use the proper syntax that you find in its manual.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.