0

I would like to use multiple row package to create a table but I have an error that says "Missing number, treated as zeros". It would be really appreciated if anyone help me on this. Thanks

\begin{table}
\begin{minipage}{1.0\textwidth}
\textwidth
\begin{tabular}{lllll}
\hline\noalign{\smallskip}
~~~~~Pairs & type & similarity \% & size value & size \\
\noalign{\smallskip}\hline\noalign{\smallskip}
\multirow{2}{*}{G1 vs G2}
 & A1  &~~~~10\% & ~~~~~~~0.198&~~Large\\
 & A2  &~~~~20\% & ~~~~~~~0.697&~~Medium\\\hline
\multirow{2}{*}{G1 vs G3}
 & A1  &~~~~35\% & ~~~~~~~0.674&~~Medium\\
 & A2  &~~~~78\% & ~~~~~~~0.196&~~small\\\hline
\multirow{2}{*}{G2 vs G3}
 & A1  &~~~~91\% & ~~~~~~~0.397&~~Small\\
 & A2  &~~~~16\% & ~~~~~~~0.326&~~Medium\\\hline
\end{tabular}

\end{minipage}%
\hfill
\end{table}

2 Answers 2

1

Welcome to TeX.SE!

  • In question please always provide complete small self contained document, called MWE (Minimal Working Document) which can be compiled as it is and which reproduce your problem, not just code fragment
  • error in your code is cause with spurious \textwidth after tabular declaration
  • your code fragment is very unusual, what is your intend to achieve with it?
  • see, if the following MWE with clean up table's code gives what you looking for:
\documentclass{article}

\usepackage{booktabs, makecell, multirow}  % <---

\begin{document}
    \begin{table}
    \centering
\begin{tabular}{ccc cl}          % <---
    \toprule                      % <---
Pairs
    & type
            & similarity \%
                    & size value
                            & size      \\
    \midrule                     % <---
\multirow{2}{*}{G1 vs G2}
    & A1    & 10    & 0.198 & Large     \\
    & A2    & 20    & 0.697 & Medium    \\ 
   \midrule
\multirow{2}{*}{G1 vs G3}
    & A1    & 35    & 0.674 & Medium    \\
    & A2    & 78    & 0.196 & small     \\ 
    \midrule
\multirow{2}{*}{G2 vs G3}
    & A1    & 91    & 0.397 & Small     \\
    & A2    & 16    & 0.326 & Medium    \\ 
    \bottomrule
\end{tabular}
    \end{table}
\end{document}
  • with % <--- are marked main changes in comparison to your code fragment
  • used are rules defined in booktabs` package˛, using it you get small additional vertical space around it

enter image description here

Edit: Thanks to @Bernard I realize, that I didn't provide last (correct) code and table image in the my answer. Now is corrected and improved.

3
  • Column heads are in footnote size, probably because of the typo in \renewcommand {\thead}{\normalsize}.
    – Bernard
    Sep 26, 2020 at 18:15
  • @Bernard, thank you very much. I was a little bit superficial at uploading my answer.
    – Zarko
    Sep 26, 2020 at 19:17
  • It happens to all of us (I'm a very good example…).
    – Bernard
    Sep 26, 2020 at 19:19
0

enter image description here

\begin{table}
    \begin{minipage}{1.0\textwidth}
%       \textwidth
        \begin{tabular}{lllll}
            \hline\noalign{\smallskip}
            ~~~~~Pairs & type & similarity \% & size value & size \\
            \noalign{\smallskip}\hline\noalign{\smallskip}
            \multirow{2}{*}{G1 vs G2}
            & A1  &~~~~10\% & ~~~~~~~0.198&~~Large\\
            & A2  &~~~~20\% & ~~~~~~~0.697&~~Medium\\\hline
            \multirow{2}{*}{G1 vs G3}
            & A1  &~~~~35\% & ~~~~~~~0.674&~~Medium\\
            & A2  &~~~~78\% & ~~~~~~~0.196&~~small\\\hline
            \multirow{2}{*}{G2 vs G3}
            & A1  &~~~~91\% & ~~~~~~~0.397&~~Small\\
            & A2  &~~~~16\% & ~~~~~~~0.326&~~Medium\\\hline
        \end{tabular}
        
    \end{minipage}%
    \hfill
\end{table}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .