如何在表格环境中垂直居中我的文本?

lmm*_*000 4 latex tabular

我有一个包含 3 列的表格,其中前 2 列是图片,第三列是我对这些图片的评论,但评论“淹没了”,它位于单元格的底部。

我试过用m{2cm}而不是c

\begin{tabularx}{\textwidth}{c c m{2cm}}
Run Code Online (Sandbox Code Playgroud)

但没有变化。

在此处输入图片说明

\begin{table}
\caption{Caption if needed}
\label{tab:lastcheck}
    \begin{tabularx}{\textwidth}{c c c}

     \textbf{O-Na} & \textbf{Na-Y} & \textbf{Comments} \\

     \includegraphics[width=0.3\linewidth]{pic1.png} & 
     \includegraphics[width=0.3\linewidth]{pic2.png} & 
     My comments. \\
    \end{tabularx}
\end{table}
Run Code Online (Sandbox Code Playgroud)

我的文本位于单元格的底部。

sam*_*ter 5

graphbox提供方便的align=c选项垂直中心图片:

\documentclass{article}

\usepackage{tabularx}
\usepackage{array}
\usepackage{graphicx}
\usepackage{graphbox} 
\usepackage{makecell}
\renewcommand\theadfont{\bfseries}

\begin{document}

\begin{table}
\caption{Caption if needed}
\label{tab:lastcheck}
    \begin{tabularx}{\textwidth}{XXX}
     \thead{O-Na} & \thead{Na-Y} & \thead{Comments} \\
     \includegraphics[width=\linewidth,align=c]{example-image-duck} & 
     \includegraphics[width=\linewidth,align=c]{example-image-duck} & 
     My comments. \\
    \end{tabularx}
\end{table}

\end{document}
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明