表未定义的控制序列

表未定义的控制序列

我在运行表格代码时遇到错误。有办法解决这个问题吗?

161 Undefined control sequence. l.161 \multirow
               {4}{*}{active interaction} & 1-2 {[}Hz{]} & The maximum bandw...

我用于编写整体报告的软件包列表

\documentclass[12pt,listof=totoc,bibliography=totoc,numbers=noenddot]{scrartcl} 
\usepackage{lmodern}
\parindent0pt
\usepackage[a4paper, left=3cm, right=2cm, top=2.5cm, bottom=2cm]{geometry} 
\renewcommand{\baselinestretch}{1.20}\normalsize 

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc} 
\usepackage[ngerman,english]{babel}
\usepackage{textcomp} 

\usepackage[intlimits]{amsmath}  
\usepackage{mathrsfs,amssymb}
\usepackage{icomma} 
\usepackage{mathtools}
\usepackage{theorem}
\numberwithin{equation}{section} 
\usepackage{commath} 
\usepackage{bm} 

\usepackage[svgnames]{xcolor}
\definecolor{dunkelblau}{rgb}{0,0,0.5} 
\definecolor{americanrose}{rgb}{1.0, 0.01, 0.24}
\definecolor{babyblue}{rgb}{0.54, 0.81, 0.94}
\definecolor{mygreen}{rgb}{0,0.6,0}
\definecolor{mygray}{rgb}{0.5,0.5,0.5}
\definecolor{mymauve}{rgb}{0.58,0,0.82}
\definecolor{cerulean}{rgb}{0.0, 0.48, 0.65}

\numberwithin{figure}{section} 

\usepackage{subfig}
\usepackage{graphicx} 

\usepackage[automark]{scrpage2} %
\pagestyle{scrheadings}
\clearscrheadfoot
\ihead[]{\headmark}
\ohead[]{\pagemark} 
\cfoot[\pagemark]{}
\setheadsepline{0.4pt} 
\setlength{\headheight}{1 cm}
\setlength{\footskip}{1 cm}
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%extra added for table
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
% Please add the following required packages to your document preamble:
\usepackage{booktabs,tabularx,ragged2e}
\usepackage[colorlinks=false,plainpages=false,pdfpagelabels]{hyperref} 

\usepackage{pdfpages} 

\usepackage{listings} 

\usepackage{bibgerm} 
\usepackage{leftidx}

\renewcommand{\lstlistingname}{Quellcode} 

\numberwithin{table}{section} 

\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}
\DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf}
\DeclareOldFontCommand{\tt}{\normalfont\ttfamily}{\mathtt}
\DeclareOldFontCommand{\bf}{\normalfont\bfseries}{\mathbf}
\DeclareOldFontCommand{\it}{\normalfont\itshape}{\mathit}
\DeclareOldFontCommand{\sl}{\normalfont\slshape}{\@nomath\sl}
\DeclareOldFontCommand{\sc}{\normalfont\scshape}{\@nomath\sc}
\DeclareRobustCommand*\cal{\@fontswitch\relax\mathcal}
\DeclareRobustCommand*\mit{\@fontswitch\relax\mathnormal}

%%%%%%%%%%%%%%%%%%%%%%%%% 对于表格和图形列表命名:

\newpage \renewcommand{\listfigurename}{图片列表}

\图列表

\newpage \renewcommand{\listtablename}{表格列表} \listoftables

答案1

不,没有发现任何错误,必须将一列缩小到 8 厘米以避免溢出

\documentclass{report}
\usepackage[inline]{enumitem}
\usepackage{calc}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{ragged2e}
\usepackage{xcolor}
\usepackage{multirow}
\begin{document}

\begin{table}[]
\begin{tabular}{@{}lll@{}}
U                                                          & Frequee                             & Descn                                         \\ \midrule
\multicolumn{1}{|l|}{\multirow{4}{*}{interaction}}  & \multicolumn{1}{l|}{1-2 {[}Hz{]}}   & \multicolumn{1}{p{8cm}|}{The maximum bandwidth with which the human finger can react to unexpected force/ position signals}                      \\ \cmidrule(l){2-3} 

\multicolumn{1}{|l|}{}                                     & \multicolumn{1}{l|}{5-10 {[}Hz{]}}  & \multicolumn{1}{l|}{vvvv}                      \\ \cmidrule(l){2-3} 
\multicolumn{1}{|l|}{}                                     & \multicolumn{1}{l|}{8-10 {[}Hz{]}}  & \multicolumn{1}{l|}{vvvv}                       \\ \cmidrule(l){2-3} 
\multicolumn{1}{|l|}{}                                     & \multicolumn{1}{l|}{8-12 {[}Hz{]}}  & \multicolumn{1}{l|}{vvces}                       \\ \midrule
\multicolumn{1}{|l|}{section}                              & \multicolumn{1}{l|}{12-16 {[}Hz{]}} & \multicolumn{1}{l|}{The  cannot correct ps}      \\ \midrule
\multicolumn{1}{|l|}{\multirow{3}{*}{interaction}} & \multicolumn{1}{l|}{20-30 {[}Hz{]}} & \multicolumn{1}{l|}{The which the human finger demans taperception} \\ \cmidrule(l){2-3} 
\multicolumn{1}{|l|}{}                                     & \multicolumn{1}{l|}{320 {[}Hz{]}}   & \multicolumn{1}{l|}{The yond which the human fingers cannot discrimins}                         \\ \cmidrule(l){2-3} 
\multicolumn{1}{|l|}{}                                     & \multicolumn{1}{l|}{5-10 {[}kHz{]}} & \multicolumn{1}{l|}{The human finger needs to sense vibratitive tasks}                  \\ \bottomrule
\end{tabular}
\end{table}
\end{document}

