## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ List of Tables is clear

Information and discussion about graphics, figures & tables in LaTeX documents.
petmat
Posts: 3
Joined: Wed Jul 22, 2015 2:21 pm

### List of Tables is clear

Hello, I have a problem with \listoftables command. After I write in my document:

\addcontentsline{toc}{chapter}{List of Tables}\listoftables

there appears only List of Tables in the content and inside the document there a page with headline List of Tables, but otherwise the page is clear and no tables are listed. My tables includes \caption[short name]{long name}
inside the \begin{table}..\end{table}.
I don't know what I am doing wrong, anything like \cleardoublepage didn't help. The same happened for the List of Figures.
Thank you for any help!
Petra
Last edited by cgnieder on Sun Jul 26, 2015 1:18 pm, edited 1 time in total.
Reason: code markup added

Tags:

Johannes_B
Site Moderator
Posts: 4044
Joined: Thu Nov 01, 2012 4:08 pm
Hi and welcome,

with the amount of information given, it is really hard to take even a guess. Please try to prepare a minimal working example and post it here. The cause will be obvious for the helpers here.

Remember, you always need to LaTeX runs to make any changes appear in toc,lof, and lot.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

petmat
Posts: 3
Joined: Wed Jul 22, 2015 2:21 pm
Yes, sure, so this is how my document looks like:
\documentclass[12pt,a4paper]{report}\usepackage[latin2]{inputenc}\usepackage{graphicx}\usepackage{amsthm}\usepackage{amsmath} %for aligned environment\usepackage{longtable} % for abbreviations formating\usepackage{verbatim} % for comment environment\usepackage{listings} %for Attachments - code\usepackage{amssymb} %for cross sign\usepackage{float} %keep figure in fixes place\usepackage{bm} %for bold in math mode\usepackage[ps2pdf,unicode]{hyperref} \def\chapwithtoc#1                  {\chapter*{#1}\addcontentsline{toc}{chapter}{#1}  } \begin{document}\openright\pagestyle{plain}\setcounter{page}{1}\tableofcontents \include{preface}\include{chap1}   %here are the tables \addcontentsline{toc}{chapter}{List of Tables}\listoftables \openright\end{document}

and this is an example of one of my table in chapter 1:
\begin{table}  \centering  \caption[AIM analysis]{AIM analysis of electron density}  \begin{tabular}{|p{2.3cm}||p{1.9cm}|p{1.9cm}|p{2.2cm}|p{1.5cm}|}   \hline   Complex & Cl/O(OH) & O(H$_2$O) /N7(G) & N(Y) & N(NH$_3$)\\[2mm]     \hline \hline  \multicolumn{5}{|p{9.5cm}|}{Reactants}\\ \hline       DDP-Cl            &8,38  &8,47  &11,27$^a$ &12,48\\   DDP-OH            &12,46 &8,77  &10,41$^a$ &12,32\\ \hline  Pt-Tz-OH       &13,11   &10,53  &11,47  &11,97\\ \hline\end{tabular}    \label{table:aimPt_isol}\end{table}

As I said, the List of Tables appears in the content and there is a page with headline List of Tables, but the tables are not listed on the page.

Johannes_B
Site Moderator
Posts: 4044
Joined: Thu Nov 01, 2012 4:08 pm
Unfortunately, that is not a minimal working example as described in the link i gave above. Pasting the code and and removing the unknown openright i don't get any strange behaviour. I get a list of figures including the right entry.

