包含图片和换行文本的表格

包含图片和换行文本的表格

我正在尝试构建两列的表格。第一列包含一张图片,第二列包含相当长的描述。此外,表格的大小超过一页,因此我的想法是使用长桌包。这是我的代码:

\begin{longtable}{|c|c|} \hline
\raisebox{-.5\height}{\includegraphics[width=6cm]{Thesis/figures/ALICE.jpg}} & \parbox[t]{10cm}{\centering \textbf{ALICE} is designed to study heavy-ions collisions. It is mostly focusing on study of the quark-gluon plasma. \strut}  \\\hline   \raisebox{-.5\height}{\includegraphics[width=6cm]{Thesis/figures/Alpha.jpg}} & \parbox[t]{10cm}{ \textbf{ALPHA} is working on trapped antihidrogen atoms. The precise measurement of hydrogen and antihydrogen may allows to understand the fundamental symmetries between matter and antimatter. \strut}  \\\hline
\raisebox{-.5\height}{\includegraphics[width=6cm]{Thesis/figures/AMS.jpeg}} & \parbox[t]{10cm}{ \textbf{AMS} is a particle detector that looks for dark matter, antimatter and missing matter. It is attached to the International Space Station. \strut}  \\\hline

\end{longtable}

结果如下: 在此处输入图片描述

我怎样才能改善我的桌子的布局?

答案1

您喜欢图像周围有空白吗?

在此处输入图片描述

借助该软件包,adjustwidth你可以将图像基线移动到其中心,还可以在图像上方和下方添加垂直空间。更短的代码是Gin使用 Skillmon 的 hack 提供的键这个答案

\documentclass{article}
\usepackage{geometry}
\usepackage{ragged2e}
\usepackage{array, longtable}

\usepackage[export]{adjustbox}
\usepackage{etoolbox}

\begin{document}
\begingroup
    \expandafter\patchcmd\csname Gin@ii\endcsname   % needed etoolbox
      {\setkeys {Gin}{#1}}
      {\setkeys {Gin}
          {width=\linewidth,                     % standard graphicx settings
           valign=c, margin=-3pt 6pt 0pt 6pt,#1}     % settings from adjustbox
      }
      {}{}
\begin{longtable}{|p{\dimexpr0.4\linewidth-2\tabcolsep-1.33\arrayrulewidth}|
                   m{\dimexpr0.6\linewidth-2\tabcolsep-1.33\arrayrulewidth}|
                }
    \hline
\includegraphics{example-image-duck}
    & \textbf{ALICE} is designed to study heavy-ions collisions. It is mostly focusing on study of the quark-gluon plasma.            \\
    \hline
\includegraphics{example-image-duck}
    & \textbf{ALPHA} is working on trapped antihidrogen atoms. The precise measurement of hydrogen and antihydrogen may allows to understand the fundamental symmetries between matter and antimatter.                      \\
    \hline
\includegraphics{example-image-duck}
    & \textbf{AMS} is a particle detector that looks for dark matter, antimatter and missing matter. It is attached to the International Space Station   \\
    \hline
\end{longtable}
\endgroup
\end{document}

答案2

这个解决方案实现为一段\fboxes。 \lineskip用于重叠盒子的边缘。

\documentclass[]{report}
\usepackage{graphicx}

\begin{document}
\noindent{\fboxsep=0pt 
\lineskip=-\fboxrule
\fbox{\raisebox{-.5\height}{\includegraphics[width=6cm]{example-image-a}}\vrule
  \hspace{\tabcolsep}\parbox{6cm}{\textbf{ALICE} is designed to study heavy-ions collisions. 
    It is mostly focusing on study of the quark-gluon plasma.}\hspace{\tabcolsep}}
\fbox{\raisebox{-.5\height}{\includegraphics[width=6cm]{example-image-b}}\vrule
  \hspace{\tabcolsep}\parbox{6cm}{\textbf{ALPHA} is working on trapped antihidrogen atoms. 
    The precise measurement of hydrogen and antihydrogen may allows to understand the fundamental 
    symmetries between matter and antimatter.}\hspace{\tabcolsep}}
\fbox{\raisebox{-.5\height}{\includegraphics[width=6cm]{example-image-c}}\vrule
  \hspace{\tabcolsep}\parbox{6cm}{\textbf{AMS} is a particle detector that looks for dark matter, 
    antimatter and missing matter. It is attached to the International Space Station.}\hspace{\tabcolsep}}
\par}% needed to use current lineskip
\end{document}

演示

相关内容