我需要有包含多个子图的图形。在某些情况下,图形的子图必须转到下一页。为此,我必须使用\continuedFloat
但图像的图形数量保持不变(或有时完全奇怪)。
我之前问过这个问题这里也有人问过类似的问题这里但这两个问题的解决方案对我来说都不起作用。因此,我发布了一个带有最少工作示例的新问题。
重要更新:我刚刚意识到,如果我删除该行\usepackage[hidelinks]{hyperref}
,那么一切都会正常。但是如果我保留该行代码,那么两个图形的图形编号将保持不变。
我的代码(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}
尚无解决方案:
答案1
也可以使用 来使它工作subfig
,但这里有一个使用 的示例subcaption
。它提供了一个subfigure
环境和一个subcaption
命令。前者是一个minipage
类似环境,用作
\begin{subfigure}{\linewidth}
\includegraphics{example-image}
\caption{This is a sub-caption.}
\end{subfigure}
后者代替了普通的\caption
,并改为制作子标题。一般来说,这应该只在组或环境中使用。手册中展示了一个带有 minipage
s 的示例,在下面的代码中,我只是在它和图形周围添加了一对括号。
使用下面的代码,您可以得到预期的数字 1.1、1.2、1.3、1.4。
\documentclass[12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[a4paper, width=425.196850394pt, top=70.866141732pt,bottom=70.866141732pt]{geometry}
\usepackage{float}
\raggedbottom
\usepackage{subcaption}
\usepackage[hidelinks]{hyperref}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%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}
\centering
\includegraphics[scale=0.5]{example-image}
\caption{Figure on a single page.}
\end{figure}
%%%---------------------------------------------Two page Figure---------------------%%%%%%%%%%
\begin{figure}
\begin{subfigure}{\linewidth}
\includegraphics[scale=1]{example-image}
\caption{}
\end{subfigure}
{\includegraphics[scale=1]{example-image}
\subcaption{}}
\end{figure}
\begin{figure}
\ContinuedFloat
\begin{subfigure}{\linewidth}
\includegraphics[scale=1]{example-image}
\caption{}
\end{subfigure}
\caption{Figure on two pages}
\end{figure}
% Normal figure
\begin{figure}
\centering
\includegraphics[scale=0.5]{example-image}
\caption{Figure on a single page.}
\end{figure}
% continued floats
\begin{figure}
\begin{subfigure}{\linewidth}
\includegraphics[scale=1]{example-image}
\caption{}
\end{subfigure}
{\includegraphics[scale=1]{example-image}
\subcaption{}}
\end{figure}
\begin{figure}
\ContinuedFloat
\begin{subfigure}{\linewidth}
\includegraphics[scale=1]{example-image}
\caption{}
\end{subfigure}
\caption{Figure on two pages}
\end{figure}
\end{document}
并排图
就我个人而言,我不会在这种情况下使用tabular
( x
),但如果你愿意,只需将环境tabularx
a放在环境\caption
中subfigure
,即
\begin{subfigure}{\linewidth}
\begin{tabularx}{\linewidth}{YY}
\includegraphics{1} & \includegraphics{2} \\
First & Second
\end{tabularx}
\caption{Third layer}
\end{subfigure}
这是一个不同的建议:
\documentclass[12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage[a4paper, width=425.196850394pt, top=70.866141732pt,bottom=70.866141732pt]{geometry}
\usepackage{subcaption}
\usepackage[hidelinks]{hyperref}
\usepackage{float}
\raggedbottom
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%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.
\begin{figure}
\centering
\includegraphics[scale=0.5]{example-image}
\caption{Figure on a single page.}
\end{figure}
%%%---------------------------------------------Two page Figure---------------------%%%%%%%%%%
\begin{figure}[!ht]
\begin{subfigure}{\linewidth}
\centering
\includegraphics{example-image}
\caption{}
\end{subfigure}
\begin{subfigure}{\linewidth}
\centering
\includegraphics{example-image}
\caption{}
\end{subfigure}
\end{figure}
%%mages on the new page
\begin{figure}
\ContinuedFloat
\begin{subfigure}{\linewidth}
\centering
\includegraphics{example-image}
\caption{}
\end{subfigure}
\caption{Figure on two pages}
\label{image}
\end{figure}
%%%--------------Tabular Figure --------%%%%%%%%%%
\begin{figure}
%%Original image
\begin{subfigure}{\linewidth}
\centering
\includegraphics{example-image}
\caption{Original image}
\end{subfigure}
\par\medskip
\begin{subfigure}{\linewidth}
\centering
\begin{minipage}{0.47\linewidth}
\centering
\includegraphics[scale=0.5]{example-image}
First image
\end{minipage}\hfill
\begin{minipage}{0.47\linewidth}
\centering
\includegraphics[scale=0.5]{example-image}
Second image
\end{minipage}
\caption{Third layer}
\end{subfigure}
\end{figure}
%%%%%%%%%%%%%%%%%Figure continued%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{figure}[ht]
\ContinuedFloat
%%Second Layer
\begin{subfigure}{\linewidth}
\centering
\begin{minipage}{0.47\linewidth}
\centering
\includegraphics[scale=0.5]{example-image}
First image
\end{minipage}\hfill
\begin{minipage}{0.47\linewidth}
\centering
\includegraphics[scale=0.5]{example-image}
Second image
\end{minipage}
\caption{Fourth layer}
\end{subfigure}
\caption{Figure using Tables}
\label{image}
\end{figure}
\end{document}