LaTeX forum ⇒ GeneralTable Counter and LoT Topic is solved

LaTeX specific issues not fitting into one of the other forums of this category.
pjmiller_57
Posts: 20
Joined: Tue Nov 08, 2011 4:37 pm

Table Counter and LoT

Postby pjmiller_57 » Thu Oct 17, 2013 3:49 pm

Hi All,

I'm trying to put together a statistical analysis plan. This is something I've never tried before. I want to create a section at the end called table shells, but I'm running into a couple of problems.

The first happens when I use \setcounter{table}{0} followed by \listoftables. The idea is to list all of my table shells at the end without also listing tables that came earlier in the body of the document. I've included some sample code to illustrate the problem.
  1. \documentclass[12pt]{article}
  2.  
  3. %% Margins %%
  4.  
  5. \setlength{\textwidth}{6.25in}
  6. \setlength{\oddsidemargin}{0in}
  7.  
  8. %%%% Packages %%%%
  9.  
  10. \usepackage[nottoc,numbib]{tocbibind}
  11. \usepackage[font={bf}]{caption}
  12. \usepackage[newcommands]{ragged2e}
  13. \usepackage{array}
  14. \usepackage{longtable}
  15. \usepackage{threeparttablex}
  16. \usepackage{booktabs}
  17. \usepackage[
  18. pdfstartpage=30,
  19. pdfpagemode=UseOutlines,
  20. bookmarks,
  21. bookmarksopen,
  22. pdfstartview=Fit,
  23. pdfview=Fit,
  24. colorlinks,
  25. linktocpage,
  26. linkcolor=blue,
  27. citecolor=blue,
  28. pagebackref=true
  29. ]{hyperref}
  30.  
  31. \begin{document}
  32.  
  33. \newpage
  34.  
  35. \section{Text with Tables Before the Table Shells}
  36.  
  37. An initial table called Table \hyperref[tbl:another]{\ref{tbl:initial}}.
  38.  
  39. {
  40. \footnotesize
  41. \begin{longtable}{ *{3}{>{\centering}m{1.5in}} }
  42. \caption[]{An Initial Longtable} \\ \hline
  43. \label{tbl:initial}
  44. Column 1 & Column 2 & Column 3 \\ \hline
  45. \endfirsthead
  46. \caption[]{An Initial Longtable (Continued)} \\ \hline
  47. Column 1 & Column 2 & Column 3 \\ \hline
  48. \endhead
  49. \hline \multicolumn{3}{r}{\emph{Continued on next page}}
  50. \endfoot
  51. \hline
  52. \endlastfoot
  53. XXXXX & XXXXX & XXXXX \\
  54. XXXXX & XXXXX & XXXXX \\
  55. XXXXX & XXXXX & XXXXX \\
  56. XXXXX & XXXXX & XXXXX \\
  57. XXXXX & XXXXX & XXXXX \\
  58. XXXXX & XXXXX & XXXXX \\
  59. XXXXX & XXXXX & XXXXX \\
  60. XXXXX & XXXXX & XXXXX \\
  61. XXXXX & XXXXX & XXXXX \\
  62. XXXXX & XXXXX & XXXXX \\
  63. XXXXX & XXXXX & XXXXX \\
  64. XXXXX & XXXXX & XXXXX \\
  65. XXXXX & XXXXX & XXXXX \\
  66. XXXXX & XXXXX & XXXXX \\
  67. XXXXX & XXXXX & XXXXX \\
  68. XXXXX & XXXXX & XXXXX \\
  69. XXXXX & XXXXX & XXXXX \\
  70. XXXXX & XXXXX & XXXXX \\
  71. XXXXX & XXXXX & XXXXX \\
  72. XXXXX & XXXXX & XXXXX \\
  73. XXXXX & XXXXX & XXXXX \\
  74. XXXXX & XXXXX & XXXXX \\
  75. XXXXX & XXXXX & XXXXX \\
  76. XXXXX & XXXXX & XXXXX \\
  77. XXXXX & XXXXX & XXXXX \\
  78. XXXXX & XXXXX & XXXXX \\
  79. XXXXX & XXXXX & XXXXX \\
  80. XXXXX & XXXXX & XXXXX \\
  81. XXXXX & XXXXX & XXXXX \\
  82. XXXXX & XXXXX & XXXXX \\
  83. XXXXX & XXXXX & XXXXX \\
  84. XXXXX & XXXXX & XXXXX \\
  85. XXXXX & XXXXX & XXXXX \\
  86. XXXXX & XXXXX & XXXXX \\
  87. XXXXX & XXXXX & XXXXX \\
  88. XXXXX & XXXXX & XXXXX \\
  89. XXXXX & XXXXX & XXXXX \\
  90. XXXXX & XXXXX & XXXXX \\
  91. XXXXX & XXXXX & XXXXX \\
  92. XXXXX & XXXXX & XXXXX \\
  93. XXXXX & XXXXX & XXXXX \\
  94. XXXXX & XXXXX & XXXXX \\
  95. XXXXX & XXXXX & XXXXX \\
  96. XXXXX & XXXXX & XXXXX \\
  97. XXXXX & XXXXX & XXXXX \\
  98. XXXXX & XXXXX & XXXXX \\
  99. XXXXX & XXXXX & XXXXX \\
  100. XXXXX & XXXXX & XXXXX \\
  101. XXXXX & XXXXX & XXXXX \\
  102. XXXXX & XXXXX & XXXXX \\
  103. XXXXX & XXXXX & XXXXX \\
  104. XXXXX & XXXXX & XXXXX \\
  105. XXXXX & XXXXX & XXXXX \\
  106. XXXXX & XXXXX & XXXXX \\
  107. XXXXX & XXXXX & XXXXX \\
  108. XXXXX & XXXXX & XXXXX \\
  109. XXXXX & XXXXX & XXXXX \\
  110. XXXXX & XXXXX & XXXXX \\
  111. XXXXX & XXXXX & XXXXX \\
  112. XXXXX & XXXXX & XXXXX \\
  113. \end{longtable}
  114. }
  115. \newpage
  116. Another table called Table \hyperref[tbl:another]{\ref{tbl:another}}.
  117.  
  118. {
  119. \footnotesize
  120. \begin{longtable}{ *{3}{>{\centering}m{1.5in}} }
  121. \caption[]{Another Longtable} \\ \hline
  122. \label{tbl:another}
  123. Column 1 & Column 2 & Column 3 \\ \hline
  124. \endfirsthead
  125. \caption[]{Another Longtable (Continued)} \\ \hline
  126. Column 1 & Column 2 & Column 3 \\ \hline
  127. \endhead
  128. \hline \multicolumn{3}{r}{\emph{Continued on next page}}
  129. \endfoot
  130. \hline
  131. \endlastfoot
  132. XXXXX & XXXXX & XXXXX \\
  133. XXXXX & XXXXX & XXXXX \\
  134. XXXXX & XXXXX & XXXXX \\
  135. XXXXX & XXXXX & XXXXX \\
  136. XXXXX & XXXXX & XXXXX \\
  137. XXXXX & XXXXX & XXXXX \\
  138. XXXXX & XXXXX & XXXXX \\
  139. XXXXX & XXXXX & XXXXX \\
  140. XXXXX & XXXXX & XXXXX \\
  141. XXXXX & XXXXX & XXXXX \\
  142. XXXXX & XXXXX & XXXXX \\
  143. XXXXX & XXXXX & XXXXX \\
  144. XXXXX & XXXXX & XXXXX \\
  145. XXXXX & XXXXX & XXXXX \\
  146. XXXXX & XXXXX & XXXXX \\
  147. XXXXX & XXXXX & XXXXX \\
  148. XXXXX & XXXXX & XXXXX \\
  149. XXXXX & XXXXX & XXXXX \\
  150. XXXXX & XXXXX & XXXXX \\
  151. XXXXX & XXXXX & XXXXX \\
  152. XXXXX & XXXXX & XXXXX \\
  153. XXXXX & XXXXX & XXXXX \\
  154. XXXXX & XXXXX & XXXXX \\
  155. XXXXX & XXXXX & XXXXX \\
  156. XXXXX & XXXXX & XXXXX \\
  157. XXXXX & XXXXX & XXXXX \\
  158. XXXXX & XXXXX & XXXXX \\
  159. XXXXX & XXXXX & XXXXX \\
  160. XXXXX & XXXXX & XXXXX \\
  161. XXXXX & XXXXX & XXXXX \\
  162. XXXXX & XXXXX & XXXXX \\
  163. XXXXX & XXXXX & XXXXX \\
  164. XXXXX & XXXXX & XXXXX \\
  165. XXXXX & XXXXX & XXXXX \\
  166. XXXXX & XXXXX & XXXXX \\
  167. XXXXX & XXXXX & XXXXX \\
  168. XXXXX & XXXXX & XXXXX \\
  169. XXXXX & XXXXX & XXXXX \\
  170. XXXXX & XXXXX & XXXXX \\
  171. XXXXX & XXXXX & XXXXX \\
  172. XXXXX & XXXXX & XXXXX \\
  173. XXXXX & XXXXX & XXXXX \\
  174. XXXXX & XXXXX & XXXXX \\
  175. XXXXX & XXXXX & XXXXX \\
  176. XXXXX & XXXXX & XXXXX \\
  177. XXXXX & XXXXX & XXXXX \\
  178. XXXXX & XXXXX & XXXXX \\
  179. XXXXX & XXXXX & XXXXX \\
  180. XXXXX & XXXXX & XXXXX \\
  181. XXXXX & XXXXX & XXXXX \\
  182. XXXXX & XXXXX & XXXXX \\
  183. XXXXX & XXXXX & XXXXX \\
  184. XXXXX & XXXXX & XXXXX \\
  185. XXXXX & XXXXX & XXXXX \\
  186. XXXXX & XXXXX & XXXXX \\
  187. XXXXX & XXXXX & XXXXX \\
  188. XXXXX & XXXXX & XXXXX \\
  189. XXXXX & XXXXX & XXXXX \\
  190. XXXXX & XXXXX & XXXXX \\
  191. XXXXX & XXXXX & XXXXX \\
  192. \end{longtable}
  193. }
  194.  
  195. \newpage
  196.  
  197. %\section{Appendix B: Table Shells}
  198. \setcounter{table}{0}
  199. \renewcommand\listtablename{Appendix A: Table Shells}
  200. \renewcommand\thetable{\S\arabic{table}}
  201. \listoftables
  202.  
  203. \newpage
  204.  
  205. {
  206. \footnotesize
  207. \begin{longtable}{ *{3}{>{\centering}m{1.5in}} }
  208. \caption[First Table Shell]{First Table Shell} \\ \hline
  209. Column 1 & Column 2 & Column 3 \\ \hline
  210. \endfirsthead
  211. \caption[]{First Table Shell (Continued)} \\ \hline
  212. Column 1 & Column 2 & Column 3 \\ \hline
  213. \endhead
  214. \hline \multicolumn{3}{r}{\emph{Continued on next page}}
  215. \endfoot
  216. \hline
  217. \endlastfoot
  218. XXXXX & XXXXX & XXXXX \\
  219. XXXXX & XXXXX & XXXXX \\
  220. XXXXX & XXXXX & XXXXX \\
  221. XXXXX & XXXXX & XXXXX \\
  222. XXXXX & XXXXX & XXXXX \\
  223. XXXXX & XXXXX & XXXXX \\
  224. XXXXX & XXXXX & XXXXX \\
  225. XXXXX & XXXXX & XXXXX \\
  226. XXXXX & XXXXX & XXXXX \\
  227. XXXXX & XXXXX & XXXXX \\
  228. XXXXX & XXXXX & XXXXX \\
  229. XXXXX & XXXXX & XXXXX \\
  230. XXXXX & XXXXX & XXXXX \\
  231. XXXXX & XXXXX & XXXXX \\
  232. XXXXX & XXXXX & XXXXX \\
  233. XXXXX & XXXXX & XXXXX \\
  234. XXXXX & XXXXX & XXXXX \\
  235. XXXXX & XXXXX & XXXXX \\
  236. XXXXX & XXXXX & XXXXX \\
  237. XXXXX & XXXXX & XXXXX \\
  238. XXXXX & XXXXX & XXXXX \\
  239. XXXXX & XXXXX & XXXXX \\
  240. XXXXX & XXXXX & XXXXX \\
  241. XXXXX & XXXXX & XXXXX \\
  242. XXXXX & XXXXX & XXXXX \\
  243. XXXXX & XXXXX & XXXXX \\
  244. XXXXX & XXXXX & XXXXX \\
  245. XXXXX & XXXXX & XXXXX \\
  246. XXXXX & XXXXX & XXXXX \\
  247. XXXXX & XXXXX & XXXXX \\
  248. XXXXX & XXXXX & XXXXX \\
  249. XXXXX & XXXXX & XXXXX \\
  250. XXXXX & XXXXX & XXXXX \\
  251. XXXXX & XXXXX & XXXXX \\
  252. XXXXX & XXXXX & XXXXX \\
  253. XXXXX & XXXXX & XXXXX \\
  254. XXXXX & XXXXX & XXXXX \\
  255. XXXXX & XXXXX & XXXXX \\
  256. XXXXX & XXXXX & XXXXX \\
  257. XXXXX & XXXXX & XXXXX \\
  258. XXXXX & XXXXX & XXXXX \\
  259. XXXXX & XXXXX & XXXXX \\
  260. XXXXX & XXXXX & XXXXX \\
  261. XXXXX & XXXXX & XXXXX \\
  262. XXXXX & XXXXX & XXXXX \\
  263. XXXXX & XXXXX & XXXXX \\
  264. XXXXX & XXXXX & XXXXX \\
  265. XXXXX & XXXXX & XXXXX \\
  266. XXXXX & XXXXX & XXXXX \\
  267. XXXXX & XXXXX & XXXXX \\
  268. XXXXX & XXXXX & XXXXX \\
  269. XXXXX & XXXXX & XXXXX \\
  270. XXXXX & XXXXX & XXXXX \\
  271. XXXXX & XXXXX & XXXXX \\
  272. XXXXX & XXXXX & XXXXX \\
  273. XXXXX & XXXXX & XXXXX \\
  274. XXXXX & XXXXX & XXXXX \\
  275. XXXXX & XXXXX & XXXXX \\
  276. XXXXX & XXXXX & XXXXX \\
  277. XXXXX & XXXXX & XXXXX \\
  278. \end{longtable}
  279. }
  280. \newpage
  281. \begin{table}[h]
  282. \caption[Second Table Shell]{Second Table Shell}
  283. \begin{center}
  284. \begin{tabular}{lcc} \hline
  285. Column 1 & Column 2 & Column 3 \\ \hline
  286. Col1, Row1 & Col2, Row1 & Col3, Row1 \\
  287. Col1, Row2 & Col2, Row2 & Col3, Row2 \\
  288. Col1, Row3 & Col2, Row3 & Col3, Row3 \\ \hline
  289. \end{tabular}
  290. \end{center}
  291. \end{table}
  292.  
  293. \newpage
  294.  
  295. \begin{table}[h]
  296. \caption[Third Table Shell]{Third Table Shell}
  297. \begin{center}
  298. \begin{tabular}[c]{lcc} \hline
  299. Column 1 & Column 2 & Column 3 \\ \hline
  300. Col1, Row1 & Col2, Row1 & Col3, Row1 \\
  301. Col1, Row2 & Col2, Row2 & Col3, Row2 \\
  302. Col1, Row3 & Col2, Row3 & Col3, Row3 \\ \hline
  303. \end{tabular}
  304. \end{center}
  305. \end{table}
  306.  
  307. \end{document}

