1

I am constantly getting the error "Misplaced \noalign" at the end of my tabularx. I already read a lot about it online for example that you need to put \\ before \hline. I did this but i am still getting this error. I hope someone can help me out with this.

enter image description here

\begin{table}[!ht]
\newcolumntype{a}{>{\columncolor{LightGrey}}X}
\caption{caption}
\begin{tabularx}{\textwidth}{a|c|c|c|c|c|c|c|c|c|c|c|c|  }
    \rowcolor{White}
    & 
    \rowcolor{Blue}
    \textbf{\ref{F:1}} & \textbf{\ref{F:2}} & \textbf{\ref{F:3}} & \textbf{\ref{F:5}} & \textbf{\ref{F:6}} & \textbf{\ref{F:7}} & \textbf{\ref{F:8}} & \textbf{\ref{F:9}} & \textbf{\ref{F:10}} & \textbf{\ref{F:13}} \\ \hline
    \textbf{availablity} & \checkmark & o & x & x & x & x & x & x & x & x \\ \hline
\end{tabularx}
\begin{center}
\boldcheckmark = explicitly advertised, \checkmark = available, X = unavailable, O = non-identifiable
\end{center}
\end{table}

enter image description here

4
  • 1
    You can only use the \rowcolor command in the frst cell of a row.
    – leandriis
    Feb 15, 2020 at 10:39
  • 1
    You might therefore want to replace \rowcolor{White} & \rowcolor{Blue} with \rowcolor{Blue}\cellcolor{white} & .
    – leandriis
    Feb 15, 2020 at 10:40
  • How or where is \boldcheckmark defined?
    – Mico
    Feb 15, 2020 at 11:33
  • 2
    Please always post full (but minimal) examples, but sniplets. Then the code is easier for others to test and we do not end up making assumptions about your document that might not be correct
    – daleif
    Feb 15, 2020 at 11:47

2 Answers 2

3

Like this?

enter image description here

  • \columncolor is intended for coloring of columns
  • \rowcolor can be only at beginning of a row, not in the middle;
  • \rowcolor over-rides columncolor
  • \cellcolor is intended for coloring one cell, it over-rides \rowcolor and column color
\documentclass{article}

\usepackage[table, svgnames]{xcolor}
\usepackage{tabularx}
\usepackage{pifont}
\providecommand*{\checkmark}{\ding{51}}
\providecommand*{\boldcheckmark}{\textbf{\checkmark}}

\begin{document}
\begin{table}[!ht]
\setlength\extrarowheight{2pt}
\caption{caption}
\begin{tabularx}{\textwidth}{c | *{10}{>{\centering\arraybackslash}X|} }
\rowcolor{cyan!30}
\cellcolor{white}    
    & \textbf{\ref{F:1}} & \textbf{\ref{F:2}} & \textbf{\ref{F:3}} & \textbf{\ref{F:5}} 
    & \textbf{\ref{F:6}} & \textbf{\ref{F:7}} & \textbf{\ref{F:8}} & \textbf{\ref{F:9}} & \textbf{\ref{F:10}}& \textbf{\ref{F:13}} \\ \hline
\cellcolor{LightGrey}{availablity} & \checkmark & o & x & x & x & x & x & x & x & x \\ \hline
\end{tabularx}
\begin{center}
\boldcheckmark = explicitly advertised, \checkmark = available, x = unavailable, o = non-identifiable
\end{center}
\end{table}
\end{document}
1

Or like this? This solution assumes that both \rowcolor instructions should really be \cellcolor instructions.

enter image description here

Observe that I've deliberately omitted all vertical and horizontal rules, as they don't provide anything but visual clutter.

\documentclass{article}
\usepackage[table,svgnames]{xcolor}
\usepackage{tabularx,amssymb,bm}
\newcolumntype{a}{>{\columncolor{LightGrey}}X}
\providecommand\boldcheckmark{\bm{\checkmark}} 
\usepackage[skip=0.333\baselineskip]{caption} % optional

\begin{document}
\begin{table}[!ht]
\setlength\tabcolsep{5pt} % default: 6pt
\setlength\extrarowheight{2pt} % for a less-cramped "look"

\caption{caption}
\begin{tabularx}{\textwidth}{ a *{10}{c} @{}}
\cellcolor{White} &   % <-- was "\rowcolor{White}
\cellcolor{LightBlue} % <-- was "\rowcolor{Blue}"
\ref{F:1} & \ref{F:2} & \ref{F:3} & \ref{F:5}  & \ref{F:6} & 
\ref{F:7} & \ref{F:8} & \ref{F:9} & \ref{F:10} & \ref{F:13} \\ 
Availablity & \checkmark & o & x & x & x & x & x & x & x & x \\ 
\end{tabularx}

\medskip
\boldcheckmark = explicitly advertised, \checkmark = available, 
    x = unavailable, o = non-identifiable.
\end{table}
\end{document}
4
  • yes you are absolutely right! Thank you very much. This error was caused by me using \rowcolor twice. Feb 15, 2020 at 11:51
  • @JanKreischer - Glad this answer was useful. :-) Just out of idle curiosity: How is \boldcheckmark defined in your document, and how is ZurichBlue defined?
    – Mico
    Feb 15, 2020 at 11:53
  • 1
    \definecolor{ZurichBlue}{rgb}{0.0, 0.4, 0.8} Feb 15, 2020 at 14:05
  • 1
    This is how boldcheckmark is defined: \newcommand*{\boldcheckmark}{ \textpdfrender{ TextRenderingMode=FillStroke, LineWidth=.5pt, }{\checkmark} } Feb 15, 2020 at 14:09

You must log in to answer this question.

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