我阅读了无数关于如何使用 subcaption 包的说明,并尝试了几个示例。每次我都会遇到两种类型的错误,我将在下面发布。这是我的序言:
\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}}
这是当前的标题代码:
\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}
最后,这些是我收到的错误消息。
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}]
有人知道我该如何解决这个问题吗?我添加序言的原因是,大多数其他人都表示 subcaption 包不能与 subfigure 包一起使用,但正如你所见,我没有将它添加到我的 Thesis.tex 中
答案1
看到错误消息,发生的事情是您的文档类Thesis
在内部加载subfigure
,这会产生冲突,因为subcaption
和subfigure
不能同时使用。Thesis.cls
在文件中搜索一行
\RequirePackage{subfigure}
并将其注释掉。