# \tabular multicols noalign

I can not figure out what's wrong. The pdf appears okay anyway

\documentclass[a4paper,12pt]{book}
\usepackage[margin=1.5cm]{geometry}
\usepackage{colortbl}
\usepackage{multicol}
\everymath=\expandafter{\the\everymath\displaystyle}
\renewcommand{\arraystretch}{2.2}

\begin{document}

\begin{tabular}{|m{0.55 \textwidth}|m{0.35 \textwidth}|}
\hline
\multicolumn{2}{|c|}{\rowcolor[gray]{0.8} {oscillations}} \\
\hline
\hline
$T = \frac{1}{f}$ & $T=\frac{\Delta t}{N}$ \\
\hline
\end{tabular}

\end{document}


I take after compiling with xelatex

This is XeTeX, Version 3.1415926-2.2-0.9995.2 (TeX Live 2009/Debian)
entering extended mode
(./test.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, ibycus, monogreek, greek, ancientgreek, loaded.
(/usr/share/texmf-texlive/tex/latex/base/book.cls
Document Class: book 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/bk12.clo))
(/home/karathan/texmf/tex/latex/geometry/geometry.sty
(/usr/share/texmf-texlive/tex/latex/graphics/keyval.sty)
(/usr/share/texmf-texlive/tex/generic/oberdiek/ifpdf.sty)
(/usr/share/texmf-texlive/tex/generic/oberdiek/ifvtex.sty)
(/usr/share/texmf-texlive/tex/generic/ifxetex/ifxetex.sty)
(/usr/share/texmf-texlive/tex/xelatex/xetexconfig/geometry.cfg))
(/usr/share/texmf-texlive/tex/latex/colortbl/colortbl.sty
(/usr/share/texmf-texlive/tex/latex/tools/array.sty)
(/usr/share/texmf-texlive/tex/latex/graphics/color.sty
(/etc/texmf/tex/latex/config/color.cfg)
(/usr/share/texmf-texlive/tex/xelatex/xetex-def/xetex.def)))
(/usr/share/texmf-texlive/tex/latex/tools/multicol.sty) (./test.aux)

**... here is the problem**

*geometry* detected driver: pdftex
! Misplaced \noalign.
\rowcolor ->\noalign
{\ifnum 0=}\fi \global \let \CT@do@color \CT@@do@color...
l.12 ...{|c|}{\rowcolor[gray]{0.8} {oscillations}}
\\
? [1] (./test.aux) )
Output written on test.pdf (1 page).
Transcript written on test.log.


-

Inside \multicolumn is too late for \rowcolor change that to \cellcolor and it should be OK.

-
 it works very well... "...is too late for...." ha when someone tells you the solution to your problem then you say. . . I had to think it :) – karathan Nov 12 '12 at 10:04

Put \rowcolor[gray]{0.8} before \multicolumn{2}{|c|}{oscillations}.

\documentclass[a4paper,12pt]{book}
\usepackage[margin=1.5cm]{geometry}
\usepackage{colortbl}
\usepackage{multicol}
\everymath=\expandafter{\the\everymath\displaystyle}
\renewcommand{\arraystretch}{2.2}
\begin{document}

\begin{tabular}{|m{0.55 \textwidth}|m{0.35 \textwidth}|}
\hline
\rowcolor[gray]{0.8}\multicolumn{2}{|c|}{oscillations} \\
\hline
\hline
$T = \frac{1}{f}$ & $T=\frac{\Delta t}{N}$ \\
\hline
\end{tabular}

\end{document}

-
 does not work well for me. Blackens the first cell of the second row . Do you think there are problems using the TeX Live 2009 – karathan Nov 12 '12 at 9:15 @karathan I wonder why that is. Although I would recommend that you update to TeX Live 2012. Or perhaps download the updated packages. – hpesoj626 Nov 12 '12 at 9:30 I said this because these days I have encountered several problems with packages like xgreeks and libraries like \usetikzlibrary` and reason was the version TexLive 2009 that I use – karathan Nov 12 '12 at 9:37 The behaviour of multicolumn with respect to rowcolor changed at version 1 of the colortbl package which went out with TL 2012 (after some reports on this site that the old behaviour wasn't good) – David Carlisle Nov 12 '12 at 9:54