如何在 table 环境中将我的文本垂直居中?
How to center my text vertically in a table environment?
我有一个 table 有 3 列,其中前两列是图片,第三列是我对这些图片的评论,但是评论 "drowns",它在底部细胞.
我试过 m{2cm}
而不是 c
:
\begin{tabularx}{\textwidth}{c c m{2cm}}
但没有变化。
\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}
我的文字在单元格底部。
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}
我有一个 table 有 3 列,其中前两列是图片,第三列是我对这些图片的评论,但是评论 "drowns",它在底部细胞.
我试过 m{2cm}
而不是 c
:
\begin{tabularx}{\textwidth}{c c m{2cm}}
但没有变化。
\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}
我的文字在单元格底部。
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}