Graphics, Figures & TablesList of Tables counter and placement issue

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
cyanidebaby
Posts: 11
Joined: Tue Feb 07, 2017 1:56 pm

List of Tables counter and placement issue

Post by cyanidebaby »

Hello all,

I have a few regular tables in my document, as well as a longtable.
For some reason, the List of Tables leaves a space before the longtable and labels it "1" when, logically, it should be "4".
I can't figure out where the issue is!

Sorry for all the code, but better you got everything to help track the problem down.

Thank you.

Code: Select all

% PREAMBLE

\documentclass[a4paper,oneside,centered,noparindent,noparskip]{bookest}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{nicefrac}
\usepackage{palatino} % Font for document
\usepackage{hyperref} % Hyperlinks
\usepackage{titletoc} % Customization of TOC LOF LOT
\usepackage{tocloft} % Customization of TOC LOF LOT
\usepackage[table,xcdraw]{xcolor} % For shading in tables
\usepackage{color}
\usepackage{pdfcolmk}
\usepackage{multirow}
\usepackage{ltxtable} % Instead of Longtable package %\caption package is offered with \Longtable
\usepackage{textcomp}
\usepackage{array} % For long tables, to define width of columns
\usepackage{booktabs} % Nicer spacing in columns
\usepackage{siunitx} % To write Celsius, etc.
\usepackage{enumitem} % To create item lists
\usepackage{threeparttable} % For table notes + To allow footnote material to stay with the tabular environment
\usepackage{caption} % To change way captions are labelled
\usepackage{etoolbox} % To make table footnote font smaller
\appto\TPTnoteSettings{\footnotesize}

% To format the paragraphs
\setlength{\parindent}{4em} % For indentations
\setlength{\parskip}{1em} % For space between paragrpahs

% Defining how Celsius and Fahrenheit appear
\def\degC{$^\circ\kern-0.06em\rm{C}$}
\def\degF{$^\circ\kern-0.06em\rm{F}$}

% change the style of the caption numbering.
\renewcommand{\thetable}{\arabic{table}}

% Change footnotes from numbers to symbols
\makeatletter
\def\@xfootnote[#1]{%
	\protected@xdef\@thefnmark{#1}%
	\@footnotemark\@footnotetext}
\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
	
% FRONTMATTER STARTS
	
\tableofcontents
\clearpage
	
\listoftables
\clearpage
	
\thispagestyle{plain} % To not have "List of Tables appear" at the top of the "Preface" page
\section*{Preface}
\blindtext
\clearpage
	
\thispagestyle{plain} % To not have "List of Tables appear" at the top of the "Preface" page
\section*{Introduction}
\blindtext
\clearpage
	
% MAINMATTER STARTS

\chapter{Chapter}
\section{Section}

\begin{table}[]
	\centering
	\caption{Birds}\label{Birds}
	\begin{threeparttable}
		\begin{tabular}{rcl} \toprule
			Color & Color & Color              \\ \midrule 
			Color & Color & Color\tnote{*} \\
			Color & Color & Color              \\ \bottomrule
		\end{tabular}
		\begin{tablenotes}
			\item[*]Text.
		\end{tablenotes}
	\end{threeparttable}
\end{table}
		
\begin{table}[]
		\centering
		\caption{Planets}\label{Planets}
		\begin{threeparttable}
			\begin{tabular}{rcl} \toprule
				Color & Color & Color              \\ \midrule 
				Color & Color & Color\tnote{*} \\
				Color & Color & Color              \\ \bottomrule
			\end{tabular}
			\begin{tablenotes}
				\item[*]Text.
			\end{tablenotes}
		\end{threeparttable}
\end{table}
	
\section{Chapter}
	
\begin{table}[]
	\centering
	\caption{Flower.}
	\begin{threeparttable}
		\begin{tabular}{lllll}\toprule
			Boots               &  Boots & Boots & Boots                & Boots  \\ \midrule
			Boots\tnote{*}  &  Boots & Boots & Boots                & Boots  \\
			Boots               & Boots  & Boots & \hspace{15pt}-- & Boots  \\ \bottomrule
		\end{tabular}
		\begin{tablenotes}
			\item[*]text..
		\end{tablenotes}
	\end{threeparttable}
\end{table}
	
\chapter{Chapter}
	
\section{Section}
	
\begin{longtable}{r>{\raggedright\arraybackslash}p{4.5cm}p{2.6cm}>{\raggedright\arraybackslash}p{6.9cm}}
	\caption{Kings \& Queens} \label{Kings Queens} \\
	\toprule
	No. & Name \& Title & Dates & Events \\
	\midrule
	\endfirsthead
	\caption*{\autoref{Kings Queens}: \textit{Continued.}} \\
	\toprule
	No. & Name \& Title & Dates & Events \\
	\midrule
	\endhead	
	1& King Soandso III & 2234 -- to date &  This is some text \\
	2& King Smith ``The Fatty Pig Eater'' & 2234 -- 3456 & yryuryrtyryereyeryeryer\\
	3& King Soandso III & 234 -- 134 (?)& This is some text \\
	4&&&  This is some text \\ \bottomrule
\end{longtable}

\end{document}

Recommended reading 2024:

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

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

User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

List of Tables counter and placement issue

Post by Stefan Kottwitz »

The numbering of tables is per chapter. And there's a gap between chapters in the list.
So, the original numbering would be:

1.1
1.2
1.3

2.1
...


You used this line to remove the chapter number with dot:

\renewcommand{\thetable}{\arabic{table}}

Comment it out by a % at the beginning of that line to see the original numbering. Compile two times to get the list of tables updated.

Do you really want to change the numbering to be continuously through all chapter? There are more things numbered per chapter, that may require more work for those too.

Stefan
LaTeX.org admin
cyanidebaby
Posts: 11
Joined: Tue Feb 07, 2017 1:56 pm

List of Tables counter and placement issue

Post by cyanidebaby »

Hi Stefan,

It works. Thank you.

I originally wanted round numbers for the tables. I find "Table 1.3" or "Table 2.1" unpleasant to read and to the eye.
But you make a good point: maybe the extra work is not worth such a little issue. I didn't think about the overall implications of going for round numbers.

So for now, I'll stick to the default setting.
Thanks again.

- Alex
BlackForestrian

List of Tables counter and placement issue

Post by BlackForestrian »

User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

List of Tables counter and placement issue

Post by Stefan Kottwitz »

Thanks Christian!

Alex, no problem with cross-posts, but please give a link on each site to the other site when doing it, saving us double effort.

I would have mentioned \counterwithout too, but that would be required for each counter: tables, figures, equations, theorems, etc. But it depends on taste and feeling: perhaps number per chapter in bigger documents with many tables, and continuously when there are not many figures, tables, or equations and the like. I mean, table 5.4 is clearly table 4 in chapter 5, but where would you search a table 28?

Stefan
LaTeX.org admin
Post Reply