我该如何修改下面粘贴的代码?
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
\begin{table*}[h!]
\centering
\caption{Example}
\label{tab:example}
\begin{tabular}{|M{0.1\linewidth} M{0.15\linewidth} M{0.2\linewidth} M{0.25\linewidth} M{0.2\linewidth}|}
\hline \\
A & B & C & D & E \\ \hline
1 & 2 & 3 & 4 & 5\\ \hline
6 & 7 & 8 & 9 & 10 \\ \hline
\end{tabular}
\end{table*}
答案1
您的问题已通过评论解决,但您可能会发现以下建议(主要是主题)很有用......
通过使用tabularray
包代码,您的表可以是:
\documentclass[twocolumn]{article}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\begin{document}
\begin{table*}
\caption{Example with horizontal lines in table body}
\label{tab:example-1}
\begin{tblr}{hlines, vline{1,Z}={solid},
colspec = { *{2}{X[0.15, c,m]} X[0.2, c,m] X[0.25, c,m] X[0.2, c,m] },žđ
rowsep=5pt
}
A & B & C & D & E \\
1 & 2 & 3 & 4 & 5 \\
6 & 7 & 8 & 9 & 10 \\
\end{tblr}
\end{table*}
\begin{table*}[ht]
\caption{Example with horizontal lines in table body}
\label{tab:example-2}
\begin{tblr}{colspec = { *{2}{X[0.15, c,m]} X[0.2, c,m] X[0.25, c,m] X[0.2, c,m] },žđ
rowsep=5pt
}
\toprule
A & B & C & D & E \\
\midrule
1 & 2 & 3 & 4 & 5 \\
6 & 7 & 8 & 9 & 10 \\
\bottomrule
\end{tblr}
\end{table*}
\end{document}