居中不起作用

居中不起作用

下面的代码没有居中对齐。请帮忙找出解决方案

\begin{table}[!ht]
\begin{tabular}{|c||c|c|c|c|c|} \hline
\centering
AE mode & 512 Byte & 1KB  & 1 MB & 1 GB & 2048 PetaBytes ($2^{64}$) \\ \hline \hline
%IACBC & BC & & & m + 2 & n & n & n & 2 independent random keys are required  \\ \hline
\end{tabular}
}
\end{table}

答案1

您想将tabular本身置于中心。那么您应该将其置于\centering该环境之外(但仍在table环境之内)。顺便说一句,您有一个额外的}

\begin{table}[!ht]
  \centering
  \begin{tabular}{|c||c|c|c|c|c|}
    \hline
    AE mode & 512 Byte & 1KB  & 1 MB & 1 GB & 2048 PetaBytes ($2^{64}$) \\ 
    \hline
    \hline
    %IACBC & BC & & & m + 2 & n & n & n & 2 independent random keys are required  \\
    \hline
  \end{tabular}
\end{table}

相关内容