我的栏目中的条目间距相等

我的栏目中的条目间距相等

我正在尝试将一些值收集到表格中,但结果并不如我所愿。这是我的表格

\begin{table}[!h]
\setlength\tabcolsep{0pt} % default: 6pt
\centering
\begin{tabularx}{\textwidth}{@{}c *{4}{C}}
\toprule
  \multicolumn{1}{c}{$w\lambda \in \CO_\lambda$}& \multicolumn{1}{@{}c}{\small$\pm(\lambda_1,\lambda_2)$} & \multicolumn{1}{@{}c}{\small$\pm (-\lambda_1,\lambda_1+\lambda_2)$} & \multicolumn{1}{@{}c}{\small$\pm (\lambda_1+2\lambda_2,-\lambda_2)$} & \multicolumn{1}{@{}c}{\small$\pm(\lambda_1 + 2\lambda_2,-\lambda_1-\lambda_2)$} \\
\midrule
$\sigma^{(0)}(w)$ & $1$ & $1$ & $1$ & $1$ \\[0.5ex]
$\sigma^{(1)}(w)$ & $1$ & $-1$ & $-1$ & $1$ \\[0.5ex]
$\sigma^{(2)}(w)$ & $1$ & $-1$ & $1$ & $-1$ \\[0.5ex]
$\sigma^{(3)}(w)$ & $1$ & $1$ & $-1$ & $-1$ \\
\bottomrule
\end{tabularx}
\vspace{0.1cm}
\caption{Sign weights $\sigma^{(j)}(w)$ of $e^{2 \pi i \inner{w\lambda}{z}}$ for elements in the orbit $\CO_{\lambda=(\lambda_1,\lambda_2)}$ of $C_2$.}
\label{signes de C2}
\end{table}

结果表如下:

在此处输入图片描述

但如您所见,在第一行中,元素的间距不相等,我想知道为什么。我知道如果我更改第一行的间距,它将更改下一行的间距。我的目标是制作一个如下所示的表格:

在此处输入图片描述

答案1

我想您想使用tabular*而不是环境。以下示例中,tabularx两个环境的宽度均设置为。我建议使用列类型(由包提供)来排版四个数字列中的数字。\textwidthSsiunitx

在此处输入图片描述

\documentclass[12pt]{article} % or some other suitable document class
\usepackage[T1]{fontenc}
\usepackage[a4paper,margin=2.5cm]{geometry} % set page parameters suitably
\usepackage{booktabs}
\usepackage{tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}

\usepackage{amssymb}
\newcommand\CO{\mathcal{O}}
\usepackage{mathtools}
\DeclarePairedDelimiter\inner\langle\rangle

\usepackage{siunitx} % for 'S' col. type

\begin{document}

%% table 1 uses a 'tabularx' environment
\begin{table}[!t]
\setlength\tabcolsep{2pt} % default: 6pt
\begin{tabularx}{\textwidth}{@{} c *{4}{C} @{}}
\toprule
  $w\lambda \in \CO_\lambda$ & 
  \small$\pm(\lambda_1,\lambda_2)$ & 
  \small$\pm (-\lambda_1,\lambda_1+\lambda_2)$ & 
  \small$\pm (\lambda_1+2\lambda_2,-\lambda_2)$ & 
  \small$\pm(\lambda_1 + 2\lambda_2,-\lambda_1-\lambda_2)$ \\
\midrule
$\sigma^{(0)}(w)$ & $1$ &  $1$ &  $1$ &  $1$ \\[0.5ex]
$\sigma^{(1)}(w)$ & $1$ & $-1$ & $-1$ &  $1$ \\[0.5ex]
$\sigma^{(2)}(w)$ & $1$ & $-1$ &  $1$ & $-1$ \\[0.5ex]
$\sigma^{(3)}(w)$ & $1$ &  $1$ & $-1$ & $-1$ \\
\bottomrule
\end{tabularx}

\caption{Sign weights $\sigma^{(j)}(w)$ of $e^{2 \pi i 
\inner{w\lambda,z}}$ for elements in the orbit 
$\CO_{\lambda=(\lambda_1,\lambda_2)}$ of $C_2$.}
\label{signes de C2}
\end{table}


%% table 2 uses a 'tabular*' environment
\begin{table}[!h]
\setlength\tabcolsep{0pt} % default: 6pt
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} >{$}c<{$} *{4}{S[table-format=-1.0]}}
\toprule
  w\lambda \in \CO_\lambda & 
  {$\pm(\lambda_1,\lambda_2)$} & 
  {$\pm (-\lambda_1,\lambda_1+\lambda_2)$} & 
  {$\pm (\lambda_1+2\lambda_2,-\lambda_2)$} & 
  {$\pm(\lambda_1 + 2\lambda_2,-\lambda_1-\lambda_2)$} \\
\midrule
\sigma^{(0)}(w) & 1 &  1 &  1 &  1 \\
\sigma^{(1)}(w) & 1 & -1 & -1 &  1 \\
\sigma^{(2)}(w) & 1 & -1 &  1 & -1 \\
\sigma^{(3)}(w) & 1 &  1 & -1 & -1 \\
\bottomrule
\end{tabular*}

\caption{Same table as above, but with \texttt{tabular*} instead of \texttt{tabularx}}
\label{signes de C2 tabularstar}
\end{table}

\end{document}

相关内容