1

I have a problem with List of Tables. It doesn't appear in my document.

The .cls file is HERE.

Document:

\documentclass[thesis=B,czech]{FITthesis}[2012/06/26]

\usepackage[utf8]{inputenc}

\usepackage{graphicx}
\usepackage{longtable}

\department{text}
\title{text}
\authorGN{text}
\authorFN{text}
\authorWithDegrees{text}
\supervisor{text}
\acknowledgements{text}
\abstractCS{text}
\abstractEN{text}
\placeForDeclarationOfAuthenticity{text}
\declarationOfAuthenticityOption{1}
\keywordsCS{text}
\keywordsEN{text}

\usepackage{chngcntr}
\AtBeginDocument{
  \counterwithout{figure}{chapter}
  \counterwithout{table}{chapter}
  \renewcommand\thefigure{\arabic{figure}}
  \renewcommand\thetable{\arabic{table}}
}
\begin{document}

\begin{introduction}
    %
\end{introduction}

\chapter {First}

text

\begin{figure}[h]
  \caption{Function.}
  \label{fig:function}
\end{figure}

\begin{center}
    \begin{longtable}{ c | c | c }
        $1$ & $2$ & 3 \\ \hline
        \caption{tab}
\label{tab:tab}
    \end{longtable}
\end{center}

\begin{conclusion}
    %
\end{conclusion}

\appendix

\end{document}
  • 3
    That's because for a List of Tables to appear, you need \listoftables somewhere in your document (and compile at least twice on the first go). – Werner Sep 9 '13 at 4:46
  • @Werner that's true for standard classes and KOMA, and memoir and many others, but not for the class used in the question. Please see my answer below. – Gonzalo Medina Sep 9 '13 at 13:14
  • @GonzaloMedina: My suggestion is still true though. There seems very little gain in the automation of \listoftables when there are so many other ways of doing it. 13 characters is okay every now and again. – Werner Sep 9 '13 at 13:54
3

The class FITthesis.cls doesn't require an explicit use of \listoftables, since it tries to detect whether the list should be automatically generated or not.

The problem is that the mechanism used to do the automatic detection is not very good, since it's based on the detection of the environment and not on the caption type. If the table environment was used in the document, then the LoT will be produced; otherwise, no list is generated.

This is clearly wrong, since one can have tables with captions not associated with the table environment (one could have longtable, or threeparttable, or \captionof{table}{...}).

For the list of tables, one finds in FITthesis.cls:

\AtEndEnvironment{table}{\gdef\there@is@a@table{}}
\AtEndDocument{\ifdefined\there@is@a@table\label{tab:was:used:in:doc}\fi}
\DeclareRobustCommand{\listoftablescond}{\@ifundefined{r@tab:was:used:in:doc}{}{\listoftables*}}

and this means, as I said before, that the LoT will only be generated if table was used in the document.

Since in the MWE table was not used, the LoT is not produced, even though longtable was present. This is clearly a bad design choice that should be corrected by the author/maintainer of the class. If automatic generation is to be done, then the mechanism must be base on the captions, not on specific environments.

One could explicitly invoke \listoftables in the document, but the, as soon as table is used one will end up having two lists of tables.

The best solution here, while the author/maintainer of the class corrects the issue, is to register also longtable for the automatic generation of the LoT, using:

\makeatletter
\AtEndEnvironment{longtable}{\gdef\there@is@a@table{}}
\makeatother

A complete example:

\documentclass[thesis=B,czech]{FITthesis}[2012/06/26]
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{longtable}

\makeatletter
\AtEndEnvironment{longtable}{\gdef\there@is@a@table{}}
\makeatother

\department{text}
\title{text}
\authorGN{text}
\authorFN{text}
\authorWithDegrees{text}
\supervisor{text}
\acknowledgements{text}
\abstractCS{text}
\abstractEN{text}
\placeForDeclarationOfAuthenticity{text}
\declarationOfAuthenticityOption{1}
\keywordsCS{text}
\keywordsEN{text}

\usepackage{chngcntr}
\AtBeginDocument{
  \counterwithout{figure}{chapter}
  \counterwithout{table}{chapter}
  \renewcommand\thefigure{\arabic{figure}}
  \renewcommand\thetable{\arabic{table}}
}
\begin{document}


    \begin{longtable}{ c | c | c }
        $1$ & $2$ & 3 \\ \hline
        \caption{tab}
\label{tab:tab}
    \end{longtable}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.