I'm having an issue compiling with the subcaption package. I'm starting to write my thesis, and I originally started a chapter with a separate document. This compiled fine and had the following pre-amble
\documentclass[11pt,a4paper]{article}
\usepackage{fullpage,graphicx,amsmath,verbatim,float,caption,subcaption}
\numberwithin{equation}{section}
\numberwithin{figure}{section}
\begin{document}
I then moved to a template for a thesis, (full template is here http://www.sunilpatel.co.uk/thesis-template/ ) I copied across the chapter I have completed into the chapter1.tex file as specified. I also copied across my \usepackage line to give the following preamble in the thesis document:
%% ----------------------------------------------------------------
%% Thesis.tex -- MAIN FILE (the one that you compile with LaTeX)
%% ----------------------------------------------------------------
% Set up the document
\documentclass[a4paper, 11pt, oneside]{Thesis} % Use the "Thesis" style, based on the ECS Thesis style by Steve Gunn
\graphicspath{{Figures/}} % Location of the graphics files (set up for graphics to be in PDF format)
% Include any extra LaTeX packages required
\usepackage[square, numbers, comma, sort&compress]{natbib} % Use the "Natbib" style for the references in the Bibliography
\usepackage{verbatim} % Needed for the "comment" environment to make LaTeX comments
\usepackage{vector} % Allows "\bvec{}" and "\buvec{}" for "blackboard" style bold vectors in maths
\usepackage{fullpage,graphicx,amsmath,float,caption,subcaption}
\hypersetup{urlcolor=blue, colorlinks=true} % Colours hyperlinks in blue, but this can be distracting if there are many links.
When I compile the Thesis.tex file it now has three errors for each of the figures I'm trying to use
- ! Use of \@subfloat doesn't match its definition.
- ! Missing number, treated as zero.
- ! Illegal unit of measure (pt inserted).
An example of the code for one of my figures is as follows:
\begin{figure}[!h]
\centering
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[scale=0.35]{figure1}
\caption{figure1 caption}
\label{fig: figure1 }
\end{subfigure}
\hspace{20mm}
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[scale=0.35]{figure2}
\caption{figure2 caption}
\label{fig: figure2 }
\end{subfigure}
\caption{Caption}
\end{figure}
If I remove the subfigure package then the file will compile, but the formatting is all screwed up. I'm guessing there are conflicting packages, but i can't find which one it is.
I'm pretty new to latex and just learning the ropes, so if it something silly then I apologise in advance.
Thanks in advance for any help
John
Thesis.clsloadssubfigure, which has been obsolete for at least ten years; it also loadsvmarginwhich is incompatible with several packages. I wouldn't recommend using it. – egreg Aug 23 '13 at 14:28\usepackage{hyperref}fromThesis.clsto just before\begin{document}in case you load a package that needs to come before it. (Are you a University of Southampton student by any chance?:-)) – sudosensei Aug 23 '13 at 14:34