如何使图像在表格列中居中

如何使图像在表格列中居中

我创建了一个跨多页的长表。以下是前两行:

    \begin{longtable}{| p{.05\textwidth} | p{.10\textwidth} | p{.35\textwidth} |p{.5\textwidth} |} 
\hline
\textbf{Kt} & \textbf{Kap. 2.2} & \textbf{Kap. 2.3} & \textbf{Bemerkungen}\\ \hline 
AG & 0.80 & \raisebox{-\totalheight}{\includegraphics[width=0.4\textwidth]{resultate/AG.png}} &\begin{itemize}
    \item bla1 lsdkjflksdjflksdjflk sdfdsf sdfs sfdsf sfdsdf 
    \item bla2
\end{itemize}\\ \hline

AI & 0.80 & \raisebox{-\totalheight}{\includegraphics[width=0.4\textwidth]{resultate/AI.png}} &\begin{itemize}
    \item bla1 lsdkjflksdjflksdjflk sdfdsf sdfs sfdsf sfdsdf 
    \item bla2
\end{itemize}\\ \hline

\caption{Your caption here} % needs to go inside longtable environment
\label{tab:myfirstlongtable}
\end{longtable}

以下是代码结果 代码结果

我怎么能:

  1. 将文本垂直和水平居中于前两列?
  2. 将图片放在第三列的中央吗?

答案1

刚刚提出了这个解决方案来使图像居中:

\documentclass{article}
\usepackage{tabularx}
\usepackage{pdfpages}
\usepackage{vcell}

\begin{document}

\begin{tabular}{p{2cm}|p{3cm}|p{5cm}|p{2cm}}

\hline

your text column 1& your text column 2&
\begin{minipage}{4cm}
   \centering
   \includegraphics[width=4cm]{image.jpg}
    \end{minipage} & your text column 4\\ 
    \hline
 & &

 \begin{minipage}{4cm}
   \centering
\includegraphics[width=4cm]{image.jpg}
  
    \end{minipage} & your text column 4\\  [\rowheight]
    \hline
 
 & & & \\
 & & & \\
 
\end{tabular}

\end{document}

相关内容