向表中添加图片

向表中添加图片

我想在该表中添加图片。我该怎么做?

\documentclass[a4paper, 12pt]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage [french]{babel}
\usepackage{mathptmx}
\begin{document}


\begin{tabular}{|c|c|c|c|c|}

  \hline
  Titre & Type & Composition & Dimensions & Prix \\
  \hline
  Title & Peinture & 80 x 120 cm & Acrylique, feutre, fusain & 80 \\
   \hline
   Title & Sculpture & 80 x 100 cm & 2.3 & 150 \\
\hline
     Title & Sculpture & 80 x 100 cm & 2.3 & 150 \\
  \hline
\end{tabular}
\end{document}

答案1

您可以\includegraphics使用图形包。您可能还想设置图像的宽度或高度(如果只设置一个,则纵横比将保留)。这样做会产生:

在此处输入图片描述

尽管如此,出于手册中概述的原因,书签包中,我建议删除垂直线并使用\toprule\midrule\bottomrule书签。我认为这个结果是更好看的输出:

在此处输入图片描述

完整代码如下:

\documentclass[a4paper, 12pt]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage [french]{babel}
\usepackage{mathptmx}
\usepackage{mwe}
\usepackage{graphicx}
\usepackage{booktabs}
\begin{document}

\begin{tabular}{|c|c|c|c|c|c|}
  \hline
  Titre & Type & Composition & Dimensions & Prix &Picture \\
  \hline
  Title & Peinture & 80 x 120 cm & Acrylique, feutre, fusain & 80
                  &\includegraphics[width=30mm]{example-image-a} \\
   \hline
   Title & Sculpture & 80 x 100 cm & 2.3 & 150
                  &\includegraphics[width=30mm]{example-image-b} \\
\hline
     Title & Sculpture & 80 x 100 cm & 2.3 & 150
                  &\includegraphics[width=30mm]{example-image-b} \\
  \hline
\end{tabular}

\bigskip

\begin{tabular}{*6c}\toprule
  Titre & Type & Composition & Dimensions & Prix &Picture \\\midrule
  Title & Peinture & 80 x 120 cm & Acrylique, feutre, fusain & 80
                  &\includegraphics[width=30mm]{example-image-a} \\
   Title & Sculpture & 80 x 100 cm & 2.3 & 150
                  &\includegraphics[width=30mm]{example-image-b} \\
     Title & Sculpture & 80 x 100 cm & 2.3 & 150
                  &\includegraphics[width=30mm]{example-image-b} \\
  \bottomrule
\end{tabular}

\end{document}

相关内容