在表格单元格内插入带换行文本的图像

在表格单元格内插入带换行文本的图像

我可以在表格中插入图像,但在图像下方添加文本的格式方面遇到了困难。我不想使用标题,因为我不想出现“图 x”。理想情况下应该是这样的:

在此处输入图片描述

我努力了

\includegraphics[scale=1]{img/Picture1}\newline Dummy Text

但它不起作用。

任何意见都值得赞赏!

这是我的乳胶所要求的可执行格式:

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{graphicx}
\usepackage{subfigure}

\begin{document}

\begin{table}[h!]
\begin{tabular}{| l{} |l|l|l|l|l|l|l|}
\hline
  & \includegraphics[scale=1]{img/Picture1}\newline
  Some Dummy Data
  & \includegraphics[scale=1]{img/Picture2}\newline
  Some Dummy Data
  & \includegraphics[scale=1]{img/Picture3}\newline
Some Dummy Data
  & \includegraphics[scale=1]{img/Picture4}\newline
Some Dummy Data
  & \includegraphics[scale=1]{img/Picture5}\newline
Some Dummy Data 
  & \includegraphics[scale=1]{img/Picture6}\newline
Some Dummy Data 
  & \includegraphics[scale=1]{img/Picture7}  \\ \hline
  &   &   &   &   &  &  &  \\ \hline
  &   &   &   &   &  &  &  \\ \hline
  &   &   &   &   &  &  &  \\ \hline
  &   &   &   &   &  &  &  \\ \hline
\end{tabular}
\end{table}

\end{document}

答案1

像这样?

在此处输入图片描述

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{graphicx}
\usepackage{makecell, tabularx}
\usepackage{subfigure} % this package is obsolete, use subfig or subcaption instead

\begin{document}
    \begin{table}[ht] % just h! can cause problems ...
    \setkeys{Gin}{width=\linewidth} % common settings of caption width
    \setcellgapes{3pt} % additinal vertical space around cells content
    \makegapedcells
\begin{tabularx}{\linewidth}{| l | * {6}{X|}}  % that table is fit between text borders
                                               % and text in cells can be automatic broken
    \hline
    &   \includegraphics{example-image-duck}\par
        Some Dummy Data
    &   \includegraphics{example-image-duck}\par
        Some Dummy Data
    &   \includegraphics{example-image-duck}\par
        Some Dummy Data
    &   \includegraphics{example-image-duck}\par
        Some Dummy Data
    &   \includegraphics{example-image-duck}\par
        Some Dummy Data
    &   \includegraphics{example-image-duck}\par
        Some Dummy Data         \\
    \hline
1   & 2 & 3 & 4 & 5 & 6 & 7     \\ \hline
    &   &   &   &   &   &       \\ \hline
    &   &   &   &   &   &       \\ \hline
    &   &   &   &   &   &       \\ \hline
\end{tabularx}
    \end{table}
\end{document}

相关内容