当我对表格使用多列时,合并列的标题仅占据一列,而不是合并列的总数。有没有办法对此进行排序?以下是 MWE -
\documentclass[10pt]{beamer}
\usetheme{Boadilla}
\usecolortheme{dove}
\setbeamertemplate{itemize items}[default]
\setbeamertemplate{enumerate items}[default]
\setbeamertemplate{itemize/enumerate subbody begin}{\tiny}
\usepackage{color}
\usepackage{physics}
\usepackage{amsmath}
\usepackage{enumitem}
\usepackage{chngcntr}
\usepackage{caption}
\usepackage[export]{adjustbox}
\usepackage{mdwmath}
\usepackage{mdwtab}
\usepackage{tabularx,booktabs}
\newcolumntype{C}{>{\centering\arraybackslash}X} % centered version of "X" type
\setlength{\extrarowheight}{1pt}
\usepackage{subfig}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{array}
\usepackage{fixltx2e}
\usepackage{circuitikz}
\usepackage{gensymb}
\usepackage{adjustbox}
\title{my slides}
\author{}
\date{5/2/2022}
\begin{document}
\maketitle
\begingroup
\scriptsize
\begin{frame}
\begin{table}[htbp]
\centering
\caption{Sample Resistance data from $ 1mg/ml $ of CNT solution}
\resizebox{!}{.4\paperheight}{
\begin{tabularx}{1.15\textwidth}{CCCCCCCC}
\toprule
& & \multicolumn{3}{C}{Sample on cellulose filter} & \multicolumn{3}{C}{Sample on Wafer} \\
%\midrule
Sample & Thickness ($ \mu m $) & Resistance ($\Omega$) & Sheet resistance ($ \Omega $) & Resistivity ($ \Omega\: cm $) & Resistance ($ \Omega $) & Sheet resistance ($ \Omega $) & Resistivity ($ \Omega\: cm $) \\
\midrule
\multirow{3}[0]{*}{10 ml} & \multirow{4}[0]{*}{7.07} & 8.42037 & 38.14444 & \multirow{4}[0]{*}{0.033292836} & 11.16161 & 50.5659 & \multirow{4}[0]{*}{0.035330583} \\
& & 9.03046 & 40.90815 & & 11.08799 & 50.22873 & \\
& & 8.73346 & 39.56346 & & 10.84388 & 49.12298 & \\
Average & & 8.728096667 & 39.53868333 & & 11.03116 & 49.97253667 & \\
\midrule
\multirow{6}[0]{*}{20 ml} & \multirow{7}[0]{*}{12.905} & 8.69023 & 39.36688 & \multirow{7}[0]{*}{0.034299208} & \multirow{2}[0]{*}{5.62617} & \multirow{2}[0]{*}{25.48672} & \multirow{7}[0]{*}{0.032975463} \\
& & 8.62305 & 39.06262 & & & & \\
& & 8.46726 & 38.3569 & & \multirow{2}[0]{*}{5.70038} & \multirow{2}[0]{*}{25.82339} & \\
& & 8.69199 & 39.37495 & & & & \\
& & 8.89965 & 40.31551 & & \multirow{2}[0]{*}{5.59538} & \multirow{2}[0]{*}{25.3473} & \\
& & 8.90406 & 40.33552 & & & & \\
Average & & 8.712706667 & 39.46873 & & 8.593513333 & 25.55247 & \\
\midrule
& & & & \multirow{5}[0]{*}{0.01052849} & & & \\
\multirow{3}[0]{*}{30 ml} & \multirow{4}[0]{*}{25.005} & 5.11619 & 21.81757 & & 2.93069 & 13.27621 & \multirow{4}[0]{*}{0.032756433} \\
& & 4.59474 & 20.80073 & & 2.79338 & 12.65416 & \\
& & 4.76615 & 21.59088 & & 2.95128 & 13.36949 & \\
Average & & 4.825693333 & 21.40306 & & 2.891783333 & 13.09995333 & \\
\bottomrule
\end{tabularx}%
}
\label{table1}%
\end{table}%
\end{frame}
\begin{frame}
% Table generated by Excel2LaTeX from sheet 'Sheet1'
\begin{table}[htbp]
\centering
\caption{Sample Resistance data from $ 0.5mg/ml $ of CNT solution}
\resizebox{\textwidth}{!}{
\begin{tabularx}{1.63\textwidth}{*{11}{C}}
\toprule
& \multicolumn{4}{C}{
At the wafer} & \multicolumn{2}{C}{After baking at 400C in glovebox} & \multicolumn{4}{C}{On cellulose filter}\\
Sample & Resistance ($\Omega$) & Sheet resistance ($\Omega$) & Thickness ($ \mu m $) & Resistivity ($ \Omega \: cm $) & Sheet resistance ($\Omega$) & Resistivity ($ \Omega\:cm $) & Resistance ($\Omega$) & Sheet resistance ($\Omega$) & Thickness ($ \mu m $) & Resistivity ($ \Omega\: cm $) \\
\midrule
10 ml & 8.6347 & 39.1154 & 11.3 & \multirow{4}[0]{*}{0.045361063} & 32 & \multirow{5}[0]{*}{0.0387} & \multirow{2}[0]{*}{16.55097} & \multirow{2}[0]{*}{74.97601} & \multirow{2}[0]{*}{11.3} & \multirow{10}[0]{*}{0.083748478} \\
& 8.8625 & 40.1469 & 10.5 & & 34 & & & & & \\
& 8.7009 & 39.4149 & 12.6 & & 34 & & & & & \\
Average & 8.7327 & 39.55906667 & 11.46666667 & & 35 & & \multirow{2}[0]{*}{16.04057} & \multirow{2}[0]{*}{72.663889} & \multirow{2}[0]{*}{10.5} & \\
& & & & Average & 33.75 & & & & & \\
& & & & & & & & & & \\
& 26.2074 & 118.7196 & 3.2 & \multirow{4}[0]{*}{0.058517203} & & & \multirow{2}[0]{*}{15.77689} & \multirow{2}[0]{*}{71.46949} & \multirow{2}[0]{*}{12.6} & \\
& 23.751 & 107.5919 & 4.1 & & & & & & & \\
& 25.6407 & 116.1524 & 4.1 & & & & & & & \\
Average & 15.78998571 & 71.52859524 & 8.180952381 & & & & 16.12281 & 73.036463 & 11.46666667 & \\
\midrule
20 ml & 13.1859 & 59.732 & 7.2 & \multirow{4}[0]{*}{0.043931432} & 42 & \multirow{5}[0]{*}{0.032745} & 7.62057 & 34.52141 & 7.2 & \multirow{4}[0]{*}{0.024851521} \\
& 13.2219 & 59.8952 & 7.5 & & 45 & & 7.35304 & 33.29376 & 7.5 & \\
& 12.908 & 58.4732 & 7.5 & & 46 & & 7.27021 & 32.93424 & 7.5 & \\
Average & 13.10526667 & 59.3668 & 7.4 & & 44 & & 7.414606667 & 33.58313667 & 7.4 & \\
& & & & Average & 44.25 & & & & & \\
\bottomrule
\end{tabularx}%
}
\label{table2}%
\end{table}%
\end{frame}
\end{document}
答案1
- 在下面的 MWE 中仅考虑与写表相关的包。
- 对于表格,添加了
tabularray
和siunitx
包(由加载\UseTblrLibrary
)。使用它们,表格和可以很好地适合框架,而无需使用\resizebox
框。因此可以规定字体大小footnotesize
- 我建议对数字进行四舍五入,以便每列都有相同的小数位(这样表格就变得更加一致)
- MWE 仅考虑第一个表,第二个表您可以按照相同的方式自己编辑/进行练习/):
\documentclass[10pt]{beamer}
\usetheme{Boadilla}
\usecolortheme{dove}
\setbeamertemplate{caption}[numbered]
\setbeamertemplate{itemize items}[default]
\setbeamertemplate{enumerate items}[default]
\setbeamertemplate{itemize/enumerate subbody begin}{\tiny}
\usepackage{tabularray}
\UseTblrLibrary{booktabs,siunitx}
\sisetup{per-mode=symbol}
\begin{document}
\begin{frame}
\begin{table}[htbp]
\footnotesize
\caption{Sample Resistance data from \qty{1}{\milli\gram\per\milli\litre} of CNT solution}
\sisetup{round-mode=places,
round-precision=5}
\label{table1}
\begin{tblr}{ colsep = 2pt,
colspec = {@{} Q[l, si={table-format=2,
round-precision=0}]
X[c,m, si={table-format=2.3,
round-precision=3}]
*{2}{X[c,m, si={table-format=2.5}]}
X[c,m, si={table-format=1.5}]
*{2}{X[c,m, si={table-format=2.5}]}
X[c,m, si={table-format=1.5}]
@{}},
rowsep=1pt
}
\toprule
& & \SetCell[c=3]{c} {{{Sample on cellulose filter}}}
& & & \SetCell[c=3]{c} {{{Sample on Wafer}}} \\
\cmidrule[r]{3-5}\cmidrule[l]{6-8}
{{{Sample}}}
& {{{Thickness (\unit{\micro\metre})}}}
& {{{Resistance (\unit{\ohm})}}}
& {{{Sheet resistance (\unit{\ohm})}}}
& {{{Resistivity (\unit{\ohm\centi\metre})}}}
& {{{Resistance (\unit{\ohm})}}}
& {{{Sheet resistance (\unit{\ohm})}}}
& {{{Resistivity (\unit{\ohm\centi\metre})}}} \\
\midrule
\SetCell[r=3]{l} \qty{10}{\milli\litre}
& \SetCell[r=4]{l} 7.07
& 8.42037
& 38.14444
& \SetCell[r=4]{c} 0.033292836
& \SetCell[r=4]{c} 11.16161
& 50.5659
& \SetCell[r=4]{c} 0.035330583 \\
& & 9.03046
& 40.90815
& & 11.08799
& 50.22873
& \\
& & 8.73346
& 39.56346
& & 10.84388
& 49.12298
& \\
{{{Average}}}
& & 8.728096667
& 39.53868333
& & 11.03116
& 49.97253667
& \\
\midrule
\SetCell[r=6]{l} \qty{20}{\milli\litre}
&\SetCell[r=7]{l} 12.905
& 8.69023
& 39.36688
& \SetCell[r=7]{l} 0.034299208
& \SetCell[r=2]{l} 5.62617
& \SetCell[r=2]{l} 25.48672
& \SetCell[r=7]{l} 0.032975463 \\
& & 8.62305
& 39.06262
& & & & \\
& & 8.46726
& 38.3569
& & \SetCell[r=2]{l} 5.70038
& \SetCell[r=2]{l} 25.82339
& \\
& & 8.69199
& 39.37495
& & & & \\
& & 8.89965
& 40.31551
& & \SetCell[r=2]{l} 5.59538
& \SetCell[r=2]{l} 25.3473
& \\
& & 8.90406
& 40.33552
& & & & \\
{{{Average}}}
& & 8.712706667
& 39.46873
& & 8.593513333
& 25.55247
& \\
\midrule
\SetCell[r=3]{l} \qty{30}{\milli\litre}
& \SetCell[r=4]{c} 25.005
& 5.11619
& 21.81757
& \SetCell[r=4]{c} 0.01052849
& 2.93069
& 13.27621
& \SetCell[r=4]{c} 0.032756433 \\
& & 4.59474
& 20.80073
& & 2.79338
& 12.65416
& \\
& & 4.76615
& 21.59088
& & 2.95128
& 13.36949
& \\
{{{Average}}}
& & 4.825693333
& 21.40306
& & 2.891783333
& 13.09995333
& \\
\bottomrule
\end{tblr}
\end{table}
\end{frame}
\end{document}