图中使用子浮点数和中心线时出错

图中使用子浮点数和中心线时出错

我想要并排显示 6 个数字,我有 4 个系列的数字。我有以下乳胶代码:

\documentclass{article}
\usepackage{spconf,amsmath,graphicx}
\usepackage{romannum}
\def\x{{\mathbf x}}
\def\L{{\cal L}}
\begin{document}
\begin{figure}[htb]
    \centerline{
    \subfloat{\includegraphics[width=1cm]{example-image.png}}\hspace{0.6mm}%
    \subfloat{\includegraphics[width = 1cm]{example-image.png}}\hspace{0.6mm}%
    \subfloat{\includegraphics[width = 1cm]{example-image.png}}\hspace{0.6mm}%
    \subfloat{\includegraphics[width = 1cm]{example-image.png}}\hspace{0.6mm}%
    \subfloat{\includegraphics[width = 1cm]{example-image.png}}\hspace{0.6mm}%
    \subfloat{\includegraphics[width = 1cm]{example-image.png}}\hspace{0.6mm}%
    \subfloat{\includegraphics[width = 1cm]{example-image.png}}\hspace{0.6mm}%
    \subfloat{\includegraphics[width = 1cm]{img/Amp/340_GT.png}}\\}
    \centerline{
    \subfloat{\includegraphics[width = 1cm]{example-image.png}}\hspace{0.6mm}%
    \subfloat{\includegraphics[width = 1cm]{example-image.png}}\hspace{0.6mm}%
    \subfloat{\includegraphics[width = 1cm]{example-image.png}}\hspace{0.6mm}%
    \subfloat{\includegraphics[width = 1cm]{example-image.png}}\hspace{0.6mm}%
    \subfloat{\includegraphics[width = 1cm]{example-image.png}}\hspace{0.6mm}%
    \subfloat{\includegraphics[width = 1cm]{example-image.png}}\hspace{0.6mm}%
    \subfloat{\includegraphics[width = 1cm]{example-image.png}}\hspace{0.6mm}%
    \subfloat{\includegraphics[width = 1cm]{example-image.png}}\\}
    \centerline{
    \subfloat{\includegraphics[width = 1cm]{example-image.png}}\hspace{0.6mm}%
    \subfloat{\includegraphics[width = 1cm]{example-image.png}}\hspace{0.6mm}%
    \subfloat{\includegraphics[width = 1cm]{example-image.png}}\hspace{0.6mm}%
    \subfloat{\includegraphics[width = 1cm]{example-image.png}}\hspace{0.6mm}%
    \subfloat{\includegraphics[width = 1cm]{example-image.png}}\hspace{0.6mm}%
    \subfloat{\includegraphics[width = 1cm]{example-image.png}}\hspace{0.6mm}%
    \subfloat{\includegraphics[width = 1cm]{example-image.png}}\hspace{0.6mm}%
    \subfloat{\includegraphics[width = 1cm]{img/Amp/601_GT.png}}\\}
    \centerline{
    \subfloat{\includegraphics[width = 1cm]{example-image.png}}\hspace{0.6mm}%
    \subfloat{\includegraphics[width = 1cm]{example-image.png}}\hspace{0.6mm}%
    \subfloat{\includegraphics[width = 1cm]{example-image.png}}\hspace{0.6mm}%
    \subfloat{\includegraphics[width = 1cm]{example-image.png}}\hspace{0.6mm}%
    \subfloat{\includegraphics[width = 1cm]{example-image.png}}\hspace{0.6mm}%
    \subfloat{\includegraphics[width = 1cm]{example-image.png}}\hspace{0.6mm}%
    \subfloat{\includegraphics[width = 1cm]{img/Fourth/289_PR.png}}\hspace{0.6mm}%
    \subfloat{\includegraphics[width = 1cm]{example-image.png}}\\}
    \caption{caption}
    \label{fig: Sos Prediction}
\end{figure}
\end{document}

图形显示正确,但每行的最后一个子浮点数出现错误:

undefined control sequence

{\includegraphics [width=1cm]{example-image.png}}...
l.323 ...hics[width = 1cm]{example-image.png}}\\}
                                                  
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

我不知道为什么会出现这个错误,有什么想法吗?

答案1

这可能会为你指明正确的方向

在此处输入图片描述

\documentclass[demo]{article} % remove 'demo' option in real document
\usepackage{graphicx,subcaption}
\begin{document}
\begin{figure}[!htb]
\captionsetup[subfigure]{font=bf}
\begin{subfigure}{0.16\linewidth}
\includegraphics[width=1\textwidth]{420}
\caption*{420}
\end{subfigure}\hfill
\begin{subfigure}{0.16\linewidth}
\includegraphics[width=1\textwidth]{421}
\caption*{421}
\end{subfigure}\hfill
\begin{subfigure}{0.16\linewidth}
\includegraphics[width=1\textwidth]{422}
\caption*{422}
\end{subfigure}\hfill
\begin{subfigure}{0.16\linewidth}
\includegraphics[width=1\textwidth]{423}
\caption*{423}
\end{subfigure}\hfill
\begin{subfigure}{0.16\linewidth}
\includegraphics[width=1\textwidth]{424}
\caption*{424}
\end{subfigure}\hfill
\begin{subfigure}{0.16\linewidth}
\includegraphics[width=1\textwidth]{425}
\caption*{425}
\end{subfigure}
\end{figure}%
\begin{figure}[!htb]
    \captionsetup[subfigure]{font=bf}
    \begin{subfigure}{0.16\linewidth}
        \includegraphics[width=1\textwidth]{420}
        \caption*{420}
    \end{subfigure}\hfill
    \begin{subfigure}{0.16\linewidth}
        \includegraphics[width=1\textwidth]{421}
        \caption*{421}
    \end{subfigure}\hfill
    \begin{subfigure}{0.16\linewidth}
        \includegraphics[width=1\textwidth]{422}
        \caption*{422}
    \end{subfigure}\hfill
    \begin{subfigure}{0.16\linewidth}
        \includegraphics[width=1\textwidth]{423}
        \caption*{423}
    \end{subfigure}\hfill
    \begin{subfigure}{0.16\linewidth}
        \includegraphics[width=1\textwidth]{424}
        \caption*{424}
    \end{subfigure}\hfill
    \begin{subfigure}{0.16\linewidth}
        \includegraphics[width=1\textwidth]{425}
        \caption*{425}
    \end{subfigure}
