错误消息:额外的对齐制表符已更改为 \cr

错误消息:额外的对齐制表符已更改为 \cr

您好,我在处理图像表时遇到此错误。

\begin{figure}[h]
\centering
 \begin{tabular}{c c c c c}
         (a\includegraphics[scale=0.3]{A.jpg} & (b\includegraphics[scale=0.3]{B.jpg}  & (c\includegraphics[scale=0.3]{C.jpg}  & (d\includegraphics[scale=0.3]{D.jpg} & (e\includegraphics[scale=0.3]{E.jpg} 

         & (f\includegraphics[scale=0.3]{F.jpg} & (g\includegraphics[scale=0.3]{G.jpg} & (h\includegraphics[scale=0.3]{H.jpg} & (i\includegraphics[scale=0.3]{I.jpg}   & (j\includegraphics[scale=0.3]{J.jpg} 

        & (k\includegraphics[scale=0.3]{K.jpg} & (l\includegraphics[scale=0.3]{L.jpg} & (m\includegraphics[scale=0.3]{M.jpg} & (n\includegraphics[scale=0.3]{N.jpg} & (o\includegraphics[scale=0.3]{O.jpg} 

        & (p\includegraphics[scale=0.3]{P.jpg} & (q\includegraphics[scale=0.3]{Q.jpg} & (r\includegraphics[scale=0.3]{R.jpg} & (s\includegraphics[scale=0.3]{S.jpg} & (t\includegraphics[scale=0.3]{T.jpg} 

        & (u\includegraphics[scale=0.3]{U.jpg} 

    \end{tabular}
    \end{figure}

请注意,目前我没有在每 5 张图片后添加 \,因为编译文件时它们不再位于网格中。如果我添加 \,仍然会显示错误。我该如何修复此问题?

谢谢

答案1

这些图像并不“混乱”,但是(a......内容有点奇怪。

不管怎样,5th列后a\tabularnewline\\必须做!

\documentclass{article}

\usepackage[demo]{graphicx}

\begin{document}
\begin{figure}[ht]
\centering
 \begin{tabular}{*{5}{c}}
   (a\includegraphics[scale=0.3]{A.jpg} & (b\includegraphics[scale=0.3]{B.jpg}  & (c\includegraphics[scale=0.3]{C.jpg}  & (d\includegraphics[scale=0.3]{D.jpg} & (e\includegraphics[scale=0.3]{E.jpg}  \tabularnewline
   (f\includegraphics[scale=0.3]{F.jpg} & (g\includegraphics[scale=0.3]{G.jpg} & (h\includegraphics[scale=0.3]{H.jpg} & (i\includegraphics[scale=0.3]{I.jpg}   & (j\includegraphics[scale=0.3]{J.jpg} \tabularnewline

   (k\includegraphics[scale=0.3]{K.jpg} & (l\includegraphics[scale=0.3]{L.jpg} & (m\includegraphics[scale=0.3]{M.jpg} & (n\includegraphics[scale=0.3]{N.jpg} & (o\includegraphics[scale=0.3]{O.jpg} \tabularnewline

   (p\includegraphics[scale=0.3]{P.jpg} & (q\includegraphics[scale=0.3]{Q.jpg} & (r\includegraphics[scale=0.3]{R.jpg} & (s\includegraphics[scale=0.3]{S.jpg} & (t\includegraphics[scale=0.3]{T.jpg} \tabularnewline

   (u\includegraphics[scale=0.3]{U.jpg} \tabularnewline
 \end{tabular}
\end{figure}
\end{document}

更新

\centering这里工作:

\documentclass{article}

\usepackage[demo]{graphicx}

\begin{document}
\begin{figure}[ht]
  \centering

  \begin{tabular}{*{5}{c}}
   (a\includegraphics[width=2cm,height=2cm]{A.jpg} & (b\includegraphics[width=2cm,height=2cm]{B.jpg}  & (c\includegraphics[width=2cm,height=2cm]{C.jpg}  & (d\includegraphics[width=2cm,height=2cm]{D.jpg} & (e\includegraphics[width=2cm,height=2cm]{E.jpg}  \tabularnewline
   (f\includegraphics[width=2cm,height=2cm]{F.jpg} & (g\includegraphics[width=2cm,height=2cm]{G.jpg} & (h\includegraphics[width=2cm,height=2cm]{H.jpg} & (i\includegraphics[width=2cm,height=2cm]{I.jpg}   & (j\includegraphics[width=2cm,height=2cm]{J.jpg} \tabularnewline

   (k\includegraphics[width=2cm,height=2cm]{K.jpg} & (l\includegraphics[width=2cm,height=2cm]{L.jpg} & (m\includegraphics[width=2cm,height=2cm]{M.jpg} & (n\includegraphics[width=2cm,height=2cm]{N.jpg} & (o\includegraphics[width=2cm,height=2cm]{O.jpg} \tabularnewline

   (p\includegraphics[width=2cm,height=2cm]{P.jpg} & (q\includegraphics[width=2cm,height=2cm]{Q.jpg} & (r\includegraphics[width=2cm,height=2cm]{R.jpg} & (s\includegraphics[width=2cm,height=2cm]{S.jpg} & (t\includegraphics[width=2cm,height=2cm]{T.jpg} \tabularnewline

   (u\includegraphics[width=2cm,height=2cm]{U.jpg} \tabularnewline
 \end{tabular}

\end{figure}
\end{document}

相关内容