我想创建表但出现以下问题:
问题是线路不够长。
代码:
\begin{table}[htp]
\caption{Gross errors found using plausible value check for ambient temperature in Nodes [25-28-29-31-32] }
\label{tab:gr}
\centering
\footnotesize\setlength{\tabcolsep}{2.5pt}
\begin{tabular}{l@{\hspace{6pt}} *{22}{c}}
\toprule
\bfseries Type & \multicolumn{22}{c}{\bfseries Node name} \\
\cmidrule(l){3-23}
& 25 & 28 & 29 & 31 & 32 \\
\midrule
\bfseries A
& 20276 & 20302 & 20267 & 20263 & 20257 \\
\bfseries B
& 1376 & 1321 & 83 & 1329 & 1502 \\
\bfseries C
& 0 & 0 & 0 & 0 & 0 \\
\bottomrule
\addlinespace
\multicolumn{23}{l}{A: Total number of observations}\\
\multicolumn{23}{l}{B: Number of faults}
\multicolumn{23}{l}{C: Number of faults in 2007-09-29}
\end{tabular}
\end{table}
答案1
修复错误并调整列数后,它可以正常工作。
- 使用了六列(现实世界的情况可能有 23 列)。
\cmidrule
已调整为2-6
。\\
之后缺失\multicolumn{...}{l}{B: ...}
。6
在\multicolum
图例中使用。
完整示例:
\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{table}[htp]
\centering
\caption{Gross errors found using plausible value check for ambient temperature in Nodes [25-28-29-31-32]}
\label{tab:gr}
\footnotesize
\setlength{\tabcolsep}{2.5pt}%
\begin{tabular}{l@{\hspace{6pt}} *{5}{c}}
\toprule
\bfseries Type & \multicolumn{5}{c}{\bfseries Node name} \\
\cmidrule(l){2-6}
& 25 & 28 & 29 & 31 & 32 \\
\midrule
\bfseries A
& 20276 & 20302 & 20267 & 20263 & 20257 \\
\bfseries B
& 1376 & 1321 & 83 & 1329 & 1502 \\
\bfseries C
& 0 & 0 & 0 & 0 & 0 \\
\bottomrule
\addlinespace
\multicolumn{6}{l}{A: Total number of observations}\\
\multicolumn{6}{l}{B: Number of faults}\\
\multicolumn{6}{l}{C: Number of faults in 2007-09-29}
\end{tabular}
\end{table}
\end{document}
答案2
\begin{table}[htp]
\caption{Gross errors found using plausible value check for ambient temperature in Nodes [25-28-29-31-32] }
\label{tab:gr}
\centering
\footnotesize\setlength{\tabcolsep}{2.5pt}
\begin{tabular}{l@{\hspace{6pt}} *{5}{c}}
\toprule
\bfseries Type & \multicolumn{5}{c}{\bfseries Node name} \\
\cmidrule(l){3-5}
& 25 & 28 & 29 & 31 & 32 \\
\midrule
\bfseries A
& 20276 & 20302 & 20267 & 20263 & 20257 \\
\bfseries B
& 1376 & 1321 & 83 & 1329 & 1502 \\
\bfseries C
& 0 & 0 & 0 & 0 & 0 \\
\bottomrule
\addlinespace
\multicolumn{23}{l}{A: Total number of observations}\\
\multicolumn{23}{l}{B: Number of faults}
\multicolumn{23}{l}{C: Number of faults in 2007-09-29}
\end{tabular}
\end{table}