0

Working in overleaf, I get the error Misplaced \noalign but I can't seem to figure out why. Here's my code

        \begin{table}[H]
            \centering
            \begin{tabular}{|c|c|c|} \cline{2-3} 
                \multicolumn{1}{c|}{}   & \rowcolor{Gray} SEL0  & SEL1  \\ \hline
                \cellcolor{Gray} UART   & OFF                   & OFF   \\ \hline
                \cellcolor{Gray} SPI    & OFF                   & ON    \\ \hline
                \cellcolor{Gray} I2C    & ON                    & ON    \\ \hline
            \end{tabular}
            \caption{Communication module selection PN532 Breakout Board}
            \label{table:comModulePn532}
        \end{table}

The error comes from the line \multicolumn{1}{c|}{} & \rowcolor{Gray} SEL0 & SEL1 \\ \hline

5
  • 3
    Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. Jun 25, 2019 at 15:02
  • 1
    Assuming that 1) you are using the colortbl package and 2) my memory is correct, the macro \rowcolor must be used at the start of a row.
    – campa
    Jun 25, 2019 at 15:12
  • 2
    ...indeed. From the colortbl documentation (section 4 The \rowcolor command): "It must be used at the start of a row."
    – Werner
    Jun 25, 2019 at 15:21
  • Closely related (possible duplicate): Misplaced noalign after rowcolor in multicolumn
    – leandriis
    Jun 25, 2019 at 18:29
  • Thank you guys, it was a duplicate. I simply replaced \rowcolor with \cellcolor on the specific cells I wanted to color and it worked. And @StefanPinnow I will make sure to include those the next time I post something on here. Jun 25, 2019 at 19:20

0

Browse other questions tagged .