LaTeX forum ⇒ Graphics, Figures & Tableslongtable | Long Table appears twice in LoT Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
marie2011
Posts: 138
Joined: Mon Feb 06, 2012 4:58 pm

longtable | Long Table appears twice in LoT

Postby marie2011 » Sat Dec 08, 2012 10:08 am

Dear forum members,

I am struggling with a couple of tables in my list of tables. I am including a minimal example where you can see two long tables. The first one is OK, but the second one appears twice in the index. Do you know why? When I compile this minimal example I get an error and instead of Table 1, it appears “red”, but this does not happen in my work. I do not know why, but at the end the document can be compiled anyway. I think there is something wrong with:
  1. \ifpdf
  2. \tableofcontents


  1. \documentclass[
  2. 12pt,%
  3. % draft,%
  4. twoside,%
  5. BCOR10mm,%
  6. bib=totoc,
  7. toc=listof,
  8. toc=bibliography,
  9. numbers=noenddot
  10. ]{scrreprt}
  11. \usepackage[T1]{fontenc}
  12. \usepackage[utf8]{inputenc}
  13. \usepackage[spanish,ngerman,catalan,english]{babel}
  14. \usepackage{natbib}
  15. \usepackage{tabularx}
  16. \usepackage{mystyle}
  17. \usepackage{longtable}
  18. \usepackage{caption}
  19.  
  20. \captionsetup[table]{labelsep=quad}
  21. \captionsetup[figure]{labelsep=quad}
  22.  
  23. \addto\captionsspanish{%
  24. %\renewcommand{\listfigurename}{Índice de Figuras}
  25. \renewcommand{\listfigurename}{Índice de Figuras}
  26. \renewcommand{\listtablename}{Índice de Tablas}
  27. \renewcommand{\figurename}{Figura}
  28. \renewcommand{\tablename}{Tabla}
  29. \renewcommand{\bibname}{Referencias bibliográficas}
  30. \renewcommand{\appendixname}{Apéndices}
  31. \renewcommand{\appendixtocname}{Apéndices}
  32. \renewcommand{\appendixpagename}{Apéndices}}
  33.  
  34. \pagenumbering{roman}
  35. \ifpdf
  36. \tableofcontents
  37.  
  38. {\listoftables
  39. \let\cleardoublepage\relax
  40. \let\clearpage\relax
  41. \listoffigures
  42. \let\cleardoublepage\relax
  43. \let\clearpage\relax
  44. \listofgraficos
  45. }
  46.  
  47. \pagenumbering{arabic}
  48.  
  49. \begin{document}
  50.  
  51. \ref{tab:errors}
  52.  
  53. \begin{center}
  54. \begin{longtable} {|p{1.20cm}| p{10cm}|r|r|r|}
  55. \caption{Errores} \label{tab:errors} \\
  56.  
  57. \hline \multicolumn{1}{|l|}{\textbf{Num}} &
  58. \multicolumn{1}{X|}{\textbf{Cat}} &
  59. \multicolumn{1}{l|}{\textbf{Total}} \\ \hline
  60. \endfirsthead
  61.  
  62. \multicolumn{3}{c}%
  63. {{\tablename\ \thetable{}: Errors }} \\
  64. \hline \multicolumn{1}{|l|}{\textbf{Num}} &
  65. \multicolumn{1}{X|}{\textbf{Cat}} &
  66. \multicolumn{1}{l|}{\textbf{Total}} \\
  67. \hline
  68. \endhead
  69.  
  70. \hline \multicolumn{3}{|r|}{{\emph{continuación}}} \\ \hline
  71. \endfoot
  72.  
  73. \hline \hline
  74. \endlastfoot
  75.  
  76.  
  77.  
  78. \textbf{1} & \textbf{Errors} & \%\\
  79. \hline
  80. 1.1&Example I&15 (1,32\%)\\
  81. 1.1&Example I&15 (1,32\%)\\
  82. 1.1&Example I&15 (1,32\%)\\
  83. 1.1&Example I&15 (1,32\%)\\
  84. 1.1&Example I&15 (1,32\%)\\
  85. 1.1&Example I&15 (1,32\%)\\
  86. 1.1&Example I&15 (1,32\%)\\
  87. 1.1&Example I&15 (1,32\%)\\
  88. 1.1&Example I&15 (1,32\%)\\
  89. 1.1&Example I&15 (1,32\%)\\
  90. 1.1&Example I&15 (1,32\%)\\
  91. 1.1&Example I&15 (1,32\%)\\
  92. 1.1&Example I&15 (1,32\%)\\
  93. 1.1&Example I&15 (1,32\%)\\
  94. 1.1&Example I&15 (1,32\%)\\
  95. 1.1&Example I&15 (1,32\%)\\
  96. 1.1&Example I&15 (1,32\%)\\
  97. 1.1&Example I&15 (1,32\%)\\
  98. 1.1&Example I&15 (1,32\%)\\
  99. 1.1&Example I&15 (1,32\%)\\
  100. 1.1&Example I&15 (1,32\%)\\
  101. 1.1&Example I&15 (1,32\%)\\
  102. 1.1&Example I&15 (1,32\%)\\
  103. 1.1&Example I&15 (1,32\%)\\
  104. 1.1&Example I&15 (1,32\%)\\
  105. 1.1&Example I&15 (1,32\%)\\
  106. 1.1&Example I&15 (1,32\%)\\
  107. 1.1&Example I&15 (1,32\%)\\
  108. 1.1&Example I&15 (1,32\%)\\
  109. 1.1&Example I&15 (1,32\%)\\
  110. 1.1&Example I&15 (1,32\%)\\
  111. 1.1&Example I&15 (1,32\%)\\
  112. 1.1&Example I&15 (1,32\%)\\
  113. 1.1&Example I&15 (1,32\%)\\
  114. 1.1&Example I&15 (1,32\%)\\
  115. 1.1&Example I&15 (1,32\%)\\
  116. 1.1&Example I&15 (1,32\%)\\
  117. 1.1&Example I&15 (1,32\%)\\
  118. 1.1&Example I&15 (1,32\%)\\
  119. 1.1&Example I&15 (1,32\%)\\
  120. 1.1&Example I&15 (1,32\%)\\
  121. 1.1&Example I&15 (1,32\%)\\
  122. 1.1&Example I&15 (1,32\%)\\
  123. 1.1&Example I&15 (1,32\%)\\
  124. 1.1&Example I&15 (1,32\%)\\
  125. 1.1&Example I&15 (1,32\%)\\
  126. 1.1&Example I&15 (1,32\%)\\
  127. 1.1&Example I&15 (1,32\%)\\
  128. 1.1&Example I&15 (1,32\%)\\
  129. 1.1&Example I&15 (1,32\%)\\
  130. 1.1&Example I&15 (1,32\%)\\
  131. 1.1&Example I&15 (1,32\%)\\
  132. 1.1&Example I&15 (1,32\%)\\
  133. 1.1&Example I&15 (1,32\%)\\
  134. 1.1&Example I&15 (1,32\%)\\
  135. 1.1&Example I&15 (1,32\%)\\
  136. 1.1&Example I&15 (1,32\%)\\
  137.  
  138. \end{longtable}
  139. \end{center}
  140.  
  141. \ref{tab:example}
  142.  
  143. \begin{longtable} {lp{13cm}}
  144. \caption{Example}\label{tab:example}
  145. \hline
  146.  
  147. \textbf{nume} & \textbf{Examples} \\ \hline
  148. \endhead
  149. \hline \multicolumn{2}{l}{{\emph{continuación}}}\\ \hline
  150. \endfoot
  151. \hline \hline
  152. \endlastfoot
  153. 2.2&Example II\\
  154. 2.2&Example II\\
  155. 2.2&Example II\\
  156. 2.2&Example II\\
  157. 2.2&Example II\\
  158. 2.2&Example II\\
  159. 2.2&Example II\\
  160. 2.2&Example II\\
  161. 2.2&Example II\\
  162. 2.2&Example II\\
  163. 2.2&Example II\\
  164. 2.2&Example II\\
  165. 2.2&Example II\\
  166. 2.2&Example II\\
  167. 2.2&Example II\\
  168. 2.2&Example II\\
  169. 2.2&Example II\\
  170. 2.2&Example II\\
  171. 2.2&Example II\\
  172. 2.2&Example II\\
  173. \end{longtable}
  174. \end{document}