在此处输入图片描述

答案2

类似下面这样的吗?

在此处输入图片描述

请注意,我故意删除了所有垂直线和几乎所有水平线,以便使表格看起来更加开放和吸引人。毕竟,如果表格如此不吸引人,以至于没有读者会花超过两秒钟的时间浏览它,那还有什么用呢?在输入方面,我还将所有实例替换为{[}Hz{]}}Hz并将环境从 a 切换tabular到 a tabularx。这些简化的一个副作用是\multicolumn{1}{|l|}{}可以删除大量毫无意义的指令,使输入更容易接受——并检查是否有任何错误内容

\documentclass{report}
\usepackage{booktabs,tabularx,ragged2e}
\newcolumntype{L}{>{\RaggedRight\arraybackslash\hangafter=1\hangindent=1em}X}
\begin{document}

\begin{table}[]
\begin{tabularx}{\textwidth}{@{} llL @{}}
\toprule
U  & Frequee & Descn \\ 
\midrule
interaction & 1--2 Hz & The maximum bandwidth with which the human finger can react to unexpected force\slash position signals \\
            & 5--10 Hz & vvvv  \\
            & 8--10 Hz & vvvv  \\
            & 8--12 Hz & vvces \\ 
\addlinespace
section     & 12--16 Hz & The cannot correct ps \\ 
\addlinespace
interaction & 20--30 Hz & The which the human finger demans taperception \\
            & 320 Hz    & The yond which the human fingers cannot discrimins \\ 
            & 5--10 kHz & The human finger needs to sense vibratitive tasks \\ 
\bottomrule
\end{tabularx}
\end{table}
\end{document} 

答案3

您的表格代码无法重现显示的错误。不过,我会将您的表格重新设计成如下形式:

在此处输入图片描述

在您的表格代码中,我会删除所有\multicolumn{1}{...}{...}只会使代码混乱的内容。此外,我还会删除垂直线(booktabs包中的规则和垂直线的组合会产生丑陋的结果)。最后一列中的文本太长,表格无法放入文本区域。一种解决方案是使用将测试分成更多行的列类型。为此,我建议使用列类型。对于书写单位,旨在支持根据 SI 标准书写的优秀tabularx包:Xsiunitx

\documentclass{article}
\usepackage{booktabs, makecell, multirow, tabularx}
\setcellgapes{3pt}
\usepackage{siunitx}

\begin{document}
    \begin{table}[ht]
    \setlength\tabcolsep{4pt}
    \makegapedcells
\begin{tabularx}{\linewidth}{@{} ll>{\raggedright\arraybackslash}X@{} }
    \toprule
U   & Frequee   & Descn                     \\ 
    \midrule
\multirow{8}{*}{interaction}    
    &   \SIrange{1}{2}{\hertz}
        &   The maximum bandwidth with which the human finger can react to unexpected force/position signals              \\ 
%    \cmidrule(l){2-3}
    & \SIrange{5}{10}{\hertz}   &   vvvv    \\ 
%    \cmidrule(l){2-3}
    & \SIrange{8}{10}{\hertz}   &   vvvv    \\
%    \cmidrule(l){2-3}
    & \SIrange{8}{10}{\hertz}   &  vvces    \\ 
    \midrule
section
    & \SIrange{12}{16}{\hertz}  &   The  cannot correct ps  \\ 
    \midrule
\multirow{5}{*}{interaction} 
    & \SIrange{12}{30}{\hertz}  &  The which the human finger demans taperception \\ %    \cmidrule(l){2-3}
    & \SI{320}{\hertz}          &  The yond which the human fingers cannot discrimins\\
%    \cmidrule(l){2-3}
    & \SIrange{5}{10}{\hertz}   &  The human finger needs to sense vibratitive tasks\\ \bottomrule
\end{tabularx}
    \end{table}
\end{document}

在此处输入图片描述

附录: 我使用文档前言测试了我的解决方案。它给出警告(不是错误),指出scrpage2应将使用的包替换为scrlayer-scrpage。执行此操作并将hyperref包移至前言末尾,并考虑在您更改的文档中\baselinestretch,我的 MWE 的新版本是:

