3

How can I vertically center the content in the cells of the left table (marked 1) so that it looks like the cells of the right table (marked 2):

enter image description here

My code thus far:

\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
    use m{...} option from array package instead of p{...}. – Zarko Sep 25 '16 at 23:34
  • when use m{...} it gives me error :( – Luis Sep 26 '16 at 0:36
  • We need a complete example which generates the error - whichever error it is, which you haven't said, but we need to know that too. – cfr Sep 26 '16 at 1:36
  • Please provide complete examples when you ask questions. Please also consider accepting answers to some of your existing questions. In at least some cases, you've said an answer solved the problem, but you haven't accepted it even when people have put a lot of work into constructing examples from scratch which you didn't provide. – cfr Sep 26 '16 at 1:41
3

Try:

\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 is not compatible with m{...} column type, so instead gaped cells I suggest to increase \arraystretch, for example as it used in above MWE.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.