0

I'm currently struggling with numbering (or rather: not numbering) tables.

Here's what I would like to end up with:

  • unnumbered table without caption
  • preamble and list of tables (that points to correct tables)
  • numbered table starting with Table 1

Without any further meddling, this is my result:

  • unnumbered table without caption
  • preamble and list of tables (LOT starting with Table 2, points to correct table)
  • numbered table starting with Table 2

After searching throught the forums and trying a few things, it looks correct, but doesn't behave like that:

  • unnumbered table without caption
  • preamble and list of table (LOT starting with Table 1)
  • numbered table starting with Table 1

An excerpt of my code:

\begin{document}

Some text here

\begin{tabularx}{\textwidth}{ll}
  1  &  2   \\
  3  &  4   
\end{tabularx}

Some text here

\listoffigures
\newpage
\setcounter{table}{0}

Some text that references \autoref{tab:Contenttable}

\begin{tabularx}{\textwidth}{ll}
  \caption{Table with number}
  5  &  6   \\
  7  &  8   \\
  \label{tab:Contenttable}
\end{tabularx}

\end{document}

This begins the list of tables with "1" and places the correct number (1) above the "Table with number", however all the links (in the list of tables aswell as the \autoref) point to the unnumbered and uncaptioned table before the list of tables.

I've tried to insert the caption-Package and use \caption*, however this does not change the incorrect links.

I really appreciate any help, thanks in advance!

Other packages that might be of note are the following: multirow, array, tabularx, ltablex, caption, hyperref, tocbibind, tocloft. Of course, I will provide any other necessary information if needed.

4
  • Where does the command \autoref from? Oct 21, 2022 at 21:30
  • Do you want your list of tables to also contain the unnumbered table without caption? If so, how would you refer to it? If not, then what is the problem, as that is the normal behaviour. Oct 21, 2022 at 21:39
  • @PietervanOostrum \autoref is part of the hyperref package and automatically adds the prefix of the referenced object (in this case 'table') in front of the number of the referenced object
    – Paul
    Oct 22, 2022 at 10:53
  • @PietervanOostrum No, I don't want the first table in the list of tables. It should start with the second table, which should have the number 1 and be referenced as such. Currently (with the given code snippet), it IS numbered 1 and the reference to the socond table reads 'Table 1: Table with number', but the reference actually points to the first (incorrect) table. That's what I don't really get. I'm aware that I'm trying to force an unusual enumeration, but I've been instructed to do so by my professor.
    – Paul
    Oct 22, 2022 at 11:00

1 Answer 1

1

Actually, your code snippet isn't working at all so you can't get the result that you are claiming. You can't use the \caption command outside of a table environment. And using only a tabularx environment, not embedded in a table environment, just like your first table, will not count it, will not put it in the list of tables, and will not reference it. So the only thing you are missing is the table environment around the second tabularx, and the \caption in the table rather than the tabularx.

\documentclass{article}
\usepackage{tabularx}
\usepackage{hyperref}
\begin{document}

Some text here

\begin{tabularx}{\textwidth}{ll}
  1  &  2   \\
  3  &  4   
\end{tabularx}

Some text here

\listoffigures
\listoftables
\newpage

Some text that references \autoref{tab:Contenttable}

\begin{table}[htbp]
    \caption{Table with number}
  \begin{tabularx}{\textwidth}{ll}
    5  &  6   \\
    7  &  8   \\
    \label{tab:Contenttable}
  \end{tabularx}
\end{table}
\end{document}

enter image description here

enter image description here

You must log in to answer this question.

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