为什么标题以数字 2 开头以及如何修复它?
\documentclass{article}
\usepackage{mwe}
\usepackage{subcaption}
\begin{document}
\begin{center}
\captionsetup{type=figure}
\begin{subfigure}{0.4\textwidth}
\includegraphics[width=\textwidth]{example-image-a.pdf}
\end{subfigure}
\begin{subfigure}{0.4\textwidth}
\includegraphics[width=\textwidth]{example-image-b.pdf}
\end{subfigure}
\captionof{figure}{Description}
\end{center}
\end{document}
也许还会看到这里
答案1
使用H
图形环境的放置,或添加此作为解决方法\addtocounter{figure}{-1}
::
\documentclass{article}
\usepackage{mwe}
\usepackage{subcaption,float}
\begin{document}
\begin{figure}[H]
\centering
\begin{subfigure}{0.4\textwidth}
\includegraphics[width=\textwidth]{example-image-a.pdf}
\end{subfigure}
\qquad
\begin{subfigure}{0.4\textwidth}
\includegraphics[width=\textwidth]{example-image-b.pdf}
\end{subfigure}
\caption{Description}
\end{figure}
\begin{center}
\captionsetup{type=figure}\addtocounter{figure}{-1}
\begin{subfigure}{0.4\textwidth}
\includegraphics[width=\textwidth]{example-image-a.pdf}
\end{subfigure}
\qquad
\begin{subfigure}{0.4\textwidth}
\includegraphics[width=\textwidth]{example-image-b.pdf}
\end{subfigure}
\captionof{figure}{Description}
\end{center}
\end{document}