Having problems with \longtable and \multicolumn

I'm trying to put a header in a table generated with a \longtable environment, but \multicolumn gives @multispan error. Here is my piece of code:

\documentclass[a4paper,11pt]{article}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{colortbl}
\usepackage[table]{xcolor}
\usepackage{siunitx}
\usepackage{tabu}
\usepackage{enumerate}
\usepackage{tabularx}

\begin{document}

\begin{longtabu} to \linewidth { | X[6,l] | X[1,c] | }
\toprule
\rowcolor{gray!20}
\multicolumn{2}{|l|}
{\sc 4 -- program} &
\\\midrule
\hiderowcolors
%%%%%%%%%%%%%%%%%%%%%%
A &
06
\\\midrule
%%%%%%%%%%%%%%%%%%%%%%
\bottomrule
\end{longtabu}

\end{document}

I need it to be a long table at the first moment because I am sure that the table is longer than one page. I've already tried others packages (tabularx, longtable, etc) with no success.

Maybe someone would help me to find the error?

latexpdflatexlongtable

Answers

comments powered by Disqus