2

I have created a table using tabular, however when I compile my document the table is not present in the list of tables. Do I have to manually append it to the list of tables as I have used tabular instead of table? If so, how do I do this?

  • If your table doesn't have a caption (description), why add it to the list? – Johannes_B Oct 31 '15 at 12:38
  • You can do \captionlistentry[table]{Description} using package caption/ – Johannes_B Oct 31 '15 at 12:42
  • The list of tables actually lists captions. – egreg Oct 31 '15 at 13:48
3

As some have mentioned in the comments, the List of Tables lists captions; if you don't have a caption, it won't know what to list. In any case, it's the \caption command that writes an entry to the lot file, and that's what LaTeX inputs to form the List of Tables when you issue \listoftables.

If you're not using captions, you're probably not loading caption, which means that @Johannes_B's answer won't work for you. What you're really looking for is \addcontentsline:

\addcontentsline{fileextension}{entrytype}{entrytext}

fileextension is whatever list you want to make an entry in; use toc for the table of contents, lof for list of figures, and lot for list of tables. entrytype is what type of entry you're trying to make, which is usually more relevant in a the TOC than the LOT; just use table here. And entrytext is what the list will include; since you don't have a caption, you'll have to make up something appropriate here. An example:

\documentclass{article}
\begin{document}
\listoftables
\addcontentsline{lot}{table}{What is this doing?}
\begin{tabular}{ll}
What & is \\
this & doing? \\
\end{tabular}
\end{document}

This code gets you:

Table in the LOT

Obviously, this is a terrible and useless table; but you can see that it's put into the LOT as expected.

3

The easiest way is to load the caption package and use \captionof{table}{The caption} instead of manually adding \addcontentsline which does neither provide a correct numbering nor a reference label.

enter image description here

\documentclass{article}
\usepackage{caption}
\begin{document}
\listoftables
\clearpage

\begingroup
\centering

\begin{tabular}{ll}
What & is \\
this & doing? \\
\end{tabular}
\captionof{table}{A nice table}\label{tbl:nicetablelesstable}
\endgroup
\end{document}
1

nest your tabular inside a table environment, and add a caption entry. That's it.

The syntax then is: \caption[text that goes to LoT]{text that reads below/above the table}

If you add it by hand as @dgoodmaniii explains, to also have a numbered entry in the LoT add a reference:

...
\addcontentsline{lot}{table}{\ref{tbL:label} What is this doing?}
...

of course, you need to define a \label{tbl:label} somewhere, preferably next to the table (or in the used environment)

  • You should explicitly explain how you define a \label{tbl:label} without using \caption ;-) It is possible, of course – user31729 Mar 11 '18 at 18:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.