\documentclass[12pt,listof=totoc,bibliography=totoc,numbers=noenddot]{scrartcl}
\usepackage{lmodern}
\parindent0pt
\usepackage[a4paper, left=3cm, right=2cm, top=2.5cm, bottom=2cm]{geometry}
\renewcommand{\baselinestretch}{1.20}\normalsize

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman,english]{babel}
\usepackage{textcomp}

%\usepackage[intlimits]{amsmath}
\usepackage[intlimits]{mathtools}
\usepackage{mathrsfs,amssymb}
\usepackage{icomma}
\usepackage{theorem}
\numberwithin{equation}{section}
\usepackage{commath}
\usepackage{bm}

\usepackage[svgnames]{xcolor}
\definecolor{dunkelblau}{rgb}{0,0,0.5}
\definecolor{americanrose}{rgb}{1.0, 0.01, 0.24}
\definecolor{babyblue}{rgb}{0.54, 0.81, 0.94}
\definecolor{mygreen}{rgb}{0,0.6,0}
\definecolor{mygray}{rgb}{0.5,0.5,0.5}
\definecolor{mymauve}{rgb}{0.58,0,0.82}
\definecolor{cerulean}{rgb}{0.0, 0.48, 0.65}

\numberwithin{figure}{section}

\usepackage{subfig}
\usepackage{graphicx}

%%%%\usepackage[automark]{scrpage2} % THIS PACKAGE IS OBSOLETE
\usepackage{scrlayer-scrpage}       % REPLACEMENT FOR THE OBSOLETE "scrpage2" PACKAGE
\pagestyle{scrheadings}
\clearscrheadfoot
\ihead[]{\headmark}
\ohead[]{\pagemark}
\cfoot[\pagemark]{}
\setheadsepline{0.4pt}
\setlength{\headheight}{1 cm}
\setlength{\footskip}{1 cm}
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%extra added for table
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
% Please add the following required packages to your document preamble:

\usepackage{pdfpages}

\usepackage{listings}

\usepackage{bibgerm}
\usepackage{leftidx}

\renewcommand{\lstlistingname}{Quellcode}

\numberwithin{table}{section}

\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}
\DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf}
\DeclareOldFontCommand{\tt}{\normalfont\ttfamily}{\mathtt}
\DeclareOldFontCommand{\bf}{\normalfont\bfseries}{\mathbf}
\DeclareOldFontCommand{\it}{\normalfont\itshape}{\mathit}
\DeclareOldFontCommand{\sl}{\normalfont\slshape}{\@nomath\sl}
\DeclareOldFontCommand{\sc}{\normalfont\scshape}{\@nomath\sc}
\DeclareRobustCommand*\cal{\@fontswitch\relax\mathcal}
\DeclareRobustCommand*\mit{\@fontswitch\relax\mathnormal}

\usepackage{ragged2e}
\usepackage{booktabs, makecell, multirow, tabularx}
\setcellgapes{3pt} % due to 
\usepackage{siunitx}
\usepackage[colorlinks=false,plainpages=false,pdfpagelabels]{hyperref}

\begin{document}
    \begin{table}[ht]
    \setlength\tabcolsep{4pt}
%%%%    \makegapedcells % not needed
\begin{tabularx}{\linewidth}{@{} ll>{\raggedright\arraybackslash}X@{} }
    \toprule
U   & Frequee   & Descn                     \\
    \midrule
\multirow{5}{*}{interaction}
    &   \SIrange{1}{2}{\hertz}
        &   The maximum bandwidth with which the human finger can react to unexpected force/position signals              \\
%    \cmidrule(l){2-3}
    & \SIrange{5}{10}{\hertz}   &   vvvv    \\
%    \cmidrule(l){2-3}
    & \SIrange{8}{10}{\hertz}   &   vvvv    \\
%    \cmidrule(l){2-3}
    & \SIrange{8}{10}{\hertz}   &  vvces    \\
    \midrule
section
    & \SIrange{12}{16}{\hertz}  &   The  cannot correct ps  \\
    \midrule
\multirow{3}{*}{interaction}
    & \SIrange{12}{30}{\hertz}  &  The which the human finger demans taperception \\ %    \cmidrule(l){2-3}
    & \SI{320}{\hertz}          &  The bond which the human fingers cannot discrimins\\
%    \cmidrule(l){2-3}
    & \SIrange{5}{10}{\hertz}   &  The human finger needs to sense vibratitive tasks\\ 
    \bottomrule
\end{tabularx}
    \end{table}
\end{document}

使用最新版本的 MikTeX 进行编译时没有出现任何错误,但出现了四个警告:

  • LaTeX Warning: Command \InputIfFileExists has changed.
  • Package scrlayer-scrpage Warning: Command deprecated!
  • Package scrbase Warning: \ifpdftex was redefined
  • Package scrbase Warning: \ifVTeX was redefined

警告不会损害编译结果。请注意,即使没有针对您的表提出的解决方案,您也会收到此警告。MWE 给出:

在此处输入图片描述

相关内容