如何使表格单元格的值以乳胶为中心?

bha*_*has 3 latex

请告诉我如何使此表中的值显示在中心.

\begin{table}[h]
    \begin{center}
\caption{Mobile IP throughput statistics}
        \begin{tabular}{ | p{2.5cm} | p{2.5cm} | p{2.5cm} | }
            \hline Speed (km/hr) & Max (packets/sec)  & Sample mean (packets/sec) \\
            \hline 20 & 261.67 &  209.05\\
                           \hline 70 & 262.5 &  207.91\\
                           \hline 80 & 259.58 &  209.03\\ 
                           \hline 90 & 260.75 &  209.47\\
                           \hline 100 & 260.33 &  209.3\\
                            \hline 120 & 262.42 &  210.4\\
                            \hline 160 & 259.08 &  210.29\\                                 
            \hline
        \end{tabular}

        \label{table:table3}
    \end{center}
\end{table}
Run Code Online (Sandbox Code Playgroud)

谢谢

aio*_*obe 5

这是一种方式.但它可能不是"正确"的方式:

\begin{tabular}{ | p{2.5cm} | p{2.5cm} | p{2.5cm} | }
  \hline \centering  Speed (km/hr) & Max (packets/sec) & Sample mean (packets/sec) \\
  \hline \centering  20 & \centering 261.67 & 209.05 \\
  \hline \centering  70 & \centering 262.5  & 207.91 \\
  \hline \centering  80 & \centering 259.58 & 209.03 \\ 
  \hline \centering  90 & \centering 260.75 & 209.47 \\
  \hline \centering 100 & \centering 260.33 & 209.3  \\
  \hline \centering 120 & \centering 262.42 & 210.4  \\
  \hline \centering 160 & \centering 259.08 & 210.29 \\                                 
  \hline
\end{tabular}
Run Code Online (Sandbox Code Playgroud)


Mar*_*iak 5

要让它更短一些,您还可以执行以下操作:

在你的头脑\usepackage{array}中,在你的\begin{tabular}表达中写下以下内容:

\begin{tabular}{ | >{\centering}p{2.5cm} | >{\centering}p{2.5cm} | >{\centering}p{2.5cm} | }
Run Code Online (Sandbox Code Playgroud)

不过,现在您必须使用\tabularnewline而不是\\声明新行。如果列的宽度不重要,您也可以使用

\begin{tabular}{ |c|c|c| }
Run Code Online (Sandbox Code Playgroud)

无需任何进一步的更改。