But, as I wrote, my question is why the second table appears twice in the index. Attached you will find a picture so that you can see what I mean. Sorry, but I cannot make the attachment smaller.

Many thanks in advance.

Regards,

Marie
Attachments
list-of-tables.png
list-of-tables.png (16.47 KiB) Viewed 4920 times

Tags:

User avatar
sommerfee
Posts: 498
Joined: Mon Apr 09, 2007 4:20 pm

Postby sommerfee » Tue Dec 11, 2012 11:09 am

I cannot compile your sample code:
  1. ! LaTeX Error: File `mystyle.sty' not found.


But usually one places
  1. \caption{<Legend>}\label{<label>}\\
within the \endfirsthead part and a
  1. \caption[]{<Legend>}\\
within the \endhead part of the longtable.

This way the LOT entry will be suppressed for every page of the longtable except the first one.

See also documentation of the longtable package, section 3 "Captions and Headings":
You may wish the caption on later pages to be different to that on the first page.
In this case put the \caption command in the first heading, and put a subsidiary
caption in a \caption[] command in the main heading. If the optional argument
to \caption is empty, no entry is made in the list of tables. Alternatively, if
you do not want the table number to be printed each time, use the \caption*
command.

marie2011
Posts: 138
Joined: Mon Feb 06, 2012 4:58 pm

Postby marie2011 » Fri Dec 14, 2012 2:22 pm

Hello sommerfee,

Many thanks for your explanation.

Cheers,

Marie


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 6 guests