# Continuous table numbering problem

I have the following problem:

I'm writing an article. I wrote text, then inserted a table. The first table is labeled as Table I with the caption command. I also have, for instance, two other tables in the Appendix, which are labeled as Table 2 and Table 3.

However, when I insert a table into the text again, it labels the second table in the text as Table 2 and not as Table 4? Unfortunately, the number of tables is not continuously. How can I fix this?

# Edit:

Here is an example, where my problem is:

Till now, everything is fine, now, i want to add another table in the text, and i get this:

I would like to have that the second table in the text is labeled as Table 4 and not as Table 2.

Here u can find my latex code for it:

\usepackage{caption}

\begin{document}

\section{Introduction}

Text......
\begin{table}[htbp]
\centering
\caption{Table A}
\begin{tabular}{l}
\toprule
A \\
\bottomrule
\end{tabular}
\end{table}

\noindent
Text....

% Table generated by Excel2LaTeX from sheet 'Tabelle1'
\begin{table}[htbp]
\centering
\caption{D}
\begin{tabular}{l}
\toprule
D \\
\bottomrule
\end{tabular}%
\end{table}%

\section{Appendix}
\subsection{Tables}

\begin{table}[htbp]
\centering
\caption{A and B}
\begin{tabular}{ll}
\toprule
A     & B \\
\bottomrule
\end{tabular}
\end{table}

\begin{table}[h!]
\centering
\caption{A, B and C}
\begin{tabular}{lll}
\toprule
A     & B     & C \\
\bottomrule
\end{tabular}
\end{table}

\end{document}

• what you describe is not the usual behaviour so there is an error in code you have not shown. It is always best to include a complete small document that shows the problem – David Carlisle Jul 12 '19 at 11:38
• Where exactly are those four tables in the flow from start to finish? Normally appedix comes at the end. So if you insert a new table after table 1, it will become table 2, and the two tables in the appendix will be 3 and 4. Which it should. Remember never use hard coded numbers when you refer to something that LaTeX numbers, always use the label+ref mechanism. – daleif Jul 12 '19 at 11:44

It seems that you want to number the tables out of order. That is a strange requirement but simply avoid using latex's automatic numbering, either by not using \caption or by using the unnumbered \caption* and then add numbers by hand as part of the caption text.

\documentclass{article}

\usepackage{caption,booktabs}
\setcounter{totalnumber}{5}

\begin{document}

\section{Introduction}

Text......

\begin{table}[htbp]
\centering
\caption*{Table 1: Table A}
\begin{tabular}{l}
\toprule
A \\
\bottomrule
\end{tabular}
\end{table}

\noindent
Text....

% Table generated by Excel2LaTeX from sheet 'Tabelle1'
\begin{table}[htbp]
\centering
\caption*{Table 4: D}
\begin{tabular}{l}
\toprule
D \\
\bottomrule
\end{tabular}%
\end{table}%

\section{Appendix}
\subsection{Tables}

\begin{table}[htbp]
\centering
\caption*{Table 2: A and B}
\begin{tabular}{ll}
\toprule
A     & B \\
\bottomrule
\end{tabular}
\end{table}

\begin{table}[htp]% dont use [h!]
\centering
\caption*{Table 3: A, B and C}
\begin{tabular}{lll}
\toprule
A     & B     & C \\
\bottomrule
\end{tabular}

• @texx that is if you do not manually write Table 4 into that table, how can latex know to number it 4 if it is the second table? – David Carlisle Jul 12 '19 at 13:23