I am currently writing my thesis in LaTeX. Today, all of a sudden, LaTeX started crashing. All the figures which contain a subfigure (NOTE: I am using the subcaption package) started receiving the following error:
Illegal unit of measure (pt inserted). \begin{subfigure}[b]{0.4\textwidth}
Also receiving other errors such as:
Missing number, treated as zero. \begin{subfigure}[b]{0.4\textwidth}
and
\begin{figure} on input line 170 ended by \end{subfigure}. \end{subfigure}
Below is an example of the code I'm using to generate subfigures.
\begin{figure}[htbp!] % h t b p ! H for positioning of floats
\begin{subfigure}[b]{0.5\textwidth}
\includegraphics[width=\textwidth]{CRMBuffetPSD5deg00eta0600}
\caption{$\alpha$ = 5.0 \dg}
\label{subfig:CRMBuffetPSD5deg00}
\end{subfigure}
\begin{subfigure}[b]{0.5\textwidth}
\includegraphics[width=\textwidth]{CRMBuffetPSD6deg00eta0600}
\caption{$\alpha$ = 6.0 \dg}
\label{subfig:CRMBuffetPSD6deg00}
\end{subfigure}
\begin{center}
\begin{subfigure}[b]{0.5\textwidth}
\includegraphics[width=\textwidth]{CRMBuffetPSD6deg50eta0600}
\caption{$\alpha$ = 6.5 \dg}
\label{subfig:CRMBuffetPSD6deg50}
\end{subfigure}
\end{center}
\caption{Surface $C_{P}$ response at $\eta$ = 0.6, and various incidences}
\label{fig:CRMBuffetUnsteadyPSD}
\end{figure}
The code worked fine for a significant period of time, today whilst writing I started getting this error. Closing and reopening LaTeX does not fix the issue.
I looked online already and it seems that the only solution found so far was to use the subcaption environment which I already do. Any other tips that could help me start troubleshooting this?
Thanks.
EDIT: I am using the Cambridge PhD thesis template.
EDIT: Error disappears when not using the thesis template anymore. This is undesirable though
Best Answer
The only way to produce these error messages I'm aware of is using the
subfigure
package as well, and ignoring the first error message. Example:These are the error messages when trying to compile the document above:
The solution is to decide which package to use, either the
subfigure
or thesubcaption
package, but not both. (Note: Thesubfigure
package offers a different syntax.)Since you are using a special document class: Maybe there was an update of this class and now the
subfigure
package is included within this class? Please take a look if thesubfigure
package is used by a look into the log file, e.g.: