列中文本的垂直对齐

列中文本的垂直对齐

我想知道如何将文本置于此表第一列的中心:

\begin{figure}
\newcolumntype{a}{>{\columncolor{gray!30}} c}
\centering
\begin{tabular}[!htb]{|a|c|c|c|  }
\hline
\rowcolor{gray!50} 
F/B & 0 [T] & 1 [T] & 4 [T] \\
\toprule
0.03$\left[{\frac{kV}{cm}}\right]$
&\includegraphics[width=38mm]{Graficos/Tablas/Rt_10_F_3000_B_0.pdf}&\includegraphics[width=38mm]{Graficos/Tablas/Rt_10_F_3000_B_2.pdf} &
\includegraphics[width=38mm]{Graficos/Tablas/Rt_10_F_3000_B_4.pdf}\\
\hline \addlinespace[1pt]
...
\end{tabular}
\end{figure}

结果是这样的: 呃

答案1

一个解决方案是确定图片的高度,然后使用它\raisebox来将文本提升一半。另一个解决方案是\raisebox在每张图片上使用它来将基线居中。

对于图形来说,\raisebox比 更好\parbox

\documentclass{article}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{array}
\usepackage{colortbl}
\usepackage{booktabs}

\newlength{\tempdima}

\newcommand{\vcgraphics}[1]% #1 = filename
{\raisebox{-0.5\height}{\includegraphics[width=38mm]{#1}}}

\newcolumntype{a}{>{\columncolor{gray!30}} c}
\begin{document}

\begin{figure}
\settoheight{\tempdima}{\includegraphics[width=38mm]{example-image}}% get image height
\centering
\begin{tabular}[!htb]{|a|c|c|c|  }
\hline
\rowcolor{gray!50} 
F/B & 0 [T] & 1 [T] & 4 [T] \\
\toprule
\raisebox{0.5\tempdima}{0.03$\left[{\frac{kV}{cm}}\right]$}
&\includegraphics[width=38mm]{example-image-a}&\includegraphics[width=38mm]{example-image-b} &
\includegraphics[width=38mm]{example-image-c}\\
\hline \addlinespace[1pt]
0.03$\left[{\frac{kV}{cm}}\right]$
&\vcgraphics{example-image-a}&\vcgraphics{example-image-b} &
\vcgraphics{example-image-c}
\end{tabular}
\end{figure}

\end{document}

演示

相关内容