This is my first time using Latex. I would like to get help with sub-figure issue that I am facing.
The paper is IEEE format. I used the following code:
\begin{figure*}[!htbp]
\centering
\begin{subfigure}
\includegraphics[width=\textwidth]{Fig2a.jpg}
\caption{LV}
\label{fig:2a}
\end{subfigure}
\begin{subfigure}
\includegraphics[width=\textwidth]{Fig2b.jpg}
\caption{MV}
\label{fig:2b}
\end{subfigure}
\caption{Location of DVR}
\end{figure*}
This gave me the following output:
As you can see, the sub-captions are not proper. It takes each sub-captions as a new figure. Also, it throws an error saying '\begin{figure*} on input line 338 ended by \end{subfigure}.
I searched in internet and added the package \usepackage{subfigure} and the output becomes:
so I added \usepackage{subcaption} and the output is weird with 229 errors: 
I am not sure what am I doing wrong. I tried adding the \linewidth cmd to the code but nothing seems to solve the issue.
Please help. Thanks in advance.




subfigureis deprecated and should not be used any more. If you addsubcaptionpackage to your preamble, the individualsubfigureenvironments need a width as in\begin{subfigure}{\linewidth}. – leandriis Apr 18 '20 at 13:24IEEEtran, you might want to use thesubfigpackage, since the class documentation recommends usingsubfigoversubcaption. – leandriis Apr 18 '20 at 13:26