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 }
\renewcommand\theadfont{\bfseries}
%\renewcommand\theadalign{cc}
\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.
\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.ltablex
brings the functionalities oflongtable
totabularx
.ltablex
, needless to loadtabularx
(norlongtable
): the first does it for you.