LaTeX forum ⇒ Graphics, Figures & TablesList of Tables counter and placement issue

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

List of Tables counter and placement issue

Postby cyanidebaby » Mon Feb 27, 2017 4:34 pm

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.

  1. % PREAMBLE
  2.  
  3. \documentclass[a4paper,oneside,centered,noparindent,noparskip]{bookest}
  4. \usepackage[english]{babel}
  5. \usepackage{blindtext}
  6. \usepackage{nicefrac}
  7. \usepackage{palatino} % Font for document
  8. \usepackage{hyperref} % Hyperlinks
  9. \usepackage{titletoc} % Customization of TOC LOF LOT
  10. \usepackage{tocloft} % Customization of TOC LOF LOT
  11. \usepackage[table,xcdraw]{xcolor} % For shading in tables
  12. \usepackage{color}
  13. \usepackage{pdfcolmk}
  14. \usepackage{multirow}
  15. \usepackage{ltxtable} % Instead of Longtable package %\caption package is offered with \Longtable
  16. \usepackage{textcomp}
  17. \usepackage{array} % For long tables, to define width of columns
  18. \usepackage{booktabs} % Nicer spacing in columns
  19. \usepackage{siunitx} % To write Celsius, etc.
  20. \usepackage{enumitem} % To create item lists
  21. \usepackage{threeparttable} % For table notes + To allow footnote material to stay with the tabular environment
  22. \usepackage{caption} % To change way captions are labelled
  23. \usepackage{etoolbox} % To make table footnote font smaller
  24. \appto\TPTnoteSettings{\footnotesize}
  25.  
  26. % To format the paragraphs
  27. \setlength{\parindent}{4em} % For indentations
  28. \setlength{\parskip}{1em} % For space between paragrpahs
  29.  
  30. % Defining how Celsius and Fahrenheit appear
  31. \def\degC{$^\circ\kern-0.06em\rm{C}$}
  32. \def\degF{$^\circ\kern-0.06em\rm{F}$}
  33.  
  34. % change the style of the caption numbering.
  35. \renewcommand{\thetable}{\arabic{table}}
  36.  
  37. % Change footnotes from numbers to symbols
  38. \makeatletter
  39. \def\@xfootnote[#1]{%
  40. \protected@xdef\@thefnmark{#1}%
  41. \@footnotemark\@footnotetext}
  42. \makeatother
  43.  
  44. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  45.  
  46. \begin{document}
  47.  
  48. % FRONTMATTER STARTS
  49.  
  50. \tableofcontents
  51. \clearpage
  52.  
  53. \listoftables
  54. \clearpage
  55.  
  56. \thispagestyle{plain} % To not have "List of Tables appear" at the top of the "Preface" page
  57. \section*{Preface}
  58. \blindtext
  59. \clearpage
  60.  
  61. \thispagestyle{plain} % To not have "List of Tables appear" at the top of the "Preface" page
  62. \section*{Introduction}
  63. \blindtext
  64. \clearpage
  65.  
  66. % MAINMATTER STARTS
  67.  
  68. \chapter{Chapter}
  69. \section{Section}
  70.  
  71. \begin{table}[]
  72. \centering
  73. \caption{Birds}\label{Birds}
  74. \begin{threeparttable}
  75. \begin{tabular}{rcl} \toprule
  76. Color & Color & Color \\ \midrule
  77. Color & Color & Color\tnote{*} \\
  78. Color & Color & Color \\ \bottomrule
  79. \end{tabular}
  80. \begin{tablenotes}
  81. \item[*]Text.
  82. \end{tablenotes}
  83. \end{threeparttable}
  84. \end{table}
  85.  
  86. \begin{table}[]
  87. \centering
  88. \caption{Planets}\label{Planets}
  89. \begin{threeparttable}
  90. \begin{tabular}{rcl} \toprule
  91. Color & Color & Color \\ \midrule
  92. Color & Color & Color\tnote{*} \\
  93. Color & Color & Color \\ \bottomrule
  94. \end{tabular}
  95. \begin{tablenotes}
  96. \item[*]Text.
  97. \end{tablenotes}
  98. \end{threeparttable}
  99. \end{table}
  100.  
  101. \section{Chapter}
  102.  
  103. \begin{table}[]
  104. \centering
  105. \caption{Flower.}
  106. \begin{threeparttable}
  107. \begin{tabular}{lllll}\toprule
  108. Boots & Boots & Boots & Boots & Boots \\ \midrule
  109. Boots\tnote{*} & Boots & Boots & Boots & Boots \\
  110. Boots & Boots & Boots & \hspace{15pt}-- & Boots \\ \bottomrule
  111. \end{tabular}
  112. \begin{tablenotes}
  113. \item[*]text..
  114. \end{tablenotes}
  115. \end{threeparttable}
  116. \end{table}
  117.  
  118. \chapter{Chapter}
  119.  
  120. \section{Section}
  121.  
  122. \begin{longtable}{r>{\raggedright\arraybackslash}p{4.5cm}p{2.6cm}>{\raggedright\arraybackslash}p{6.9cm}}
  123. \caption{Kings \& Queens} \label{Kings Queens} \\
  124. \toprule
  125. No. & Name \& Title & Dates & Events \\
  126. \midrule
  127. \endfirsthead
  128. \caption*{\autoref{Kings Queens}: \textit{Continued.}} \\
  129. \toprule
  130. No. & Name \& Title & Dates & Events \\
  131. \midrule
  132. \endhead
  133. 1& King Soandso III & 2234 -- to date & This is some text \\
  134. 2& King Smith ``The Fatty Pig Eater'' & 2234 -- 3456 & yryuryrtyryereyeryeryer\\
  135. 3& King Soandso III & 234 -- 134 (?)& This is some text \\
  136. 4&&& This is some text \\ \bottomrule
  137. \end{longtable}
  138.  
  139. \end{document}

Tags:

User avatar
Stefan Kottwitz
Site Admin
Posts: 8522
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Mon Feb 27, 2017 7:23 pm

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
Site admin

cyanidebaby
Posts: 11
Joined: Tue Feb 07, 2017 1:56 pm

Postby cyanidebaby » Mon Feb 27, 2017 8:07 pm

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
Posts: 34
Joined: Thu Sep 04, 2014 2:43 pm
Location: Black Forest, Germany

Postby BlackForestrian » Mon Feb 27, 2017 11:58 pm

Oh my god, you are confusing me with someone who is really, really, really interested in that!

User avatar
Stefan Kottwitz
Site Admin
Posts: 8522
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Tue Feb 28, 2017 12:06 am

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
Site admin


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 7 guests