When I run this code, the link on page 5 that should point to the first table shell (\S1) actually points to the first table in the body of the document. Interestingly, the problem doesn't seem to crop up if I use a {tabular} environment instead of longtable for the tables in the body. My actual document has a multi-page table in the body though. So I can't solve my problem that way. I'm also curious to know what is going wrong.

The second problem I'm struggling with is figuring out how to make my LoT look like a section with numbering. My understanding is that a LoT doesn't normally have this but I think it makes sense to have it in this particular context.

Any help with this would be greatly appreciated.

Thanks,

Paul
Last edited by localghost on Tue Oct 22, 2013 8:27 pm, edited 2 times in total.
Reason: Longer passages of source code are tagged as code block, not as in-line code.

Tags:

pjmiller_57
Posts: 20
Joined: Tue Nov 08, 2011 4:37 pm

Postby pjmiller_57 » Tue Oct 22, 2013 2:42 pm

Hi All,

Waited 4-5 days and then tried posting this elsewhere. Got a solution that worked both for my sample code and in my actual document.

The link to the solution is:

http://tex.stackexchange.com/questions/139893/incorrect-link-in-listoftables-after-setcountertable0

Thanks,

Paul

User avatar
localghost
Site Moderator
Posts: 9204
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Tue Oct 22, 2013 8:26 pm

pjmiller_57 wrote:[…] Waited 4-5 days and then tried posting this elsewhere. […]

You can simply bump a topic to bring it back to the focus of attention. Nevertheless, thanks for pointing out the solution.


Thorsten
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1


Return to “General”

Who is online

Users browsing this forum: No registered users and 8 guests