![列中文本的垂直对齐](https://linux22.com/image/354652/%E5%88%97%E4%B8%AD%E6%96%87%E6%9C%AC%E7%9A%84%E5%9E%82%E7%9B%B4%E5%AF%B9%E9%BD%90.png)
我想知道如何将文本置于此表第一列的中心:
\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}