![在 tabularx 环境中垂直对齐文本](https://linux22.com/image/336761/%E5%9C%A8%20tabularx%20%E7%8E%AF%E5%A2%83%E4%B8%AD%E5%9E%82%E7%9B%B4%E5%AF%B9%E9%BD%90%E6%96%87%E6%9C%AC.png)
我尝试了在 TexExchange 上找到的不同方法。但都没有成功。我不确定嵌入的图形是否会导致这种行为。我想将所有文本居中对齐或居中对齐,以使其看起来更好。我当前的表格如下所示:
\begin{table}[ht]
\centering
\begin{tabularx}{\textwidth}{llll}
\bfseries Label & \bfseries Membership- & \bfseries Parameters & \bfseries Graph \\
& \bfseries Function & [m] & \bfseries \\
\hline
\textbf{\emph{near}} & trapezoidal & $\{0.3, 0.75\}$ & \includegraphics[height=3.75cm]{03_Figures/05_fuzzy_distance_near.eps} \\
\hline
\textbf{\emph{medium}} & trapezoidal & $\{0.5, 1.0, 2.0, 2.5\}$ & \includegraphics[height=3.75cm]{03_Figures/05_fuzzy_distance_medium.eps} \\
\hline
\textbf{\emph{far}} & trapezoidal & $\{1.5, 2.0, 2.5, 3.0\}$ & \includegraphics[height=3.75cm]{03_Figures/05_fuzzy_distance_far.eps} \\
\hline
\textbf{\emph{very far}} & trapezoidal & $\{2.5, 4.0\}$ & \includegraphics[height=3.75cm]{03_Figures/05_fuzzy_distance_veryfar.eps} \\
\hline
\end{tabularx}
\caption{Input Fuzzy Sets for Distance}
\label{tab:fuzzySetDistance}
\end{table}
答案1
出现这种情况的原因是图形文件位于行的基线上,因此它们是底部对齐的。要使它们与行顶部对齐,请使用
\raisebox{-\height}{\includegraphics[height=3.75cm]{03_Figures/05_fuzzy_distance_near.eps}}
所有图形都是如此。
要使它们垂直居中,请使用
\raisebox{-\height}{\includegraphics[height=3.75cm]{03_Figures/05_fuzzy_distance_near.eps}}
另外,与 Runar Trollet 的建议类似,使用序言
\begin{tabularx}{\linewidth}{XXX}
否则,就没有理由使用了tabularx
。