\end{figure}%
\begin{figure}[!htb]
    \captionsetup[subfigure]{font=bf}
    \begin{subfigure}{0.16\linewidth}
        \includegraphics[width=1\textwidth]{420}
        \caption*{420}
    \end{subfigure}\hfill
    \begin{subfigure}{0.16\linewidth}
        \includegraphics[width=1\textwidth]{421}
        \caption*{421}
    \end{subfigure}\hfill
    \begin{subfigure}{0.16\linewidth}
        \includegraphics[width=1\textwidth]{422}
        \caption*{422}
    \end{subfigure}\hfill
    \begin{subfigure}{0.16\linewidth}
        \includegraphics[width=1\textwidth]{423}
        \caption*{423}
    \end{subfigure}\hfill
    \begin{subfigure}{0.16\linewidth}
        \includegraphics[width=1\textwidth]{424}
        \caption*{424}
    \end{subfigure}\hfill
    \begin{subfigure}{0.16\linewidth}
        \includegraphics[width=1\textwidth]{425}
        \caption*{425}
    \end{subfigure}
\end{figure}%
\begin{figure}[!htb]
    \captionsetup[subfigure]{font=bf}
    \begin{subfigure}{0.16\linewidth}
        \includegraphics[width=1\textwidth]{420}
        \caption*{420}
    \end{subfigure}\hfill
    \begin{subfigure}{0.16\linewidth}
        \includegraphics[width=1\textwidth]{421}
        \caption*{421}
    \end{subfigure}\hfill
    \begin{subfigure}{0.16\linewidth}
        \includegraphics[width=1\textwidth]{422}
        \caption*{422}
    \end{subfigure}\hfill
    \begin{subfigure}{0.16\linewidth}
        \includegraphics[width=1\textwidth]{423}
        \caption*{423}
    \end{subfigure}\hfill
    \begin{subfigure}{0.16\linewidth}
        \includegraphics[width=1\textwidth]{424}
        \caption*{424}
    \end{subfigure}\hfill
    \begin{subfigure}{0.16\linewidth}
        \includegraphics[width=1\textwidth]{425}
        \caption*{425}
    \end{subfigure}
\end{figure}
\end{document}

答案2

半年后...由于您的主要问题已通过@PM 评论解决,这里有一些关于如何纠正/改进您的 MWE 的题外建议:

  • 因为所有图像的宽度都相同,所以你可以使用通用设置\setkeys{Gin}{...}
  • 对于页面上的图像居中,最好\centerline{...}使用命令\centering
  • 要开始新的图像行,只需插入空行
  • 而不是固定图像之间的距离\hfil
\documentclass{article}
\usepackage{graphicx}
\usepackage{subfig}

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\begin{document}
\begin{figure}[htb]
\centering
\setkeys{Gin}{width=13mm}
    \subfloat{\includegraphics{example-image}}\hfil%
    \subfloat{\includegraphics{example-image}}\hfil%
    \subfloat{\includegraphics{example-image}}\hfil%
    \subfloat{\includegraphics{example-image}}\hfil%
    \subfloat{\includegraphics{example-image}}\hfil%
    \subfloat{\includegraphics{example-image}}\hfil%
    \subfloat{\includegraphics{example-image}}\hfil%
    \subfloat{\includegraphics{example-image}}

    \subfloat{\includegraphics{example-image}}\hfil%
    \subfloat{\includegraphics{example-image}}\hfil%
    \subfloat{\includegraphics{example-image}}\hfil%
    \subfloat{\includegraphics{example-image}}\hfil%
    \subfloat{\includegraphics{example-image}}\hfil%
    \subfloat{\includegraphics{example-image}}\hfil%
    \subfloat{\includegraphics{example-image}}\hfil%
    \subfloat{\includegraphics{example-image}}

    \subfloat{\includegraphics{example-image}}\hfil%
    \subfloat{\includegraphics{example-image}}\hfil%
    \subfloat{\includegraphics{example-image}}\hfil%
    \subfloat{\includegraphics{example-image}}\hfil%
    \subfloat{\includegraphics{example-image}}\hfil%
    \subfloat{\includegraphics{example-image}}\hfil%
    \subfloat{\includegraphics{example-image}}\hfil%
    \subfloat{\includegraphics{example-image}}

    \subfloat{\includegraphics{example-image}}\hfil%
    \subfloat{\includegraphics{example-image}}\hfil%
    \subfloat{\includegraphics{example-image}}\hfil%
    \subfloat{\includegraphics{example-image}}\hfil%
    \subfloat{\includegraphics{example-image}}\hfil%
    \subfloat{\includegraphics{example-image}}\hfil%
    \subfloat{\includegraphics{example-image}}\hfil%
    \subfloat{\includegraphics{example-image}}
\caption{caption}
    \label{fig: Sos Prediction}
\end{figure}
\end{document}

在此处输入图片描述

相关内容