我正在尝试将此(之前在 ACM MM 会议论文中工作)放入我的论文中。我不确定如何修复此错误:
\begin{figure}[t]
\centering
\captionsetup[subfigure]{labelformat=empty}
\subfloat[ \label{fig:PKR}]{%
\includegraphics[width=1.8cm, height=1.8cm]{figures/nonfood/1798839913309241231.jpg}}
\hspace{.5em}
\subfloat[\label{fig:PKT} ]{%
\includegraphics[width=1.8cm, height=1.8cm]{figures/nonfood/1802196180958251139_1.jpg}}
\hspace{.5em}
\subfloat[\label{fig:tie5}]{%
\includegraphics[width=1.8cm, height=1.8cm]{figures/nonfood/1779651030105353949.jpg}}
\hspace{.5em}
\subfloat[\label{fig:PKR}]{%
\includegraphics[width=1.8cm, height=1.8cm]{figures/nonfood/1778498672250657472_8.jpg}}\\
\vspace*{-.3cm}
\subfloat[ \label{fig:PKR}]{%
\includegraphics[width=1.8cm, height=1.8cm]{figures/food/1979635016158043221.jpg}}
\hspace{.5em}
\subfloat[ \label{fig:PKT} ]{%
\includegraphics[width=1.8cm, height=1.8cm]{figures/food/1719645603783530760.jpg}}
\hspace{.5em}
\subfloat[ \label{fig:tie5}]{%
\includegraphics[width=1.8cm, height=1.8cm]{figures/food/1705109660573689268_2.jpg}}
\hspace{.5em}
\subfloat[\label{fig:PKR}]{%
\includegraphics[width=1.8cm, height=1.8cm]{figures/food/1689999632951126918_2.jpg}}
\vspace*{-0.3cm}
\caption{Images correctly classified by KenyanFC but misclassified by ResNeXt101 when trained on FCD and tested on our Kenya104K. Images in the first row are non-food images misclassified as food images; images in the second row are food images misclassified as non-food images.}
\label{fig:fnf_failure}
\vspace*{-0.2cm}
\end{figure}
图像如下所示:
虽然它们应该显示为:
以下是已发表论文的链接:https://dl.acm.org/doi/10.1145/3347448.3357170
请注意,我的论文是单栏的,而会议论文是双栏的。
答案1
这subfig
包裹在您的序言中缺失。但是,如果您的意图是输出只是一个图片数组,而不显示任何单独图片的编号,那么您只需tabular
在 中使用结构即可figure
。使用\label
没有任何意义,因为没有编号可供参考。
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}[t]
\centering
\begin{tabular}{ *{4}{c} }
\includegraphics[width=1.8cm, height=1.8cm]{example-image} &
\includegraphics[width=1.8cm, height=1.8cm]{example-image-a} &
\includegraphics[width=1.8cm, height=1.8cm]{example-image-b} &
\includegraphics[width=1.8cm, height=1.8cm]{example-image-c}
\\
\includegraphics[width=1.8cm, height=1.8cm]{example-image-c} &
\includegraphics[width=1.8cm, height=1.8cm]{example-image-b} &
\includegraphics[width=1.8cm, height=1.8cm]{example-image-a} &
\includegraphics[width=1.8cm, height=1.8cm]{example-image}
\end{tabular}
\caption{Images correctly classified by KenyanFC but misclassified by ResNeXt101 when trained
on FCD and tested on our Kenya104K. Images in the first row are non-food images misclassified
as food images; images in the second row are food images misclassified as non-food images.}
\end{figure}
\end{document}
行和列之间的间距可以根据需要进行调整。
答案2
类似这样的吗?(我没有 MWE 和您的图片):试试看。如果您想减少数字之间的间距,请查看 的值\hspace{1em}
。
\documentclass[12pt]{article}
\usepackage{subfig}
\usepackage{graphicx}
\captionsetup[subfigure]{labelformat=empty}
\captionsetup[figure]{labelfont=bf}
\begin{document}
\begin{figure}
\centering
\subfloat[]{\includegraphics[width=1.8cm,height=1.8cm]{example-image-c}}\hspace{1em}
\subfloat[]{\includegraphics[width=1.8cm,height=1.8cm]{example-image-b}}\hspace{1em}
\subfloat[]{\includegraphics[width=1.8cm,height=1.8cm]{example-image-a}}\hspace{1em}
\subfloat[]{\includegraphics[width=1.8cm,height=1.8cm]{example-image-c}}
\subfloat[]{\includegraphics[width=1.8cm,height=1.8cm]{example-image-b}}\hspace{1em}
\subfloat[]{\includegraphics[width=1.8cm,height=1.8cm]{example-image-b}}\hspace{1em}
\subfloat[]{\includegraphics[width=1.8cm,height=1.8cm]{example-image-c}}\hspace{1em}
\subfloat[]{\includegraphics[width=1.8cm,height=1.8cm]{example-image-c}}
\caption{Images correctly classified by KenyanFC but misclassified by ResNeXt101 when trained on FCD and tested on our Kenya104K. Images in the first row are non-food images misclassified as food images; images in the second row are food images misclassified as non-food images.}
\label{fig:fnf_failure}
\end{figure}
\end{document}
答案3
作为@Sebastiano 答案的补充(+1)......
您还可以使用subcaption
软件包版本 1.3(或最新版本)和Gin
更短图形代码的键:
\documentclass[12pt]{article}
\usepackage{subcaption}
\usepackage{graphicx}
\captionsetup[figure]{font=small, labelfont=bf}
\begin{document}
\begin{figure}
\captionsetup[subfigure]{labelformat=empty}
\setkeys{Gin}{width=1.8cm,height=1.8cm}
\centering
\subfloat[]{\includegraphics{example-image-c}}\hspace{1em}
\subfloat[]{\includegraphics{example-image-b}}\hspace{1em}
\subfloat[]{\includegraphics{example-image-a}}\hspace{1em}
\subfloat[]{\includegraphics{example-image-c}}
\subfloat[]{\includegraphics{example-image-b}}\hspace{1em}
\subfloat[]{\includegraphics{example-image-b}}\hspace{1em}
\subfloat[]{\includegraphics{example-image-c}}\hspace{1em}
\subfloat[]{\includegraphics{example-image-c}}
\caption{Images correctly classified by KenyanFC but misclassified by ResNeXt101 when trained on FCD and tested on our Kenya104K. Images in the first row are non-food images misclassified as food images; images in the second row are food images misclassified as non-food images.}
\label{fig:fnf_failure}
\end{figure}
\end{document}