我正在使用 ShareLatex 撰写论文,现在我需要 16 幅图像,分成 3 页,标题相同。图像应该成对出现,以便进行比较。我不想在底部有任何子标题,我只想要参考 (a)、(b)、(c)……直到 (p),这就是为什么我使用的命令\continuedfloat
不知为何不起作用。
我尝试将命令放在不同的地方,但毫无效果。
我需要这 3 页内容,并且要有详尽的参考资料。
\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\begin{document}
\begin{figure}[b]
\subcaptionbox{\label{subfig:5a}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:441}}{\includegraphics[height=7cm]{example-image-a}}
\subcaptionbox{\label{subfig:5b}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:442}}{\includegraphics[height=7cm]{example-image-a}}
\subcaptionbox{\label{subfig:5c}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:443}}{\includegraphics[height=7cm]{example-image-a}}
\end{figure}
\begin{figure}\ContinuedFloat
\subcaptionbox{\label{subfig:5d}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:444}}{\includegraphics[height=7cm]{example-image-a}}
\subcaptionbox{\label{subfig:5e}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:445}}{\includegraphics[height=7cm]{example-image-a}}
\subcaptionbox{\label{subfig:5f}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:446}}{\includegraphics[height=7cm]{example-image-a}}
\end{figure}
\begin{figure}\ContinuedFloat
\subcaptionbox{\label{subfig:5g}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:447}}{\includegraphics[height=7cm]{example-image-a}}
\subcaptionbox{\label{subfig:5h}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:448}}{\includegraphics[height=7cm]{example-image-a}}
\caption{Comparação}
\label{fig:label}
\end{figure}
\end{document}
编辑:因此,在新的空白项目中成功编译此代码后,问题一定出在其他地方,可能是在主 .tex 中。我在这里保留文件的主要部分:
\documentclass[
docdegree=msc, % phd(*), phdplan, phdprop, msc, mscplan, bsc
school=nova/fct, % nova/fct(*), nova/fcsh, nova/ims, ul/ist, ul/fc
lang=pt, % en(*), fr, it, pt
coverlang=pt, % defaults to main language
copyrightlang=pt, % defaults to main language
fontstyle=kpfonts, % baskervaldx bookman charter ebgaramond fbb fourier garamond
% heuristica kpfonts(*) libertine mathpazo1 mathpazo2 newcent
% newpx newtx
chapstyle=elegant, % bianchi bluebox brotherton dash default elegant(*) ell ger
% hansen ist jenor lyhne madsen pedersen veelo vz14 vz34 vz43
otherlistsat=front, % front(*), back
aftercover=false, % false=don't true=include the aftercover file (even if exists)
linkscolor=darkblue, % darkblue, black (Set to 'black' for PRINTING)
printcommittee=true, % set to 'false' from submitted versins who should not have
% the list of committee memebers
spine=true, % (Set to 'true' for PRINTING the book spine)
cdcover=true, % (Set to 'true' for PRINTING the CD cover)
biblatex={ % Options for biblatex (see biblatex documentation)
backend=biber, % use bibtex if possible
style=numeric, % numeric(*), alphabetic, authoryear, bwl-FU
sortcites=true, % If numeric, sort cites by crescent order
sorting=none, % none, nyt(*), ynt
%%% other options for biblatex
maxbibnames=99, % Never use 'et al' in the bibliography
giveninits=true, % render all first and middle names as initials
hyperref=true % Hyperlinks in citations: true(*) false
},
memoir={ % See the 'memoir' documentation
showtrims, % DEBUG
a4paper, % the paper size/format
11pt, % 10pt, 11pt(*), 12pt
final, % draft, final <= Replace 'draft' with 'final' in final version
},
media=screen,
]{novathesis}
\usepackage{booktabs} % Beautiful simple tables
\usepackage{paralist} % To enable customizble enumerates
%% IMPORTANT (consider removing/commenting)
%\usepackage{colortbl} % Use colors in background of table cells
\usepackage[textsize=footnotesize]{todonotes} % To register TODO notes in the text
\setlength{\marginparwidth}{3.25cm}
%\captionsetup{compatibility=false}
\usepackage[export]{adjustbox}
\usepackage{esvect}
\usepackage{amsmath}
\usepackage{multirow}
\usepackage{array}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
%\usepackage{subfig}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{hyperref}
也许是包裹的顺序?
我使用的文档类是我大学的一位教授多年前创建的模板。
完整模板可在此处下载Github Nova 论文。
谁能帮我?
答案1
您使用的文档novathesis
类基于memoir
文档类,该文档类提供自己的子标题功能。subcaption
只要这些功能未被激活,它们就不会干扰包。不幸的是,novathesis
文档类确实通过使用以下方式激活了这些功能:
\newsubfloat{figure}
因此,您问题中显示该问题的示例文档的修改版本是:
\documentclass{memoir}
\newsubfloat{figure}
\usepackage{graphicx}
\usepackage{subcaption}
\begin{document}
\begin{figure}[b]
\subcaptionbox{\label{subfig:5a}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:441}}{\includegraphics[height=7cm]{example-image-a}}
\subcaptionbox{\label{subfig:5b}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:442}}{\includegraphics[height=7cm]{example-image-a}}
\subcaptionbox{\label{subfig:5c}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:443}}{\includegraphics[height=7cm]{example-image-a}}
\end{figure}
\begin{figure}\ContinuedFloat
\subcaptionbox{\label{subfig:5d}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:444}}{\includegraphics[height=7cm]{example-image-a}}
\subcaptionbox{\label{subfig:5e}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:445}}{\includegraphics[height=7cm]{example-image-a}}
\subcaptionbox{\label{subfig:5f}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:446}}{\includegraphics[height=7cm]{example-image-a}}
\end{figure}
\begin{figure}\ContinuedFloat
\subcaptionbox{\label{subfig:5g}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:447}}{\includegraphics[height=7cm]{example-image-a}}
\subcaptionbox{\label{subfig:5h}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:448}}{\includegraphics[height=7cm]{example-image-a}}
\caption{Comparação}
\label{fig:label}
\end{figure}
\end{document}
问题:novathesis
文档类说“嘿,我想使用回忆录类的子标题功能!”但是通过加载包,subcaption
您说“嘿,我想使用标题包的子标题功能!”。
由于用户通常只执行其中一项操作,因此这不符合软件包的概念subcaption
。不过,我已在我的错误跟踪器 [1] 中创建了一个问题,软件包的未来版本将检测并正确处理这种情况subcaption
。在此之前,您可以在加载软件包后立即将以下解决方法添加到您的代码中subcaption
:
\makeatletter
\@cons\caption@subtypelist{{figure}}
\makeatother
完整示例文档:
\documentclass{memoir}
\newsubfloat{figure}
\usepackage{graphicx}
\usepackage{subcaption}
\makeatletter
\@cons\caption@subtypelist{{figure}}
\makeatother
\begin{document}
\begin{figure}[b]
\subcaptionbox{\label{subfig:5a}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:441}}{\includegraphics[height=7cm]{example-image-a}}
\subcaptionbox{\label{subfig:5b}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:442}}{\includegraphics[height=7cm]{example-image-a}}
\subcaptionbox{\label{subfig:5c}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:443}}{\includegraphics[height=7cm]{example-image-a}}
\end{figure}
\begin{figure}\ContinuedFloat
\subcaptionbox{\label{subfig:5d}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:444}}{\includegraphics[height=7cm]{example-image-a}}
\subcaptionbox{\label{subfig:5e}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:445}}{\includegraphics[height=7cm]{example-image-a}}
\subcaptionbox{\label{subfig:5f}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:446}}{\includegraphics[height=7cm]{example-image-a}}
\end{figure}
\begin{figure}\ContinuedFloat
\subcaptionbox{\label{subfig:5g}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:447}}{\includegraphics[height=7cm]{example-image-a}}
\subcaptionbox{\label{subfig:5h}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:448}}{\includegraphics[height=7cm]{example-image-a}}
\caption{Comparação}
\label{fig:label}
\end{figure}
\end{document}
另外,您可以使用memoir
文档类提供的子标题功能,而避免使用该subcaption
包。
答案2
编辑: 从您的评论可以得出结论,您在文档中的章节内使用图形/表格编号。下面的 mwe 扩展了类似的功能。
\ContinuedFloat
减少计数器figure
并且不干扰子标题的计数器。它每次增加subcaptionbox
直到包含在中的最后一个数字\ContinuedFloat
。引用工作是所需的(和预期的),例如:
see figures \ref{subfig:5a}, \ref{subfig:5e} and \ref{subfig:448} on figure \ref{fig:label}.
和
see figures \ref{subfig:2a} and \ref{subfig:2b} on figure \ref{fig:test}.
给出
完整的代码,考虑达莱夫评论:
\documentclass[11pt]{memoir}
\usepackage{booktabs} % Beautiful simple tables
\usepackage{paralist} % To enable customizble enumerates
%% IMPORTANT (consider removing/commenting)
%\usepackage{colortbl} % Use colors in background of table cells
\usepackage[textsize=footnotesize]{todonotes} % To register TODO notes in the text
\setlength{\marginparwidth}{3.25cm}
%\captionsetup{compatibility=false}
\usepackage[export]{adjustbox}
\usepackage{esvect}
\usepackage{amsmath}
\usepackage{multirow}
\usepackage{array}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
%\usepackage{subfig}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\renewcommand\thefigure{\thesection-\arabic{figure}}
\usepackage{hyperref}
\setcounter{chapter}{3}
\begin{document}
\chapter{forth chapter}
numbering of images is within chapter ...
\section{first section}
\begin{figure}[htb]
\subcaptionbox{\label{subfig:5a}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:441}}{\includegraphics[height=7cm]{example-image-b}}
\subcaptionbox{\label{subfig:5b}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:442}}{\includegraphics[height=7cm]{example-image-b}}
\subcaptionbox{\label{subfig:5c}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:443}}{\includegraphics[height=7cm]{example-image-b}}
\caption{Comparação}
\label{fig:label}
\end{figure}
\begin{figure}[htbp]\ContinuedFloat
\subcaptionbox{\label{subfig:5d}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:444}}{\includegraphics[height=7cm]{example-image-b}}
\subcaptionbox{\label{subfig:5e}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:445}}{\includegraphics[height=7cm]{example-image-b}}
\subcaptionbox{\label{subfig:5f}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:446}}{\includegraphics[height=7cm]{example-image-b}}
\caption{Comparação (cont.)}
\end{figure}
\begin{figure}[htbp]\ContinuedFloat
\subcaptionbox{\label{subfig:5g}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:447}}{\includegraphics[height=7cm]{example-image-b}}
\subcaptionbox{\label{subfig:5h}}{\includegraphics[height=5cm]{example-image-a}}
\subcaptionbox{\label{subfig:448}}{\includegraphics[height=7cm]{example-image-b}}
\caption{Comparação (cont)}
\end{figure}
see figures \ref{subfig:5a}, \ref{subfig:5e} and \ref{subfig:448} on figure \ref{fig:label}.
\section{fifth section}
numbering of images is within section ...
\begin{figure}[htb]
\subcaptionbox{\label{subfig:2a}}{\includegraphics[height=4cm]{example-image-a}}
\subcaptionbox{\label{subfig:2b}}{\includegraphics[height=5cm]{example-image-b}}
\caption{test ...}
\label{fig:test}
\end{figure}
see figures \ref{subfig:2a} and \ref{subfig:2b} on figure \ref{fig:test}.
\end{document}