I need to have figures with several subfigures . In some cases, the subfigures of a figure have to go to the next page. For this purpose, I have to use \continuedFloat but then the figure number of image remain same (or sometimes completely weird).
I have asked this question before here and somebody also asked similar problem here but the solutions provided to both the questions did not work for me. Therefore, I am posting a new question with minimal working example.
IMPORTANT UPDATE: Just now I realized that if I remove the line \usepackage[hidelinks]{hyperref} then, everything works fine. But if I keep that line of code then, the figure number of both the figures remain same.
My code (MWE):
\documentclass[12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage[a4paper, width=425.196850394pt, top=70.866141732pt,bottom=70.866141732pt]{geometry}
\usepackage{tabu}
\usepackage[hidelinks]{hyperref}
\usepackage{float}
\raggedbottom
\usepackage{tabularx}
\newcolumntype{Y}{>{\centering\arraybackslash}X}%%%SO for th table form of images
\usepackage[caption = true,font=normalsize]{subfig}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Document Begins from here %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\makeatletter
\setlength{\@fptop}{0pt}
\setlength{\@fpbot}{0pt plus 1fil}
\makeatother
\chapter{Introduction}
This chapter is about the problem of wrong figure numbers.
%%%----------------------------------------------Normal Figure----------------------%%%%%%%%%%
\begin{figure}[h]
\centering
\includegraphics[scale=0.5]{example-image}
\caption{Figure on a single page.}
\end{figure}
%%%---------------------------------------------Two page Figure---------------------%%%%%%%%%%
\begin{figure}[!ht]
\subfloat[]{\includegraphics[scale=1]{example-image}} \\
\subfloat[]{\includegraphics[scale=1]{example-image}} \\
\phantomcaption
\end{figure}
%%mages on the new page
\begin{figure}[]
\ContinuedFloat
\subfloat[]{\includegraphics[scale=1]{example-image}} \\
\caption{Figure on two pages}
\label{image}
\end{figure}
%%%--------------Tabular Figure --------%%%%%%%%%%
\begin{figure}
%%Original image
\subfloat[Original image]{%
\begin{minipage}{\linewidth}
\centering
\begin{tabularx}{\linewidth}{YYYY}
\includegraphics[scale=1]{example-image} \\
\end{tabularx}
\end{minipage}}\par\medskip
%% First Layer
\subfloat[Third layer]{%
\begin{minipage}{\linewidth}
%\centering
\begin{tabularx}{\linewidth}{YYYYY}
\includegraphics[scale=0.5]{example-image}
&\includegraphics[scale=0.5]{example-image} \\
First image & Second image
\end{tabularx}
\end{minipage}}
\phantomcaption
\end{figure}
%%%%%%%%%%%%%%%%%Figure continued%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{figure}[ht]
\ContinuedFloat
%%Second Layer
\subfloat[Forth layer]{%
\begin{minipage}{\linewidth}
%\centering
\begin{tabularx}{\linewidth}{YYYYY}
\includegraphics[scale=0.5]{example-image}
&\includegraphics[scale=0.5]{example-image} \\
First image & Second image
\end{tabularx}
\end{minipage}}
\caption{Figure using Tables}
\label{image}
\end{figure}
\end{document}
No Solution yet:
subfighas some issues withhyperref, is switching tosubcaptionan option? – Torbjørn T. Sep 03 '15 at 09:06Undefined control sequence \subfloat. And, changing the whole structure will be a problem as this is just a MWE of whole big file. – skm Sep 03 '15 at 09:105.1,5.25.35.25.15.0. And after removinghyperref, it becomes5.1,5.25.35.35.35.3. So, the problem persists even after removinghyperref. – skm Sep 03 '15 at 09:14subcaption. I will try to make changes in my original file if it helps – skm Sep 03 '15 at 09:44subfigis known not to behave well withhyperref. Usesubcaptionas recommended by @TorbjørnT. – egreg Sep 03 '15 at 10:27