我遇到了多列问题。我有一张大表,当我使用以下命令时,出现以下错误:
Misplaced \omit. \multispan ->\omit \@multispan l.468 \end{tabular}}
我已经报告了以下唯一一行,如果我删除它\multicolumn{1}{l}{\textbf{ADCS}}
并用 \textbf{ADCS}
所有内容替换它,它就会起作用。
我还有其他与此格式相同的行,它们没有给我任何错误(比如下面的那个\multicolumn{1}{l}{\textbf{Payload}} & & & \textbf{5} & \textbf{20} & \textbf{1} & \textbf{6} \\
)
你知道它为什么会这样吗?
\begin{table}[h!]
\resizebox{\textwidth}{!}{%
\centering \begin{tabular}{r c c c c c r}
\midrule
\multicolumn{1}{l}{\textbf{ADCS}} & & & \textbf{2.278} & \textbf{5} &
\textbf{0.114} & \textbf{2.392} \\
\midrule
\midrule
\multicolumn{1}{l}{\textbf{Payload}} & & & \textbf{5} & \textbf{20} & \textbf{1} & \textbf{6} \\
\midrule
\end{tabular}}
\caption{\label{tab:list_equipment} List of equipment}
\end{table}
前言:
% ==================== DOCUMENT CLASS ==================== %
\documentclass[a4paper,11pt]{report}
% ==================== PACKAGES ==================== %
\usepackage[portrait]{geometry}
\usepackage[myheadings]{fullpage}
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage{gensymb}
\usepackage{titlesec}
\usepackage{fancyhdr}
\usepackage[page,header]{appendix}
\usepackage{lastpage}
\usepackage{changepage}
\usepackage{nccmath}
\usepackage{amsmath,amssymb}
\usepackage{numprint}
\usepackage{graphicx, wrapfig}
\usepackage{tikz}
\usepackage{subfig}
\usepackage{wrapfig}
\usepackage{lipsum}
\usepackage{longtable}
\usepackage{hyperref}
\usepackage{color}
\usepackage[font=small, labelfont=bf]{caption}
\usepackage{fourier}
\usepackage[protrusion=true, expansion=true]{microtype}
\usepackage[english]{babel}
\usepackage{sectsty}
\usepackage{url, lipsum}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{multirow}
答案1
目前尚不清楚用户165329是真正的答案,或者实际上是问题的一部分。无论如何,这个表格可以以更好的方式格式化(当然符合我的口味):
\documentclass[a4paper,11pt]{report}
\usepackage{booktabs, makecell}
\renewcommand\theadfont{\bfseries\footnotesize}
\renewcommand\theadgape{}
\newcommand{\mcl}[1]{\multicolumn{1}{l}{\textbf{#1}}}
\usepackage{siunitx}
\usepackage{etoolbox}
\newrobustcmd{\B}{\bfseries}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\begin{document}
\begin{table}[htb]
\small
\sisetup{detect-weight}
\setlength\tabcolsep{0pt}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}
r
S[table-format=2.0]
*{2}{S[table-format=1.4]}
S[table-format=1.3]
S[table-format=1.5]
S[table-format=1.3]
}
\toprule
\thead{FUNCTIONAL\\ SUBSYSTEM}
& {\thead{\#}}
& {\thead{Mass {[kg]}\\ per unit}}
& {\thead{Total\\ Mass {[kg]}}}
& {\thead{Margin\\ {[\%]}}}
& {\thead{Margin\\ {[kg]}}}
& {\thead{Mass {[kg]}\\ with Margin}} \\
\midrule
\mcl{Payload} & & & \B & \B 2 & \B 1 & \B 6 \\
\midrule
Detector & 5 & 1 & 5 & 20 & 1 & 6 \\
\midrule
\textbf{ADCS} & & & \B 2.278 & \B 5 & \B 0.114 & \B 2.392 \\
\midrule
Reaction Wheel & 4 & 0.24 & 0.96 & 5 & 0.048 & 1.008 \\
Fine Sun Sensor & 2 & 0.0037 & 0.0074 & 5 & 0.0004 & 0.008 \\
Coarse Sun Sensor & 10 & 0.01 & 0.1 & 5 & 0.005 & 0.105 \\
Magnetometer & 2 & 0.1 & 0.2 & 5 & 0.01 & 0.210 \\
Magnetic Torquer & 3 & 0.3 & 0.9 & 5 & 0.045 & 0.945 \\
GPS & 2 & 0.0003 & 0.0006 & 5 & 0.00003 & 0.001 \\
IMU & 2 & 0.055 & 0.11 & 5 & 0.0055 & 0.116 \\
\midrule \mcl{Communication} & & & \B 0.856 & \B 5 & \B 0.043 & \B 0.899 \\
\midrule
Patch Antenna & 2 & 0.08 & 0.16 & 5 & 0.008 & 0.168 \\
Eyestar Antenna & 2 & 0.143 & 0.286 & 5 & 0.0143 & 0.300 \\
Transciever & 1 & 0.42 & 0.42 & 5 & 0.021 & 0.441 \\
\midrule
\mcl{Propulsion} & & & \B 2.480 & \B 6.613 & \B 0.164 & \B 2.644 \\
\midrule
20N Thruster & 1 & 0.65 & 0.65 & 5 & 0.0325 & 0.683 \\
Tank & 1 & 1.3 & 1.3 & 5 & 0.065 & 1.365 \\
Feeding Lines & / & 0.2 & 0.2 & 25 & 0.05 & 0.250 \\
Pyrotechnical Valve & 1 & 0.15 & 0.15 & 5 & 0.00075 & 0.158 \\
Fill \& Drain Valve & 2 & 0.09 & 0.18 & 5 & 0.009 & 0.189 \\
\midrule
\mcl{OBDH} & & & & & & \\
\midrule
\mcl{Structure} & & & & & & \\
\midrule
\mcl{Thermal Control} & & & & & & \\
\mcl{EPS} & & & & & & \\
\mcl{Harness} & & & & & & \\
\midrule
Propellant & & & & & & \\
Pressurizer & & & & & & \\
\midrule
\mcl{Grand Total} & & & & \textbf{kg} & & \\
\bottomrule
\end{tabular*}
\caption{ List of equipment}
\label{tab:list_equipment}
\end{table}
\end{document}
答案2
嗯。你的序言中没有极简主义。也不是一个真正可行的例子。一个MWE
看起来像
\documentclass[12pt]{article}
\usepackage[a4paper]{geometry}
\usepackage{booktabs,tabularx,multirow}
\begin{document}
\begin{tabular}{r c c c c c r}
\toprule
\multicolumn{1}{l}{\textbf{ADCS}} & & & \textbf{2.278} & \textbf{5} & \textbf{0.114} & \textbf{2.392} \\
\midrule
\multicolumn{1}{l}{\textbf{Payload}} & & & \textbf{5} & \textbf{20} & \textbf{1} & \textbf{6} \\
\bottomrule
\end{tabular}
\end{document}
编译成功。