调整表格宽度,内容居中。
begin{table*}[ht!]
centering
caption{Embedding Capacity and Extraction Error Rates under Various Text Distortions}
label{tab:embedding_extraction}
resizebox{textwidth}{!}{%
begin{tabularx}{textwidth}{|X|X|X|X|X|X|X|X|}
toprule
multirow{2}{}{textbf{Dataset}} & multirow{2}{}{textbf{Embedding Capacity (bits)}} & multicolumn{6}{c|}{textbf{Extraction Error (%)}} \ cline{3-8}
& & \begin{tabular}[c]{@{}c@{}}\textbf{Addition and Deletion} \\ \textbf{of Punctuation Marks}\end{tabular} & \begin{tabular}[c]{@{}c@{}}\textbf{Addition and Deletion} \\ \textbf{of Stop Words}\end{tabular} & \textbf{Synonym Replacement} & \textbf{Random Word Insertion} & \begin{tabular}[c]{@{}c@{}}\textbf{Character Deletion} \\ \textbf{and Swapping}\end{tabular} & \textbf{Word Order Reversal} \\ \midrule
textbf{AG News} & 30,000 & 0 & 0 & 0 & 0 & 2.92 & 0.260 \ midrule
textbf{Dbpedia} & 90,000 & 0 & 0 & 0 & 1.27 & 0.376 & 0.460 \ bottomrule
end{tabularx}%
}
end{table*}
MWE不规范,预期效果图也没有,甚至还要手动帮你调整代码,还要run
一下之后再理解你的"调整宽度和行高。内容居中"是什么意思,对回答者极不友好。
代码请用代码块包裹,你这个问题必须需要提供符合你排版的文章layout
要求的具体情况的代码才好调整具体样式和大小。
不然我在我的电脑画的表格和尺寸大小,放到你的所谓"模板"里面还是会很不好看,你还得接着提问。
提供一份基于tabularray
的解答
\documentclass[a4paper,landscape]{article}
\usepackage[margin=.5in]{geometry}
\usepackage{lipsum}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\begin{document}
\begin{tblr}{
vlines,cells={valign=m},
colspec = {*{2}{Q[2cm,c]}*{6}{Q[3cm,c]}},
row{1,2}={font=\bfseries\small},
column{1}={font=\bfseries\small},
abovesep=0pt, belowsep=2pt, rowsep=2pt,
}
\toprule
\SetCell[r=2]{m} Dataset & \SetCell[r=2]{m} Embedding Capacity (bits) & \SetCell[c=6]{m} Extraction Error (\%) \\
\midrule
& & Addition and Deletion of Punctuation Marks & Addition and Deletion of Stop Words & Synonym Replacement & Random Word Insertion & Character Deletion and Swapping & Word Order Reversal \\
\midrule
AG News & 30,000 & 0 & 0 & 0 & 0 & 2.92 & 0.26 \\
\midrule
Dbpedia & 90,000 & 0 & 0 & 0 & 1.27 & -- & -- \\
\bottomrule
\end{tblr}
\end{document}
MWE定义