# Table Errors - Misplaced \noalign, Misplaced \omit, extra alignment tabs

I am very new to latex, and as I'm nearing the end of my first thesis, due to submission in two days I'm placing the results which have finally been extracted after several attempts over the past few weeks into tables. All I'm looking for is simple, clear and clean tables which can span a few pages and don't run off the side of the page.

After all of yesterday looking about how to do this it appears latex doesn't inherently support anything complex with tables, and a dozen different packages need to be used. I'm uploading an error I got from using the sharelatex website (tried other local programs too but this seemed to be the only one that worked without a dozen prompts since its online):

Now I'm using, hopefully without missing anything the following table related packages:

\usepackage{listings}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{ltablex}
\usepackage{makecell}


Listings might be for code snippets, not sure. Either way I needed the following functionality:

• Be able to paste long lists which run over multiple pages. Some people recommended page breaks, but they didn't work. So in the end I ended up trying longtables which didn't work either and now tabularx seemed to work - once. When I added another table it stopped working.
• Due to having multiple columns with long(ish) header names I needed to also wrap the header text together and the following code was supposed to help with that:

code:

\usepackage{ltablex}
\usepackage{makecell}
\newcolumntype{Z}{ >{\centering\arraybackslash}X }
\usepackage[autolanguage, np]{numprint}


I think this defines the type of headers being used and calls it "Z" which is then called again in the tablurax begin properties.

At any rate, all those errors are on the right and they all seem to relate to the tabularx. Unfortunately I have no idea what they mean and clicking them always sends me to the "end tabularx".

I'm guessing something is wrong with the format structure but I'm very new to any of this, extremely tired after many months of working through the nights and problems with the thesis and nearing the very end of the submission (and they insist on no extensions).

I sincerely appreciate any help with this.

• Your error is the most common of FAQs, \label has to be after (or better, inside) \caption. Normally you just get the wrong reference if you put it at the wrong place, but here you break that table completely. But as a general rule it's a bad idea to load multiple clashing packages, I would just use longtable here not tabularx or ltxtable and then use dcolumn or siunitx for decimal alignment. – David Carlisle Jun 8 '16 at 12:34
• @Sveinung: ltablex brings the functionalities of longtable to tabularx. – Bernard Jun 8 '16 at 12:48
• If you load ltablex, needless to load tabularx (nor longtable): the first does it for you. – Bernard Jun 8 '16 at 12:50

As is often the case all errors shown after the first are essentially spurious, the error is

\label{xxx}\caption{..}


which should be

\caption{....\label{..}}


\label always needs to be after the \caption if it is to label the correct value, but in tables it is particularly bad to use this form as you get an error not just the wrong value, as the label code prevents the caption spanning cells, as \multicolumn (used internally here) must always be the first thing in the cell.

I would never use tabularx for numeric data, just use longtable (or tabular for single page tables) and use dcolumn or siuintix packages to specify decimal alignment of the numeric data.