我想要创建下表:
\documentclass{article}
\usepackage{units}
\begin{document}
\begin{table*}[t]
\small
\begin{tabular}{ |l|c|c|c|c|c|c|c|c|c|c| }
\hline
\multicolumn{1}{|p{0.9in}}{ }&
\multicolumn{10}{|c|}{Factor level}\\
\hline
\multicolumn{1}{|p{0.9in}}{Output} &
\multicolumn{1}{|p{0.35in}}{ABS-UTS} &
\multicolumn{1}{|p{0.35in}}{ABS-THETA MIN} &
\multicolumn{1}{|p{0.35in}}{ABS-THETA MAX} &
\multicolumn{1}{|p{0.35in}}{ABS-Sa MIN} &
\multicolumn{1}{|p{0.35in}}{ABS-Sa max} &
\multicolumn{1}{|p{0.35in}}{PLA-UTS} &
\multicolumn{1}{|p{0.35in}}{PLA-THETA MIN} &
\multicolumn{1}{|p{0.35in}}{PLA-THETA MAX} &
\multicolumn{1}{|p{0.35in}}{PLA-Sa MIN}&
\multicolumn{1}{|p{0.35in}|}{PLA-Sa max}\\
\hline
Nozzle temperature ($ ^{\circ} $ C) & 3 & 1 & 2 & 2 & 1 & 2 & 3 & 1 & 1 & 3 \\
\hline
Deposition speed (\( \frac{\textrm{mm}}{\textrm{s}} \)) &
3 & 1 & 3 & 2 & 3 & 1 & 1 & 2 & 2 & 1 \\
\hline
Layer heigh (mm) &
3 & 1 & 3 & 3 & 3 & 3 & 2 & 1 & 1 & 2 \\
\hline
\end{tabular}
\caption{Configurations for single lap experimental investigation}
\label{tab:results}
\paperwidth
\end{table*}
\end{document}
为什么 .tex 文件仍在编译时会出现这些错误:
./paper.tex:317: Missing number, treated as zero.
<to be read again>
\par
l.317 \end{table*}
./paper.tex:317: Illegal unit of measure (pt inserted).
<to be read again>
\par
l.317 \end{table*}
另外,是否可以增加第四行的高度?
谢谢。
答案1
对我来说,重写表代码片段比搜索错误更简单。它们可能隐藏在多余的使用中\multicolumn{1}{p{<length>}}{...}
(为什么不以这种方式定义列类型?),或者隐藏在环境\paperwidth
末尾的虚假内容中等。table
对于您的桌子我会:
- 使用
tabularx
表环境 - 删除所有垂直线
- 对于水平线,请使用
booktabs
包中定义的规则 - 对于具有
min
、max
值的列,使公共列听到
\documentclass{article}
\usepackage{geometry}
\usepackage{siunitx}
\usepackage{booktabs, makecell, multirow, tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\usepackage{xparse}
\NewExpandableDocumentCommand\mcc{O{1}m}
{\multicolumn{#1}{c}{#2}}
\begin{document}
\begin{table}[ht]
\small
\setcellgapes{1pt}
\makegapedcells
\renewcommand\multirowsetup{\centering}
\begin{tabularx}{\linewidth}{ @{} l *{10}{C} @{} }
\toprule
& \mcc[10]{Factor level} \\
\cmidrule{2-11}
Output & \multirow{2.8}{=}{ABS-UTS}
& \mcc[2]{ABS-THETA}
& \mcc[2]{ABS-Sa}
& \multirow{2.8}{=}{PLA-UTS}
& \mcc[2]{PLA-THETA}
& \mcc[2]{PLA-Sa} \\
\cmidrule(l){3-4}\cmidrule(l){5-6}\cmidrule(l){8-9}\cmidrule(l){10-11}
& & min & max & min & max & & min & max & min & max \\
\midrule
Nozzle temperature (\si{celsius})
& 3 & 1 & 2 & 2 & 1 & 2 & 3 & 1 & 1 & 3 \\
Deposition speed (\si{mm\per\second})
& 3 & 1 & 3 & 2 & 3 & 1 & 1 & 2 & 2 & 1 \\
Layer heigh (\si{\milli\metre})
& 3 & 1 & 3 & 3 & 3 & 3 & 2 & 1 & 1 & 2 \\
\bottomrule
\end{tabularx}
\caption{Configurations for single lap experimental investigation}
\label{tab:results}
\end{table}
\end{document}