# ContinuedFloat not working - ShareLatex

I'm using ShareLatex to write my thesis and right now I need 16 images divided by 3 pages with the same caption. The images should be on pairs of two for being able to compare. I don't want any subcaption on the bottom, I only want the reference (a), (b), (c)....till (p) and that's why I am using the \continuedfloat command that for some reason isn't working.

I tried to put the command in different places but it never worked.

I need this on the 3 pages but with the references well done.

My code is:

\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}


EDIT: So, after successfully compiled this code in a new blank project, the problem must be in another place, probably in the main .tex. I leave here the main parts of the file:

\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{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}


Maybe it's the order of the packages?

The document class I am using is a template created by a professor from my university many years ago.

Can anyone help me?

• Continuedfloat reflects the caption, it resets the figure counter, but it is the caption that steps that counter up in the first place, you'll need a caption on each (most may just say continued). Btw for a user, it is not particularly nice having to turn several pages to find the main caption. The text ought to be in the first caption. – daleif Jul 20 '18 at 18:00
• Btw by resetting I mean: continuedfloat steps the figure counter down by one, such that when caption steps it up, we're still at the same number. I'm not sure if the subcaption counter is supported by continuedfloat, not at pc so haven't tested your code. Btw: next tome please post a complete document but minimal) that makes it a lot easier for others to copy and test your example. Having to guess class and preamble does not encourage others to help. As test images you can just use \rule{4cm}{4cm} – daleif Jul 20 '18 at 18:13
• Welcome to TeX.SX! 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. – BambOo Jul 20 '18 at 18:14
• By the way, I just edited your code – BambOo Jul 20 '18 at 18:14
• @BambOo you probably should not have added the documentclass line, from the OPs information we do not know if the article class is being used. It is a fair assumption for an mwe but we not know and that part should be fixed by the op. I agree on the rest of the edit. – daleif Jul 20 '18 at 19:03

The novathesis document class you use is based on the memoir document class and this document class offers its own sub-caption functions. These functions do not interfere with the subcaption package as long as they don't get activated. Unfortunately the novathesis document class does activate these functions by using:

\newsubfloat{figure}


So a modified version of the example document from your question which shows the problem is:

\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}

The problem: The novathesis documument class says "Hey, I want to use the sub-caption feature of the memoir class!" but by loading the subcaption package you say "Hey, I want to use the sub-caption feature of the caption package!".

Since the user usually only does one of them this does not fit the concept of the subcaption package. However, I have created an issue in my bug tracker [1] and this situation will be detected and handled correctly by future versions of the subcaption package. Until then, you could add the following work-around to your code, right after loading the subcaption package:

\makeatletter
\@cons\caption@subtypelist{{figure}}
\makeatother


Complete example document:

\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}


As an alternative you could use the sub-caption features offered by the memoir document class and avoid using the subcaption package.

• Fixed with caption v3.4e (2020-01-02), so the work-around is no longer needed. – user2574 Jan 3 at 12:45

edit: from your comments can be concluded that in your document you use figure/table numbering within sections. mwe below is extended with similar features.

\ContinuedFloat decrement counter figure and not interfere in counter for sub captions. it is increased at each subcaptionbox till to the last figure included in \ContinuedFloat. referencing works as is desired (and expected), for example:

see figures \ref{subfig:5a}, \ref{subfig:5e} and \ref{subfig:448} on figure \ref{fig:label}.


and

see figures \ref{subfig:2a} and \ref{subfig:2b} on figure \ref{fig:test}.


gives

complete code, which consider daleif comments:

\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{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}

• No, the caption package variant of \ContinuedFloat does not decrement the figure counter. (But the variant offered by the subfig package does.) – user2574 Jul 20 '18 at 19:30
• ...instead \ContinuedFloat is suppressing the incremention of the figure counter if \caption is used. So it should not make a difference in the counting of the sub-figures if extra \captions are added here. – user2574 Jul 20 '18 at 19:38
• @AxelSommerfeldt, for successive numbering and referencing of sub captions it is not necessary to have caption in the each figure. captions only indicate to which figure belong showed sub figures. or i misunderstood you? – Zarko Jul 20 '18 at 19:49
• @AxelSommerfeldt that's probably my bad, I wrote that on a comment above. – daleif Jul 20 '18 at 20:01
• @Zarko If I try to that with the same picture names I get see figure 4.9a 4.9c 4.9d on 4.9 . \continuedfloat is stoping the increment of the number of the picture but when it comes to the subfigure it does nothing. – Rafael Santos Jul 21 '18 at 16:04