在表格的每个单元格中添加图像

在表格的每个单元格中添加图像

我尝试在每一行(每列的第一行除外)插入一张图片,但每次我尝试在每行的最后一个单元格插入一张图片时都不起作用,请参见下文。

\begin{table}[H]
    \centering
    \captionof{table}{Morphological Table}
    \begin{tabular}{ |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{3.5cm}|p{3.5cm}|}  
        \hline
        \hline

    \textbf{} & \textbf{Idea 1} &  \textbf{Idea 2} &  \textbf{Idea 3} &  \textbf{Idea 4}  \\ \hline \hline

    (eg) Hoist Motor & DC Motor \centering \includegraphics[scale=0.35]{saxion-logo.jpg}  & DC Motor \centering \includegraphics[scale=0.35]{saxion-logo.jpg} & DC Motor \centering \includegraphics[scale=0.35]{saxion-logo.jpg} & DC Motor \centering \includegraphics[scale=0.35]{saxion-logo.jpg} \\  \hline 

    1 & DC Motor \centering \includegraphics[scale=0.35]{saxion-logo.jpg} & DC Motor \centering \includegraphics[scale=0.35]{saxion-logo.jpg} & DC Motor \centering \includegraphics[scale=0.35]{saxion-logo.jpg} & DC Motor \centering \includegraphics[scale=0.35]{saxion-logo.jpg} \\ \hline


\end{tabular}
\end{table}

如果将每行最后一个单元格的内容替换为简单文本,则表格将正常运行(例如如下所示);这让我感到困惑,为什么只有最后一个单元格会影响结果:

\begin{table}[H]
    \centering
    \captionof{table}{Morphological Table}
    \begin{tabular}{ |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{3.5cm}|p{3.5cm}|}  
        \hline
        \hline

        \textbf{} & \textbf{Idea 1} &  \textbf{Idea 2} &  \textbf{Idea 3} &  \textbf{Idea 4}  \\ \hline \hline

        (eg) Hoist Motor & DC Motor \centering \includegraphics[scale=0.35]{saxion-logo.jpg}  & DC Motor \centering \includegraphics[scale=0.35]{saxion-logo.jpg} & DC Motor \centering \includegraphics[scale=0.35]{saxion-logo.jpg} & 1 \\  \hline 

        1 & DC Motor \centering \includegraphics[scale=0.35]{saxion-logo.jpg} & DC Motor \centering \includegraphics[scale=0.35]{saxion-logo.jpg} & DC Motor \centering \includegraphics[scale=0.35]{saxion-logo.jpg} & 1 \\ \hline


    \end{tabular}
    \end{table}

提前感谢您的任何意见

答案1

\centering改变 的含义\\;如果它位于表格的最后一列,请将行结尾更改\\\tabularnewline

相关内容