![向表中添加图片](https://linux22.com/image/343096/%E5%90%91%E8%A1%A8%E4%B8%AD%E6%B7%BB%E5%8A%A0%E5%9B%BE%E7%89%87.png)
我想在该表中添加图片。我该怎么做?
\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}