我正在使用 article 类撰写一篇论文,并使用并排的 2 个图来压缩材料。我正在使用 float 包为附录制作不同的图标签,这样附录图的标题就不会显示在主图列表中。由于某种原因,第一个标题没有显示在附录图中,而第二个标题代替了第一个标题。有什么想法吗?
\documentclass[letterpaper,11pt]{article}
\usepackage{float}
\newfloat{figurea}{htbp}{lofa}[section]
\floatname{figurea}{Figure}
\usepackage{caption}
\captionsetup{labelsep=period,font=small,labelfont=bf,aboveskip=2ex,belowskip=0ex}
\usepackage[title]{appendix}
\begin{document}
\listoffigures
\section{Figures in main body}
\begin{figure}[htb]
\begin{minipage}[b]{0.48\textwidth}
\centering
\framebox[\textwidth]{First fig}
\caption{First fig.}
\label{fig1}
\end{minipage}
\hfill
\begin{minipage}[b]{0.48\textwidth}
\centering
\framebox[\textwidth]{Second fig}
\caption{Second fig.}
\label{fig2}
\end{minipage}
\end{figure}
\begin{appendices}
\section{Figures in appendix}
\begin{figurea}[htb]
\begin{minipage}[b]{0.48\textwidth}
\centering
\framebox[\textwidth]{First figa}
\caption{First figa.}
\label{figa1}
\end{minipage}
\hfill
\begin{minipage}[b]{0.49\textwidth}
\centering
\framebox[\textwidth]{Second figa}
\caption{Second figa.}
\label{figa2}
\end{minipage}
\end{figurea}
\end{appendices}
\end{document}
答案1
使用完全支持的 float 包caption
-newfloat
:
\documentclass{article}
\usepackage{newfloat}
\DeclareFloatingEnvironment[
fileext = lofa,
placement = htbp,
name = Figure,
within = section
]{figurea}
\usepackage{caption}
\captionsetup{labelsep=period,font=small,labelfont=bf,aboveskip=2ex,belowskip=0ex}
\usepackage[title]{appendix}
\begin{document}
\listoffigures
\section{Figures in main body}
\begin{figure}[htb]
\begin{minipage}[b]{0.48\textwidth}
\centering
\framebox[\textwidth]{First fig}
\caption{First fig.}
\end{minipage}
\hfill
\begin{minipage}[b]{0.48\textwidth}
\centering
\framebox[\textwidth]{Second fig}
\caption{Second fig.}
\end{minipage}
\end{figure}
\begin{appendices}
\section{Figures in appendix}
\begin{figurea}[htb]
\begin{minipage}[b]{0.48\textwidth}
\centering
\framebox[\textwidth]{First figa}
\caption{First figa.}
\end{minipage}
\hfill
\begin{minipage}[b]{0.49\textwidth}
\centering
\framebox[\textwidth]{Second figa}
\caption{Second figa.}
\end{minipage}
\end{figurea}
\end{appendices}
\end{document}
答案2
解决方案floatrow
。注意float
必须加载后floatrow (或用它替换):
\documentclass[letterpaper,11pt]{article}
\usepackage{floatrow}%
\DeclareNewFloatType{figurea}
{placement=htbp, name=Figure, within=section, fileext=lofa}
\renewcommand\thefigurea{\arabic{figurea}}
\newfloatcommand{ffigabox}{figurea}[\nocapbeside][]
\usepackage{caption}
\captionsetup{labelsep=period,font=small,labelfont=bf,aboveskip=2ex,belowskip=0ex}
\usepackage[title]{appendix}
\usepackage{float}
\begin{document}
\listoffigures
\section{Figures in main body}
\begin{figure}[!ht]
\begin{floatrow}
\ffigbox{\caption{First fig.} \label{fig1}}{\framebox[0.48\textwidth]{First fig}}
\ffigbox{\caption{Second fig.} \label{fig2}}{\framebox[0.48\textwidth]{Second fig}}
\end{floatrow}
\end{figure}
\begin{appendices}
\section{Figures in appendix}
\begin{figurea}[htb]
\begin{floatrow}%
\ffigabox{\caption{First figa.} \label{figa1}}{\framebox[0.48\textwidth]{First figa}}
\ffigabox{ \caption{Second figa.} \label{figa2}}{\framebox[0.48\textwidth]{Second figa}}
\end{floatrow}
\end{figurea}
\end{appendices}
\end{document}