14 Comments

  1. Giannis

    Hi Tom, I would like to ask how could we add a short table of contents which will contain only the chapters’ name.

    • Add \setcounter{tocdepth}{0} to your preamble. The tocdepth counter controls the level of headings added to TOC (0: chapter, 1: section, etc.).

  2. Hi Tom, Excellent article on TOC.
    One question I have is, is there a way to suppress the toc title, i.e. ‘Contents’ as I am already using a fancyhead

    \fancyhead[RO,RE]{\includegraphics[width=1.5cm]{logo.pdf}}

    to generate title headers and the toc title overwrites the fancyhead?

  3. Romain

    Hi Tom,

    I’m using hyperref for my TOC. The issue I have is that the link is only on the chapter title and not the whole line. Because I also would like that if I click on page number, then I’m directed to that page.

    Thanks for your support.
    Rom

    • Hi Romain,

      There is an package option which does exactly that. See the hyperref documentation for more details.

      \documentclass[11pt]{article}
      \usepackage{blindtext}
      \usepackage[linktoc=all]{hyperref}
      \begin{document}
      \tableofcontents
      \blinddocument
      \end{document}
  4. Igor

    Hi Tom, I need to obtain this on my LOF in the pdf file:

    ex: Figure 1 akudfkadgubkadjbvadivbakidbvadivblaidvblaidvblaivblai
    akbadkvibadlivbadivladivbladivladivbaldivlaihlaidbldibnl
    aivladivlaidvb……………………………………………………………..1

    I’m sorry if became a little confuse but I’m brazilian.

    Thanks

    • Hi Igor,

      You’ll have to be a little more specific what your question is about, e.g. no line-breaks in long captions. Please also give a minimal example to illustrate the problem.

      Thanks, Tom.

  5. Hi Tom, I found your blog when I was looking for any answers about how not enumerate the page of lof/lot/loc? \pagestyle{empty}, \thispagestyle{empty} didn’t work as well.
    Thanks

    • Hey Ricky,

      Try the following:

      \documentclass[11pt]{report}
      
      \begin{document}
      \pagenumbering{gobble}
      \tableofcontents
      
      \listoffigures
      
      \listoftables
      \clearpage
      
      \pagenumbering{arabic}
      \chapter{Test chapter}
      \section{Test section}
      
      \end{document}
  6. James

    Hi Tom,

    I am trying to follow your example above. I want the LOF and LOT entries in the TOC to be sections. As it is below.. I get two LOF and LOT entries in the TOC (one as a section, one as a chapter) yet the hyperlink on the section entry is wrong??? Thanks

    \usepackage{tocloft}
    \newlength\mylena
    \settowidth\mylena{Figure}
    \newlength\mylenb
    \settowidth\mylenb{Table}
    \addtolength\cftfignumwidth{\mylena}
    \addtolength\cfttabnumwidth{\mylenb}
    \renewcommand\cftfigpresnum{Figure }
    \renewcommand\cfttabpresnum{Table }
    
    \tableofcontents
    \cleardoublepage
    
    \clearpage %\cleardoublepage %for openright
    \addcontentsline{toc}{section}{\listfigurename}
    \listoffigures
    \clearpage %\cleardoublepage %for openright
    \addcontentsline{toc}{section}{\listtablename}
    \listoftables
    \clearpage %\cleardoublepage %for openright
    • Hi James,

      Thanks for this question. You can use a little trick, by adding phantomsection before addcontentsline, the links are set properly.

      Best, Tom

      \documentclass[11pt]{report}
      \usepackage{tocloft}
      \usepackage{hyperref}
      
      \begin{document}
      
      \tableofcontents
      \cleardoublepage
      
      \clearpage %\cleardoublepage %for openright
      \phantomsection
      \addcontentsline{toc}{section}{\listfigurename}
      \listoffigures
      \clearpage %\cleardoublepage %for openright
      \phantomsection
      \addcontentsline{toc}{section}{\listtablename}
      \listoftables
      \clearpage %\cleardoublepage %for openright
      
      \end{document}
  7. James

    Great thanks Tom. I now have an issue with the sectioning…. The chapters are labeled correctly e.g Chapter 1, Chapter 2…
    But the sections are also labelled section 1, section 2 … not section 1.1, 1.2

    Weirdly the subsections are labelled 1.1 and the figures/tables are also labelled 1.1,1.2 etc

    Would really appreciate any help

    \usepackage[nottoc]{tocbibind}    % Potentially important for sectioning
    
    \renewcommand\thesection{\arabic{section}}  % very important for structure ?
    \pagenumbering{roman}
    \doublespacing
    \baselineskip=15.5pt
    
    \tableofcontents
    \cleardoublepage
    
    \listoffigures
    \cleardoublepage
    
    \listoftables
    \cleardoublepage
    
    \baselineskip=20pt
    \pagenumbering{arabic}
    \renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \thechapter:\ #1}{}}
    \renewcommand{\sectionmark}[1]{\markright{\S\thesection\ #1}}
    
    \renewcommand\thesection{\arabic{chapter}}
    • Hi James,

      It’s the second line of your code where you define sections to be labeled with just the section number instead of chapter and section. Also, delete the last line. I’m not sure why you change it there. Commenting it out should fix the problem. Alternatively, you could replace it with:

      \renewcommand\thesection{\thechapter.\arabic{section}}

      Also, please provide a full minimal working example next time. It’s much easier to reproduce your issue that way.

      Cheers, Tom.

Leave a Reply