0

I have the following table:

\begin{table}[ht]
\centering
\resizebox{\linewidth}{!}{%
\begin{tabular}{|l|c|c|l|l|l|l|}
\hline
\multirow{2}{*}{\textbf{}} & \multicolumn{6}{c|}{\textbf{Metric}} \\ \cline{2-7} 
 & \multicolumn{3}{c|}{\textbf{SSIM}} & \multicolumn{3}{c|}{\textbf{IoU/F1}} \\ \hline
\textbf{Model} & \multicolumn{1}{l|}{\textbf{Max.}} & \multicolumn{1}{l|}{\textbf{Mean}} & \textbf{Min.} & \textbf{Max.} & \textbf{Mean} & \textbf{Min.} \\ \hline
\textbf{EfficientNetB7} & \textbf{0.956} & \textbf{0.877} & \textbf{0.761} & \textbf{0.988} & \textbf{0.952} & \textbf{0.897} \\ \hline
InceptionV3 & 0.944 & 0.863 & 0.758 & 0.977 & 0.947 & 0.894 \\ \hline
InceptionResNetV2 & 0.941 & 0.859 & 0.743 & 0.983 & 0.943 & 0.886 \\ \hline
DenseNet201 & 0.940 & 0.862 & 0.747 & 0.978 & 0.945 & 0.891 \\ \hline
\end{tabular}
}
\caption{Evaluation of the state-of-the-art models. EfficientNetB7 is proven to be the most suitable model with a high SSIM and IoU score.}
\label{tab:evaluation_models}
\end{table}

which compiles with an error of:

Undefined control sequence

The compiler is having trouble understanding a command you have used. Check that the command is spelled correctly. If the command is part of a package, make sure you have included the package in your preamble using \usepackage{...}.

<recently read> \multirow 
                          
l.509 }
       
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

I was wondering if it is my document or the table that has a problem?

Thanks in advance.

7
  • Do you load the multirow package in your preamble?
    – leandriis
    Jan 10 at 14:08
  • That was the problem yes, thanks, If you add as answer, I'll accept it. Jan 10 at 14:08
  • Is there a reason for using \multirow in this particular table? The upper left cell does not contain any text, so you could basically just omit \multirow{2}{*}{\textbf{}} and get th eexact same output.
    – leandriis
    Jan 10 at 14:10
  • it is unrelated to the error but avoid using \resizebox on tables, it will produce inconsistent font sizes and rule widths compared with the rest of the document. Jan 10 at 14:11
  • Unrelated to the issue, but do not use resizebox on a table as this will lead to inconsistent font sized throughout the document. Your table already fits into the available space without the need of resizing it. If you want to make sure, the table is as wide as the textwidth, you could use tabular* instead.
    – leandriis
    Jan 10 at 14:12
1

The error message you get informs you about \multirow being undefined. Most likely this is the case because you did not load the multirow package.

In this particular case and since this specific column is empty, you can also just omit \multirow{2}{*}{\textbf{}} entirely.

Additionally to the two before mentioned solutions to getting rid of the error message, there are other issues with this table. Using resizebox in order to make sure a table is as wide as the textwidth distorts the font sizes resulting in a bunch of different and inconsistent font sizes throughout your document. Since your table is narrow enough to not overflow into the margins, just omit the whole \resizebox and you will end up with the following compilable example code:

enter image description here

\documentclass{article}


\begin{document}

\begin{table}[ht]
\centering
\begin{tabular}{|l|c|c|l|l|l|l|}
\hline
& \multicolumn{6}{c|}{\textbf{Metric}} \\ \cline{2-7} 
 & \multicolumn{3}{c|}{\textbf{SSIM}} & \multicolumn{3}{c|}{\textbf{IoU/F1}} \\ \hline
\textbf{Model} & \multicolumn{1}{l|}{\textbf{Max.}} & \multicolumn{1}{l|}{\textbf{Mean}} & \textbf{Min.} & \textbf{Max.} & \textbf{Mean} & \textbf{Min.} \\ \hline
\textbf{EfficientNetB7} & \textbf{0.956} & \textbf{0.877} & \textbf{0.761} & \textbf{0.988} & \textbf{0.952} & \textbf{0.897} \\ \hline
InceptionV3 & 0.944 & 0.863 & 0.758 & 0.977 & 0.947 & 0.894 \\ \hline
InceptionResNetV2 & 0.941 & 0.859 & 0.743 & 0.983 & 0.943 & 0.886 \\ \hline
DenseNet201 & 0.940 & 0.862 & 0.747 & 0.978 & 0.945 & 0.891 \\ \hline
\end{tabular}
\caption{Evaluation of the state-of-the-art models. EfficientNetB7 is proven to be the most suitable model with a high SSIM and IoU score.}
\label{tab:evaluation_models}
\end{table}

\end{document}

Personally, I would suggest to use a different approach omitting all vertical and most horizontal lines, replacing the few useful, horizontal lines with the ones from the booktabs package for improved spacing and at the same time getting rid of the \textbf commands. Highlighting all column headers does not really seem to make sense here. In order to align the numbers inside of their cells with respect to the decimal marker, I also used an S column type from the siunitx package. (For this particular table, a simple c column would also work just as well). You can also combine this approach with tabular* is you nevertheless want to make sure the table is as wide as the textwidth while not dirtorting font sizes:

enter image description here

\documentclass{article}

\usepackage{booktabs}
\usepackage{siunitx}

\begin{document}
\begin{table}[ht]
\caption{Evaluation of the state-of-the-art models. EfficientNetB7 is proven to be the most suitable model with a high SSIM and IoU score.}
\label{tab:evaluation_models}
\centering
\begin{tabular}{l*{6}{S[table-format=1.4]}}
\toprule
& \multicolumn{6}{c}{Metric} \\  
\cmidrule{2-7}
 & \multicolumn{3}{c}{SSIM} & \multicolumn{3}{c}{IoU/F1} \\ 
 \cmidrule(r){2-4} \cmidrule(l){5-7}
Model & {Max.} & {Mean} & {Min.} & {Max.} & {Mean} & {Min.} \\
\midrule
EfficientNetB7 & 0.956 & 0.877 & 0.761 & 0.988 & 0.952 & 0.897 \\ 
InceptionV3 & 0.944 & 0.863 & 0.758 & 0.977 & 0.947 & 0.894 \\ 
InceptionResNetV2 & 0.941 & 0.859 & 0.743 & 0.983 & 0.943 & 0.886 \\ 
DenseNet201 & 0.940 & 0.862 & 0.747 & 0.978 & 0.945 & 0.891 \\ 
\bottomrule
\end{tabular}
\end{table}


\begin{table}[ht]
\caption{Evaluation of the state-of-the-art models. EfficientNetB7 is proven to be the most suitable model with a high SSIM and IoU score.}
\label{tab:evaluation_models}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}l*{6}{S[table-format=1.4]}}
\toprule
& \multicolumn{6}{c}{Metric} \\ 
\cmidrule{2-7}
 & \multicolumn{3}{c}{SSIM} & \multicolumn{3}{c}{IoU/F1} \\ 
 \cmidrule(r){2-4}   \cmidrule(l){5-7}
Model & {Max.} & {Mean} & {Min.} & {Max.} & {Mean} & {Min.} \\
\midrule
EfficientNetB7 & 0.956 & 0.877 & 0.761 & 0.988 & 0.952 & 0.897 \\ 
InceptionV3 & 0.944 & 0.863 & 0.758 & 0.977 & 0.947 & 0.894 \\ 
InceptionResNetV2 & 0.941 & 0.859 & 0.743 & 0.983 & 0.943 & 0.886 \\ 
DenseNet201 & 0.940 & 0.862 & 0.747 & 0.978 & 0.945 & 0.891 \\ 
\bottomrule
\end{tabular*}
\end{table}
\end{document}

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.