4

I am trying to write a table in multirow environment. However, my entries are not aligned properly. Code is pasted below. Screenshot of output is attached. Can somebody help me to solve the problem?Thanks a lot.

\documentclass[sigconf, authordraft]{acmart}

\usepackage{booktabs} % For formal tables
\usepackage{multirow}
%\usepackage{mathptmx}
\usepackage{amsmath} % assumes amsmath package installed
\usepackage{amssymb}  % assumes amsmath package installed
\begin{document}
\begin{table*}
 \caption{Quality Metrics which require reference image}
  \label{tab:table1}
  \begin{tabular}{cccccccccl}

    Sl.No.&Metric&Band&DWT -rule 1&DWT -rule 2&DWT -rule 3&DWT-rule 4&PCA&GIHS&GIHS-Choi  \\  \hline
%    \midrule
   \multirow{4}{*}{1}  &\multirow{4}{*}{Rel Bias}     & Green& DWT-rule1 & DWT-rule2& DWT-rule3 & DWT-rule4& PCA&GIHS&GIHS-Choi \\
                                & Green& DWT-rule1 & DWT-rule2& DWT-rule3 & DWT-rule4& PCA&GIHS&GIHS-Choi \\
                                & Green& DWT-rule1 & DWT-rule2& DWT-rule3 & DWT-rule4& PCA&GIHS&GIHS-Choi \\
                                & Green& DWT-rule1 & DWT-rule2& DWT-rule3 & DWT-rule4& PCA&GIHS&GIHS-Choi \\
   \multirow{4}{*}{2} &\multirow{4}{*}{ Rel VAR}      & Green& DWT-rule1 & DWT-rule2& DWT-rule3 & DWT-rule4& PCA&GIHS&GIHS-Choi \\
                                & Green& DWT-rule1 & DWT-rule2& DWT-rule3 & DWT-rule4& PCA&GIHS&GIHS-Choi \\
                                & Green& DWT-rule1 & DWT-rule2& DWT-rule3 & DWT-rule4& PCA&GIHS&GIHS-Choi \\
                                & Green& DWT-rule1 & DWT-rule2& DWT-rule3 & DWT-rule4& PCA&GIHS&GIHS-Choi \\
    \multirow{4}{*}{3} &\multirow{4}{*}{ Rel SDD}     & Green& DWT-rule1 & DWT-rule2& DWT-rule3 & DWT-rule4& PCA&GIHS&GIHS-Choi\\
                                    & Green& DWT-rule1 & DWT-rule2& DWT-rule3 & DWT-rule4& PCA&GIHS&GIHS-Choi \\
                                & Green& DWT-rule1 & DWT-rule2& DWT-rule3 & DWT-rule4& PCA&GIHS&GIHS-Choi \\
                                & Green& DWT-rule1 & DWT-rule2& DWT-rule3 & DWT-rule4& PCA&GIHS&GIHS-Choi \\

%    \bottomrule
  \end{tabular}
\end{table*}
\end{document}

screenshot of table generated

5

The second row was missing (two & were needed), therefore the contents were incorrectly aligned.

I have added the *in the second argument of the \multirow command and corrected the ending of a table row (\\).

The resulting MWE (note that it is minimal, I have reduced it):

\documentclass[sigconf, authordraft]{acmart}

\usepackage{booktabs}
\usepackage{multirow}

\begin{document}
\begin{table}
\centering
\caption{Quality Metrics which require reference image}
\label{tab:table1}
\begin{tabular}{cccccccccl}
Sl.No. & Metric & Band & DWT -rule 1 & DWT -rule 2 & DWT -rule 3 & DWT-rule 4 & PCA & GIHS & GIHS-Choi  \\
\midrule
\multirow{4}{*}{1} & \multirow{4}{*}{Rel Bias} & Green & DWT-rule1 & DWT-rule2 & DWT-rule3 & DWT-rule4 & PCA & GIHS & GIHS-Choi \\
 & & Green& DWT-rule1 & DWT-rule2& DWT-rule3 & DWT-rule4& PCA&GIHS&GIHS-Choi \\
 & & Green& DWT-rule1 & DWT-rule2& DWT-rule3 & DWT-rule4& PCA&GIHS&GIHS-Choi \\
 & & Green& DWT-rule1 & DWT-rule2& DWT-rule3 & DWT-rule4& PCA&GIHS&GIHS-Choi \\
\bottomrule
\end{tabular}
\end{table}
\end{document}

This results in: enter image description here

4

In addition to inserting missing & symbols in data rows 2-4, 6-8, and 10-12, you may want to rethink the layout of the table. E.g., instead of using \multirow to treat the contents of the first two columns in a special way, simply get rid of the \multirow wrappers and add a bit of vertical whitespace after rows 4 and 8 (via \addlinespace instructions). In addition, in view of the fact that the table takes up almost the full width of the text block, why not "make if official" and employ a tabular* environment that does take up the full available space?

enter image description here

\documentclass[sigconf, authordraft]{acmart}
\usepackage{booktabs} 
\usepackage{amsmath,amssymb}

\begin{document}
\begin{table*}
\setlength\tabcolsep{0pt}
\caption{Quality Metrics which require reference image}
\label{tab:table1}
  \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} *{10}{l} }
%   \toprule
    Sl.No. & Metric & Band & DWT-rule 1 & DWT-rule 2 &
    DWT-rule 3 & DWT-rule 4 & PCA & GIHS & GIHS-Choi \\
  \midrule
   1 & Rel Bias   
   &  Green& DWT-rule1 & DWT-rule2& DWT-rule3 & DWT-rule4& PCA&GIHS&GIHS-Choi \\
   && Green& DWT-rule1 & DWT-rule2& DWT-rule3 & DWT-rule4& PCA&GIHS&GIHS-Choi \\
   && Green& DWT-rule1 & DWT-rule2& DWT-rule3 & DWT-rule4& PCA&GIHS&GIHS-Choi \\
   && Green& DWT-rule1 & DWT-rule2& DWT-rule3 & DWT-rule4& PCA&GIHS&GIHS-Choi \\
   \addlinespace
   2 & Rel VAR 
   &  Green& DWT-rule1 & DWT-rule2& DWT-rule3 & DWT-rule4& PCA&GIHS&GIHS-Choi \\
   && Green& DWT-rule1 & DWT-rule2& DWT-rule3 & DWT-rule4& PCA&GIHS&GIHS-Choi \\
   && Green& DWT-rule1 & DWT-rule2& DWT-rule3 & DWT-rule4& PCA&GIHS&GIHS-Choi \\
   && Green& DWT-rule1 & DWT-rule2& DWT-rule3 & DWT-rule4& PCA&GIHS&GIHS-Choi \\
   \addlinespace
   3 & Rel SDD
   &  Green& DWT-rule1 & DWT-rule2& DWT-rule3 & DWT-rule4& PCA&GIHS&GIHS-Choi\\
   && Green& DWT-rule1 & DWT-rule2& DWT-rule3 & DWT-rule4& PCA&GIHS&GIHS-Choi \\
   && Green& DWT-rule1 & DWT-rule2& DWT-rule3 & DWT-rule4& PCA&GIHS&GIHS-Choi \\
   && Green& DWT-rule1 & DWT-rule2& DWT-rule3 & DWT-rule4& PCA&GIHS&GIHS-Choi \\
%  \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.