我如何像这样将每个对应元素居中对齐?
另外,如果第二行是,(y_1+z1 & y_2 & y_3 & y_4 & y_5 & y_6 & y_7+y_3)
您是否认为对齐括号看起来更好,或者像那样对齐括号很奇怪?
\documentclass[journal]{IEEEtran}
\usepackage{booktabs,capt-of}
\usepackage{blindtext}
\begin{document}
\blindtext[1]
\begin{table}[!t]
\centering
\caption{A table}
\label{tab:lable}
\begin{tabular}{cc}
\toprule
\textbf{No}& \textbf{Example} \\ \midrule
1 & $(x_1, x_2, x_3, x_1, x_5, x_6, x_7)$ \\\midrule
2 & $(y_1, y_2, y_3, y_4, y_5, y_6, y_7)$ \\\midrule
3 & $(z_1,z_2,-z_8-z_3,z_2,z_5,-z_1-z_4,z_1)$ \\ \bottomrule
\end{tabular}
\end{table}
\end{document}
答案1
您可以使用一个具有十列的数组。
\documentclass[journal]{IEEEtran}
\usepackage{booktabs}
\begin{document}
\begin{table}[!t]
\centering
\caption{A table}
\label{tab:lable}
$\setlength{\arraycolsep}{1pt}
\begin{array}{cc@{}ccccccc @{}c }
\toprule
\textbf{No} & \multicolumn{9}{c}{\textbf{Example}} \\
\midrule
1 & ( & x_1, & x_2, & x_3, & x_1, & x_5, & x_6, & x_7 & ) \\
\midrule
2 & ( & y_1, & y_2, & y_3, & y_4, & y_5, & y_6, & y_7 & ) \\
\midrule
3 & ( & z_1, & z_2, &-z_8-z_3, & z_2, & z_5, &-z_1-z_4, & z_1 & ) \\
\bottomrule
\end{array}$
\end{table}
\end{document}
没有多余的规则,但有一些垂直空间:
$\setlength{\arraycolsep}{1pt}
\begin{array}{cc@{}ccccccc @{}c }
\toprule
\textbf{No} & \multicolumn{9}{c}{\textbf{Example}} \\
\midrule
1 & ( & x_1, & x_2, & x_3, & x_1, & x_5, & x_6, & x_7 & ) \\
\addlinespace
2 & ( & y_1, & y_2, & y_3, & y_4, & y_5, & y_6, & y_7 & ) \\
\addlinespace
3 & ( & z_1, & z_2, &-z_8-z_3, & z_2, & z_5, &-z_1-z_4, & z_1 & ) \\
\bottomrule
\end{array}$