Graphics, Figures & TablesAbout numbering of tables

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Brijeshsingh872
Posts: 3
Joined: Tue May 08, 2018 7:50 am

About numbering of tables

Post by Brijeshsingh872 »

I have problem in table numbering. It shows odd numberings only in the place of all numberings. Please solve my problem.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
TikZ book
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

About numbering of tables

Post by Johannes_B »

We would need a minimal working example in order to help you.
With the information given, I cannot even guess.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10312
Joined: Mon Mar 10, 2008 9:44 pm

About numbering of tables

Post by Stefan Kottwitz »

Hi,

welcome to the forum!

Without seeing your code, it hardly can be said what causes it. Under all normal circumstances the numbering is in sequential order. What do you think is different in your code? It's always good to provide code. Most of the times we can see the cause in the code.

Here is a guess: when one uses longtable within a table environment, the counter increases by 2 each time since both do numbering.

This would be wrong:

Code: Select all

\begin{table}
\begin{longtable}
...
\end{longtable}
\caption{...}
\end{table}
In such cases just use

Code: Select all

\begin{longtable}
...
\end{longtable}
Stefan
LaTeX.org admin
Brijeshsingh872
Posts: 3
Joined: Tue May 08, 2018 7:50 am

About numbering of tables

Post by Brijeshsingh872 »

I have used these codes, in which I have problem in table numberings.

Code: Select all

\documentclass[a4paper,12pt]{report}
\usepackage{caption}
\usepackage{longtable}

\begin{document}
\listoftables

\newpage
\begin{center}
\captionof{table}{Year-wise Assessments}
\begin{longtable}{| p{.20\textwidth} | p{.20\textwidth} | p{.20\textwidth} | p{.20\textwidth} |}
\hline
\textbf{2012} & \textbf{2014} & \textbf{2016} & \textbf{2018}\\
\hline
\end{longtable}
\end{center}

\newpage
\begin{center}
\captionof{table}{2012 Month-wise Assessments}
\begin{longtable}{| p{.20\textwidth} | p{.20\textwidth} | p{.20\textwidth} | p{.20\textwidth} |}
\hline
\textbf{January} & \textbf{February} & \textbf{March} & \textbf{April}\\
\hline
\end{longtable}
\end{center}
 
\newpage
\begin{center}
\captionof{table}{January Day-wise Assessments}
\begin{longtable}{| p{.20\textwidth} | p{.20\textwidth} | p{.20\textwidth} |}
\hline
\textbf{Monday} & \textbf{Tuesday} & \textbf{Thursday}\\
\hline
\end{longtable}
\end{center}

\newpage
\begin{center}
\captionof{table}{2014 Month-wise Assessments}
\begin{longtable}{| p{.20\textwidth} | p{.20\textwidth} | p{.20\textwidth} | p{.20\textwidth} |}
\hline
\textbf{January} & \textbf{February} & \textbf{March} & \textbf{April}\\
\hline
\end{longtable}
\end{center}

\newpage
\begin{center}
\captionof{table}{February Day-wise Assessments}
\begin{longtable}{| p{.20\textwidth} | p{.20\textwidth} | p{.20\textwidth} |}
\hline
\textbf{Monday} & \textbf{Tuesday} & \textbf{Thursday}\\
\hline
\end{longtable}
\end{center}

\newpage
\begin{center}
\captionof{table}{2016 Month-wise Assessments}
\begin{longtable}{| p{.20\textwidth} | p{.20\textwidth} | p{.20\textwidth} | p{.20\textwidth} |}
\hline
\textbf{January} & \textbf{February} & \textbf{March} & \textbf{April}\\
\hline
\end{longtable}
\end{center}

\newpage
\begin{center}
\captionof{table}{March Day-wise Assessments}
\begin{longtable}{| p{.20\textwidth} | p{.20\textwidth} | p{.20\textwidth} |}
\hline
\textbf{Monday} & \textbf{Tuesday} & \textbf{Thursday}\\
\hline
\end{longtable}
\end{center}

\end{document}
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

About numbering of tables

Post by Johannes_B »

You have to give the caption inside the longtable environment.
You should also remove the center environment, as longtables are centered by default.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Brijeshsingh872
Posts: 3
Joined: Tue May 08, 2018 7:50 am

About numbering of tables

Post by Brijeshsingh872 »

Johannes_B wrote:You have to give the caption inside the longtable environment.
You should also remove the center environment, as longtables are centered by default.

I have used the code \caption{XYZ.....} Just before the \end{longtable}, the caption goes to below the table.
But my requirement is caption must be above the table.

Please suggest me.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

About numbering of tables

Post by Johannes_B »

Write caption after \begin{longtable} line.

On smartphone, cannot post an example, sorry.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

About numbering of tables

Post by Johannes_B »

Code: Select all

\documentclass[a4paper,12pt]{report}
    %\usepackage{caption}
    \usepackage{longtable}
     
    \begin{document}
    \listoftables
     
    \clearpage
    \begin{longtable}{| p{.20\textwidth} | p{.20\textwidth} | p{.20\textwidth} | p{.20\textwidth} |}
    \caption{Year-wise Assessments}\\
    \hline
    \textbf{2012} & \textbf{2014} & \textbf{2016} & \textbf{2018}\\
    \hline
    \end{longtable}
    \end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply