如何使左侧表格(标记为 1)的单元格内容垂直居中,以使其看起来像右侧表格(标记为 2)的单元格:
我迄今为止的代码:
\begin{table}[H]
\setcellgapes{5pt}
\makegapedcells
\caption{Local Area Network vs Wide Area Network.}
\label{tab:lanvswan}
\centering
\begin{tabular}{
>{\centering\arraybackslash}p{3.5cm}
|>{\centering\arraybackslash}p{4.5cm}
|>{\centering\arraybackslash}p{4.5cm}
}
\thead{Características} & \thead{LAN} & \thead{WAN} \\ \hline
Extensión Geográfica & Pequeña & Extensa \\ \hline
Dispositivos & Host, Switches (L2 y L3) y Routers & Especializados de ATM y Frame Relay, Switches (L3) y Routers \\ \hline
Tecnologías & Ethernet & MPLS, ATM, Frame Relay y X.25
\end{tabular}
\end{table}
答案1
尝试:
\documentclass{article}
\usepackage{array,makecell}
\usepackage{caption}
\begin{document}
\begin{table}[htb]
\renewcommand\arraystretch{1.5}
% \setcellgapes{5pt}
% \makegapedcells
\caption{Local Area Network vs Wide Area Network.}
\label{tab:lanvswan}
\centering
\begin{tabular}{
>{\centering\arraybackslash}m{3.5cm}% instead of "p" is "m"
|>{\centering\arraybackslash}m{4.5cm}
|>{\centering\arraybackslash}m{4.5cm}
}
\thead{Características} & \thead{LAN} & \thead{WAN} \\ \hline
Extensión Geográfica & Pequeña & Extensa \\ \hline
Dispositivos & Host, Switches (L2 y L3) y Routers & Especializados de ATM y Frame Relay, Switches (L3) y Routers \\ \hline
Tecnologías & Ethernet & MPLS, ATM, Frame Relay y X.25
\end{tabular}
\end{table}
\end{document}
\makegapedcells
与列类型不兼容m{...}
,因此我建议增加间隙单元格\arraystretch
,例如像上面的 MWE 中所使用的那样。