排版表格时出现“未定义的控制序列”错误

排版表格时出现“未定义的控制序列”错误

错误是

未定义控制序列。

以下是代码:

\begin{table}[htb!!]
\center
\begin{tabular}{|c|c|c|c|c|c|}
\hline
\multicolumn{2}{|c|}{Experiment} & Initial tip deflection & frequency $\omega$ & base acceleration $a_b$ & Magnet gap $\delta$ \\
\hline
TC 1 &
\begin{tabular}{c}a \\ b\end{tabular} & \begin{tabular}{c} $10^{-3}\ mm$ \\ $5\ mm$\end{tabular} & Uniform $\in [9,14]\ Hz$ & $1\ m/s^2$ & $50\ mm$ \\
\hline
TC 2 &
\begin{tabular}{c}a \\ b\end{tabular} & \begin{tabular}{c} $10^{-3}\ mm$ \\ $5\ mm$\end{tabular} & $11.5 \ Hz$ & Uniform $ \in \left[ 0.5,1.5 \right]\ m\s^2 $ & $50\ mm$\\
\hline
TC 3 &
\begin{tabular}{c}a \\ b\end{tabular} & \begin{tabular}{c} $10^{-3}\ mm$ \\ $5\ mm$\end{tabular} & $11.5\ Hz$ & $1\ m/s^2$ & Uniform $\in [45,55]\ mm$\\
\hline
\multicolumn{2}{|c|}{TC 4} & Uniform $\in [0,5]\ mm$ & Uniform $\in [9,14]\ Hz$ & Uniform $\in [0.5,1.5]\ m/s^2$ & Uniform $\in [45,55]\ mm$ \\
\hline
\end{tabular}
\caption{Uncertain parameters/initial conditions }\label{table_exp}
\end{table}

答案1

! Undefined control sequence.
l.13 ... Uniform $ \in \left[ 0.5,1.5 \right]\ m\s

\s/s

答案2

由于 David 已经回答回答你的问题后,我会允许自己“仅仅”改善一下表格的美观性:

\documentclass{article}

\usepackage[margin = 3.5cm]{geometry}     % avoid `overfull \hbox' warning
\usepackage[tableposition = top]{caption} % captions
\usepackage{booktabs}                     % horizontal lines in tables
\usepackage[per-mode = symbol]{siunitx}   % physical quantities and SI units

% shortcut
\newcommand*\mr[2]{\begin{tabular}{c}#1\\#2\end{tabular}}

\begin{document}

\noindent \textsf{Note:} Let $U[a,b]$ denote the uniform on the closed interval from $a$ to $b$.

\begin{table}[htbp]
\centering
 \caption{Uncertain parameters/initial conditions.}
 \label{table_exp}
  \begin{tabular}{*{6}{c}}
   \toprule
    \multicolumn{2}{c}{Experiment} & Initial tip deflection & Frequency, $\omega$ & Base acceleration, $a_{\textnormal{b}}$ & Magnet gap, $\delta$ \\[0.5ex]
         &                         & \si{\mm}               & \si{\Hz}            & \si{\m\per\square\s} & \si{\mm}             \\
   \midrule
    TC 1 & \mr{a}{b}               & \mr{$10^{-3}$}{$5$}    & $U[9,14]$           & $1$                                     & $50$                 \\
   \midrule
    TC 2 & \mr{a}{b}               & \mr{$10^{-3}$}{$5$}    & $11.5$              & $U[0.5, 1.5]$                           & $50$                 \\
   \midrule
    TC 3 & \mr{a}{b}               & \mr{$10^{-3}$}{$5$}    & $11.5$              & $1$                                     & $U[45, 55]$          \\
   \midrule
    TC 4 &                         & $U[0,5]$               & $U[9,14]$           & $U[0.5, 1.5]$                           & $U[45, 55]$          \\
   \bottomrule
  \end{tabular}
\end{table}

\end{document}

输出

一些建议:

  • 不要在表格中使用垂直线;它们带来的干扰大于帮助。
  • 使用siunitx包来排版表格中的数字和物理单位。
  • 使用booktabs包装以获得更好的厚度——以及水平规则周围的间距。
  • 使用caption包中包含可选项tableposition = top,以在标题和表格之间获得更好的间距。
  • 尽可能使用语法*{<number of columns>}{<column type>}来缩短代码。
  • 构造输入代码使其看起来像输出,以便更好地概述它。

答案3

这是修正后的代码。请注意,需要调整给出错误的行以消除 m\s^2 并包含修正后的 m/s^2 单位。

\begin{table}[htb!!]
\centering
\begin{tabular}{|c|c|c|c|c|c|}
\hline
\multicolumn{2}{|c|}{Experiment} & Initial tip deflection & frequency $\omega$ & 
base acceleration $a_b$ & Magnet gap $\delta$ \\
\hline
TC 1 &
\begin{tabular}{c}a \\ b\end{tabular} & \begin{tabular}{c} $10^{-3}\ mm$ \\ 
$5\ mm$\end{tabular} & Uniform $\in [9,14]\ Hz$ & $1\ m/s^2$ & $50\ mm$ \\
\hline
TC 2 &
\begin{tabular}{c}a \\ b\end{tabular} & \begin{tabular}{c} $10^{-3}\ mm$ \\ 
$5\ mm$\end{tabular} & $11.5 \ Hz$ & Uniform $ \in \left[ 0.5,1.5 \right]\ m/s^2 $ & $50\ mm$\\
\hline
TC 3 &
\begin{tabular}{c}a \\ b\end{tabular} & \begin{tabular}{c} $10^{-3}\ mm$ \\
$5\ mm$\end{tabular} & $11.5\ Hz$ & $1\ m/s^2$ & Uniform $\in [45,55]\ mm$\\
\hline
\multicolumn{2}{|c|}{TC 4} & Uniform $\in [0,5]\ mm$ & Uniform $\in [9,14]\ Hz$ & Uniform 
$\in [0.5,1.5]\ m/s^2$ & Uniform $\in [45,55]\ mm$ \\
\hline
\end{tabular}
\caption{Uncertain parameters/initial conditions }\label{table_exp}
\end{table}

相关内容