6

I have read countless instructions on how to use the subcaption package, and tried several examples. Each time I get two types of errors, which I will post further down. This is my premable:

\documentclass[12pt, a4paper, oneside]{Thesis} % Paper size, default font size and one-    sided paper
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[american]{babel}
\usepackage{csquotes}
\DeclareUnicodeCharacter{00A0}{~}
\graphicspath{{./Figures/}} % Specifies the directory where pictures are stored
\usepackage[backend=bibtex, natbib, style=authoryear,maxbibnames=9, doi=false,    url=true, isbn=false]{biblatex}
\DeclareLanguageMapping{american}{american-apa}
\DefineBibliographyStrings{norsk}{bibliography = {References},}
\usepackage{hyperref}
\usepackage{pgfplots}
\pgfplotsset{compat=1.9}
\usepackage{float}
\usepackage{mdwlist}
\usepackage{chngcntr}
\usepackage{paralist}
\usepackage{soul}
\usepackage{caption}
\usepackage{subcaption}
\newcommand{\Qline}[1]{\noindent\rule{#1}{0.6pt}}

This is the current caption code:

\begin{figure}
    \centering
    \begin{subfigure}[b]{0.3\textwidth}
            \includegraphics[width=\textwidth]{E:/Masteroppgaven/TeXhis/Figures/QuickRight}
            \caption{Original Prototype}
            \label{fig:QRight}
    \end{subfigure}%
    ~ 
    \begin{subfigure}[b]{0.3\textwidth}
            \includegraphics[width=\textwidth]{E:/Masteroppgaven/TeXhis/Figures/QuickLeft}
            \caption{Second Iteration}
            \label{fig:QLeft}
    \end{subfigure}
    \caption{Quick Selection}\label{fig:QSelect}
\end{figure}

Finally, these are the error messages that I am given.

C:\Program Files (x86)\MiKTeX 2.9\tex\latex\caption\subcaption.sty:48: 
Package subcaption Error: This package can't be used in cooperation [\endinput}{}]

E:\Masteroppgaven\TeXhis\Chapters\UseOfTheNovelDesignPrinciples.tex:28: 
Missing number, treated as zero. [\begin{subfigure}[b]{0.3\textwidth}]

E:\Masteroppgaven\TeXhis\Chapters\UseOfTheNovelDesignPrinciples.tex:28: 
Illegal unit of measure (pt inserted). [\begin{subfigure}[b]{0.3\textwidth}]

Does anyone have any idea of how I can solve this issue? The reason I added the preamble is that most other people have stated that the subcaption package can't be used together with the subfigure package, but as you can see I do not add it to my Thesis.tex

  • 1
    Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – cfr Apr 21 '14 at 22:32
  • I provided an answer below, but I want to confirm my suspicion. Could you please provide a link to the class Thesis.cls (if it's not publicly available, you can uploaded elsewhere and provide the link)? – Gonzalo Medina Apr 21 '14 at 23:56
8

Seeing the error message, what happens is that your document class Thesis internally loads subfigure and this produces the clash, since subcaption and subfigure cannot be used simultaneously. Search the file Thesis.cls for a line

\RequirePackage{subfigure}

and comment it out.

  • That was exactly it. Thank you! If only the error messages would reflect where the conflict occured, this would have been so much easier. – Marius Seim Apr 22 '14 at 6:10
  • This totally works. For people who might be visiting here again, I tried this with bmvc2k class for British Machine Vision Conference paper. Worked like a charm. Many thanks! – masad May 4 '16 at 17:08

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.