3

i am getting error when i am running code of table. Any idea how to solve this problem?

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

List of packages which I am using for overall report writting

\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}

%%%%%%%%%%%%%%%%%%%%% For table and figure list naming:

\newpage \renewcommand{\listfigurename}{List of Figures}

\listoffigures

\newpage \renewcommand{\listtablename}{List of Tables} \listoftables

  • 1
    Start from your comment suggestion: % Please add the following required packages to your document preamble: – koleygr Nov 8 at 13:16
  • 1
    Did you add the multirow package to your preamble? In the code fragment you included, it is commented out. – leandriis Nov 8 at 13:16
  • I have made table on tablesgenerator.com/#. i just posted the code to my report and gort error – maths Nov 8 at 13:18
  • 1
    We need to see complete compilable but small document with your table. Otherwise we can only guess what cause your error. – Zarko Nov 8 at 13:20
  • 2
    that table generator comes up here from time to time but why use it? It makes massively over-complicated tex (you could remove all those \multicolum{{1}{... commands) It would be simpler to write the tex code directly. – David Carlisle Nov 8 at 13:22
0

Nope --could not find any error--had to reduce one column to 8cm to avoid spill over

\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}

enter image description here

6

Something like the following?

enter image description here

Note that I've deliberately dropped all vertical lines and almost all horizontal lines, in order to give the table a more open and inviting look. After all, what purpose is served if the table is so uninviting that none of your readers will spend more than two seconds glancing at it? Input-wise, I've also replaced all instances of {[}Hz{]}} with Hz, and I've switched from a tabular to a tabularx environment. A side effect of these simplifications is that the multitude of utterly pointless \multicolumn{1}{|l|}{} directives can be deleted, making the input much easier to take in -- and check for any errors of content.

\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} 
  • 1
    +1 for better than mine formatting of table -; – Zarko Nov 8 at 14:46
  • LaTeX Warning: No positions in optional float specifier. Default added (so using `tbp') on input line 152. ! LaTeX Error: Environment tabularx undefined. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.153 \begin{tabularx} {\textwidth}{@{} llL @{}} ? – maths Nov 8 at 14:57
  • i dont know why i am getting error – maths Nov 8 at 14:57
  • \usepackage{booktabs, makecell, multirow, tabularx} \usepackage{ragged2e} \usepackage{siunitx} \newcolumntype{L}{>{\RaggedRight\arraybackslash\hangafter=1\hangindent=1em}X} %\usepackage{booktabs} – maths Nov 8 at 15:02
  • when i am running your independently from my report. its workin. when i am installing packages in my main installation file and running my report file. it dont work. getting error ! LaTeX Error: Environment tabularx undefined. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.259 \begin{tabularx} {\textwidth}{@{} llL @{}} ? – maths Nov 8 at 15:23
5

Your table code does not reproduce showed error. However, I would redesign your table to something like this:

enter image description here

IN your table code i would remove all \multicolumn{1}{...}{...} which is only clutter in code. Also I would remove vertical lines (combination of the rules from booktabs package and vertical lines gives ugly result). Text in last columns sre to long that table can be fit in text area. A solution is to use column type which break test into more lines. For this I suggest to use tabularx and X column type. For writing units is intended excellent package siunitx which support their writing according to SI standard:

\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}

enter image description here

Addendum: I test my solution with your document preamble. It gives warnings (not error) that used package scrpage2 should be replaced with scrlayer-scrpage. Doing this and moving the hyperref package to the end of preamble and consider, that in your document you change \baselinestretch, the new version of mine MWE is:

\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}

Compiling it with recent version of the MikTeX I got no errors and four warnings:

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

Warnings not harm result of compilation. Note, this warnings you obtain also without table proposed solution for your table. MWE gives:

enter image description here

  • Thank you very much. I am adding the packages of multirow etc. I am getting the following error: – maths Nov 8 at 13:45
  • scrpage2.sty 52 Package scrpage2 Warning: usage of obsolete package! Package scrpage2' is obsolete. You should not longer use package scrpage2'. You should replace usage of package scrpage2' by scrlayer-scrpage' on input line 52. – maths Nov 8 at 13:46
  • 1
    @maths, as I said. Error is not in your table code, but as you now discover yourself in use of the obsolete package. Replace it with suggested one. Anyway, code for table in my answer is significantly cleanup from clutter in your code. – Zarko Nov 8 at 13:51
  • 1
    @maths - You report that the macro \setcellgapes is undefined. Did you maybe fail to load the makecell package? – Mico Nov 8 at 14:38
  • 1
    +1 for the use of \SIrange. :-) – Mico Nov 8 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.