I'm trying to use the subcaption package to build composite figures. When I try to include an image using \includegraphics{}. I get the error beneath. I know this is very similar to Subfloat with subcaption package: Missing number, treated as zero but that question did not have an accepted answer and the proposed solution was confusing. Any clear explanations of why this problem occurs and how to fix it are very welcome. :)
Error:
! Missing number, treated as zero.
<to be read again>
\let
l.54 \includegraphics
{./Figures/For_testing/test.png}
MWE:
\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\begin{document}
\begin{figure}
\centering
\begin{subfigure}
\includegraphics{anything}
\phantomsubcaption
\end{subfigure}
\\
\begin{subfigure}
\includegraphics{anything2}
\phantomsubcaption
\end{subfigure}
\caption{Test Caption}
\end{figure}
\end{document}