Graphics, Figures & Tableswrong table numbering in a chapter

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
carol
Posts: 105
Joined: Wed Dec 24, 2008 7:25 pm

wrong table numbering in a chapter

Post by carol »

What is the maximum number of tables to be used in a chapter in a latex file? I have a document splitted in different tex file and in one of the chapters (splitted into different latex files), I have about perhaps 25 tables. The table numbering is correct until the table 10 (10.10). Then, from the 11th table, the numbering continues on even number 10.12, 10.14 etc until 10.44. From the table 10.45, the normal numbering starts 10.45, 10.46 till 10.50 (last table). Why does this happen?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: wrong table numbering in a chapter

Post by localghost »

Without the critical parts of the code that is hard to say. Perhaps the counter is increased. But at this point my crystal ball becomes fuzzy.


Best regards
Thorsten¹
carol
Posts: 105
Joined: Wed Dec 24, 2008 7:25 pm

Re: wrong table numbering in a chapter

Post by carol »

I extracted the first table after which the numbering problem starts. When I compile this table, the table number is 2 instead of 1. Does it come from the usage of tabularx in table?
--------------------------------
\documentclass[12pt,a4paper,openright]{book}
\usepackage[includeheadfoot,margin=3cm]{geometry}
\usepackage{booktabs,caption, float,tabularx,ltablex}
\begin{document}
\pagestyle{headings}
%\begin{table}[!ht]

\begin{table}
{\scriptsize
\begin{tabularx}{\linewidth}{ccccccccp{.8cm}p{.8cm}cccc}
\hline
col1&col&col&col&col&col&col&col&col&col&col&col&col&col\\\hline
row&11&49&53&6&13&62&32&34&81&82&31&79&34\\\\
row&12&43&63&30&59&21&11&55&67&70&50&71&50\\\\
row&75&101&119&155&140&0&0&264&31&226&69&144&151\\\\
row&64&48&55&103&80&4&0&62&125&147&34&30&153\\\\
row&68&126&55&165&84&0&0&54&195&211&34&81&159\\\\
row&98&193&235&191&212&83&43&353&179&378&150&294&235\\\\
row&193&339&325&340&382&114&43&635&247&661&212&550&327\\
\hline
\end{tabularx}
}
\caption{This is a caption.}
\label{test}
\end{table}
\end{document}
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

wrong table numbering in a chapter

Post by localghost »

At first let me clarify one important point. You are not new to the forum and by now you should know that with regard to legibility it is extremely helpful to tag code as such by using the code environment of the forum. This is no big deal because it only needs pushing one button. It would be very kind if you could meet this request in future posts.

Your code works fine when I omit the the ltablex package. Since this combines both the longtable and the tabularx package, it seems to have the same effect of increasing the table counter like the former one. This effect also appears when using the tabularx environment with ltablex loaded. I suggest to take a look at the longtable manual to learn more about avoiding this effect.
carol
Posts: 105
Joined: Wed Dec 24, 2008 7:25 pm

Re: wrong table numbering in a chapter

Post by carol »

Thanks for your reply and sorry for the code.

What should be done if in a document, both tabularx and ltablex are used to define the majority of tables with tabularx and some long tables with ltablex if both are in conflict?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

wrong table numbering in a chapter

Post by localghost »

The longtable manual should yield the solution. As far as I know a tabularx environment with ltablex loaded uses the longtable environment. But to find that out is up to you. A look into the manual should do.
carol
Posts: 105
Joined: Wed Dec 24, 2008 7:25 pm

Re: wrong table numbering in a chapter

Post by carol »

keeping the same usepackage defintion (\usepackage{booktabs,tabularx,ltablex}), longtable works perfectly with tabular (instead of tabularx)
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

wrong table numbering in a chapter

Post by sommerfee »

localghost wrote:As far as I know a tabularx environment with ltablex loaded uses the longtable environment. But to find that out is up to you. A look into the manual should do.
If this is the case, the solution should be simple: Omit the table environment (it does not make sense in combination with a longtable anyway) and put the \caption inside the longtable resp. tabularx.
Post Reply