Hint: Click on open in writelatex below to see what i see.
% arara: latex% arara: latex% arara: dvips% arara: ps2pdf\documentclass[12pt,a4paper]{report}%\usepackage[latin2]{inputenc}\usepackage{graphicx}\usepackage{amsthm}\usepackage{amsmath} %for aligned environment\usepackage{longtable} % for abbreviations formating\usepackage{verbatim} % for comment environment\usepackage{listings} %for Attachments - code\usepackage{amssymb} %for cross sign\usepackage{float} %keep figure in fixes place\usepackage{bm} %for bold in math mode\usepackage[%ps2pdf,%commented when using the online compilerunicode]{hyperref} \def\chapwithtoc#1                  {	\chapter*{#1}	\addcontentsline{toc}{chapter}{#1}  } 	\begin{document}%	\openright%undefined control sequence	\pagestyle{plain}	\setcounter{page}{1}	\tableofcontents %	\include{preface}	%\include{chap1}   %here are the tables	\chapter{walzing wombat}	\begin{table}		\centering		\caption[AIM analysis]{AIM analysis of electron density}		\begin{tabular}{|p{2.3cm}||p{1.9cm}|p{1.9cm}|p{2.2cm}|p{1.5cm}|}			\hline			Complex & Cl/O(OH) & O(H$_2$O) /N7(G) & N(Y) & N(NH$_3$)\\[2mm]			\hline \hline			\multicolumn{5}{|p{9.5cm}|}{Reactants}\\ \hline    			DDP-Cl            &8,38  &8,47  &11,27$^a$ &12,48\\			DDP-OH            &12,46 &8,77  &10,41$^a$ &12,32\\ \hline			Pt-Tz-OH       &13,11   &10,53  &11,47  &11,97\\ \hline		\end{tabular}    		\label{table:aimPt_isol}	\end{table} 	\addcontentsline{toc}{chapter}{List of Tables}	\listoftables %	\openright	\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.

petmat
Posts: 3
Joined: Wed Jul 22, 2015 2:21 pm
So, I have discovered the problem, after the \listoftables command I have command \include{attachments}. When I comment this and copy the content of the attachments into the main document, the tables are suddenly listed in the List of Tables page. I don't know why that matters, but, at least, it works.

cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm
I don't really understand the question but i take it from the thread that the main problem is solved, anyway?

I have some other suggestions for possible improvements, though:

You probably want to use this:
\clearpage\phantomsection\addcontentsline{toc}{chapter}{List of Tables}\listoftables

The \clearpage and the \phantomsection ensure that the hyperlink from the toc actually point to the right place in the document and not to the page before the list of tables.

Similarly the definition of \chapwithtoc:
\newcommand*\chapwithtoc[1]{%   \chapter*{#1}   \phantomsection   \addcontentsline{toc}{chapter}{#1}}

BTW: \def is a low-level TeX macro and if possible should be avoided in a LaTeX document. It's better to use LaTeX's \newcommand instead.

You also might be interested in the chemformula package for writing chemical formulae like water: \ch{H2O}.

Last but not least I also suggest taking a look at the siunitx package which not only is good for taking care of SI units but also for alignment of numbers in a table.

Personally I'd probably typeset the table something like this:

\documentclass[12pt,a4paper]{report}\usepackage[utf8]{inputenc} \usepackage{array}\usepackage{booktabs} \usepackage{chemformula}\usepackage{siunitx} \newcommand*\tnote[1]{\textsuperscript{\textit{#1}}} \begin{document} \begin{table}   \centering   \caption[AIM analysis]{AIM analysis of electron density. (\tnote{a} some     notes on these values\ldots)}   \label{table:aimPt_isol}   \begin{tabular}{       l       *{2}{S[table-format=2.2]}       S[table-format=2.2,table-space-text-post={\tnote{a}}]       S[table-format=2.2]     }     \toprule       Complex & {\ch{Cl/O(OH)}} & {\ch{O(H2O)/N7(G)}} & {\ch{N(Y)}} & {\ch{N(NH3)}} \\     \midrule       Reactants \\     \cmidrule{1-1}       \ch{DDP-Cl}   &  8,38 &  8,47 & 11,27\tnote{a} & 12,48 \\       \ch{DDP-OH}   & 12,46 &  8,77 & 10,41\tnote{a} & 12,32 \\       \ch{Pt-Tz-OH} & 13,11 & 10,53 & 11,47          & 11,97 \\     \bottomrule   \end{tabular}\end{table} \end{document}

table.png (28.78 KiB) Viewed 3914 times

Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim