82 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.

      • Sajjad

        I think he wants the word “Figure 1.1: A study” instead of “1.1 A study” which I am also trying to do but not yet successful.

      • tom

        Hi Sajjad,

        Thanks for the comment. Adding the following two lines does exactly what were looking for:

        \usepackage{tocloft}
        \renewcommand{\cftfigfont}{Figure }

        See here for a few more customizations.

        Best, Tom

      • bilal

        hi tom
        i have same problem of adding word figure and table in list of figure and also i need to add “:” after number of figure so i used this code:

        \renewcommand*\cftfigpresnum{Figure~}
        \settowidth{\cftfignumwidth}{\cftfigpresnum}
        \renewcommand{\cftfigaftersnumb}{\quad:~}

        but in multilines caption it is not align always seconde ligne start before the “:”
        if u can help? thanks

      • tom

        Hi Bilal,

        Below is a minimal working example that illustrates how to properly align multi-line text in the list of figures.

        Best, Tom

        \documentclass[11pt]{article}
        \usepackage[titles]{tocloft}
        \usepackage{blindtext}
        \newlength\mylength
        \renewcommand\cftfigpresnum{\figurename~}
        \renewcommand\cftfigaftersnum{:}
        \settowidth\mylength{\cftfigpresnum\cftfigaftersnum}
        \addtolength\cftfignumwidth{\mylength}
        \begin{document}
        \listoffigures
        \section{First}
        \begin{figure}[ht]
        \centering
        \rule{1cm}{1cm}
        \caption{\blindtext}
        \label{default}
        \end{figure}
        \end{document}
      • Bilal

        Thanks tom
        I had another pb of appendix
        I add new table of content for just appendix

        \begin{appendices}
        \startcontents[appendices]
        \printcontents[appendices]{l}{1}{\section*{annexes}
        \setcounter{tocdepth}{1}}
        \section{1st appendix}
        \section{2nď appendix}
        
        \end{appendices}

        I had perfectly my small toc of appendix but the pb is i want to remove all appendix from principale toc but i cant

  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.

  8. Pierre-Philippe Combes

    Hi Tom,
    Very useful post!
    I’ve an extra question. I have a pretty long table of contents that fits on one page and a few lines more on a second page. But spaces between each item are pretty large.
    Is there a way to reduce them, or an instruction to tell tex to fit the table of contents in one page only?
    Thank you very much.
    Pierre-Philippe

    • tom

      Hi Pierre-Philippe,

      If it’s only a few lines, you might use the spacing package:

      %Preamble
      \usepackage{setspace}
      
      %Document
      \begin{spacing}{0.9}
      \tableofcontents
      \end{spacing}

      Possibly a more satisfying alternative is to use the tocloft package and play with, for example, the space before each chapter entry.

      %Preamble
      \usepackage{tocloft}
      \setlength\cftbeforechapskip{6pt}

      Even if there was a way, I wouldn’t recommend forcing TeX to fit the ToC on a single page. What if you decide to add two more chapters a few weeks later…?

      HTH, Tom

  9. J.D.

    Hi, Tom,

    I’m a bit new to this and have had trouble applying these ideas to my table of contents — perhaps because mine is un-numbered? I’m using the book (AMS) document class and have tocloft, and as of now, the “part” and “chapter” entries in the table of contents are set to the same indentation level. I want to make things more obvious and have the “part” entries not indented, but the “chapter” entries intended a bit. Is there any way to do this? I’ve tried throwing some things into the Preamble that I thought might work, but I keep getting error messages about “}” not being there, or there being too many.

    If you have any ideas, it would be greatly appreciated!
    Thanks!
    ~J.D.

    • tom

      Hi J.D.,

      Thanks for your comment. It seems the ams document classes are not compatible with tocloft. But what you can do is manually redefine how ToC entries are typeset. Here is a MWE to change the chapter indentation:

      \documentclass{amsbook}
      \makeatletter
      \renewcommand{\l@chapter}{\@tocline{0}{3pt plus2pt}{10pt}{1.5pc}{}}
      %@tocline arguments
      %#1: sectioning level (chapter=0)
      %#2: vertical space before the entry
      %#3: indent of the entry (default 0pt)
      %#4: space for number
      %#5: style commands (e.g., font type/size)
      \makeatother
      \begin{document}
      \tableofcontents
      \part{First}
      \chapter{First chapter}\section{Some section}
      \chapter{Second chapter}\section{Some section}
      \part{Second}
      \chapter{First chapter}\section{Some section}
      \chapter{Second chapter}\section{Some section}
      \end{document}

      Hope this helps,
      Tom

    • tom

      Here is an example:

      \documentclass[11pt]{memoir}
      \renewcommand{\cftfigurefont}{Figure }
      \begin{document}
      \listoffigures
      \chapter{Some chapter}
      \section{Some section}
      \begin{figure}[ht]
      \centering
      \rule{0.4\linewidth}{0.4\linewidth}
      \caption{Some caption}\label{fig:def}
      \end{figure}
      \end{document}

      Please consider the memoir class documentation for more details.

      • Sajjad

        Thank you for your reply. But using \cftfigurefont requires me using the tocloft package. When i use that package the format of my table of contents changes which I can’t afford to do. Can I do it it without using tocloft package?? Please help.

      • tom

        This doesn’t require the tocloft package. The tocloft command is \cftfigfont. Memoir provides a lot of flexibility by implementing commands that are provided by packages for the standard classes. Just give the code I posted a try…

  10. Sajjad

    you are asking me to change the class. But that will change the whole format of my thesis which I have compiled according to my university guidelines. Currently I am using a class “ThesisMtech” which I have modified according to my need. I am just not able to get this “Figure 1.1” in place of “1.1” in list of figures and list of tables. Have been trying this for 15 days now. Kindly provide some solution. I can attach my class file if you want. Thank you.

    • tom

      For some reason I thought you were using the memoir class. I wonder if using tocloft and change the lof/lot style according to your needs might work.

      Please prepare a minimal working example and a pointer to where I can get the ThesisMtech class file (ideally the one you modified) and I’ll see what I can do.

      Best, Tom

  11. ranjana

    I want to resize heading “List of figure” and “List of tables”, default output using \listoffigure
    is large list of figure written at the header, I want to align in left side with underline in normal font size. How to do that?

    • tom

      Hi Ranjana,

      Here’s a minimal working example, which uses the tocloft package:

      \documentclass{article}
      \usepackage{tocloft}
      \renewcommand{\cftloftitlefont}{\normalfont\normalsize\bfseries\underline}
      
      \begin{document}
      \listoffigures
      \end{document}
      • Clement

        Hi Tom,
        whenever I use figure inserting format like below:

        \begin{figure}[h]
            \centering
            \includegraphics[scale = .85]{Dog.png}
            \caption{My dog}
           \label{fig:Dog1.png }
        \end{figure}

        and I also use the: \lstinputlisting{fish.m} for importing Matlab codes, there is always a problem; program will not execute, but if I use this format:

        \begin{center}
        \includegraphics[scale = .85]{Dog.png}
        \end{center}
        \[Figure 3.1: My dog]

        it will run and show my Matlab codes and the diagrams. The problem now is that when I try to use the listoffigures or listoftables command to generate my list of figures and list of table respectively, it can not display the list of figures, probably, since the caption command is not used in the

        \begin{center}
        \includegraphics[scale = .85]{Bush1.png}
        \end{center}
        \[Figure\: 3.1:\: A \:basic \:(SIR)\: model \:flow\: chart\]

        when inserting my my figures.
        so what do I do to enable diaplay my list of figures and tables.

      • tom

        You are right, the figure number will only be generated when it is wrapped in a floating environment (i.e. \begin{figure}...\end{figure}) and has a \caption.

        I wasn’t able to reproduce the issue with a Matlab input file (*.m). Could you provide a complete minimal working example. That would make it much easier for me to help.

        Thanks, Tom

  12. Ferhat

    First of all thank you for your sharings.

    On my report class document content of figures are like here:

    Figure 1.1 BWM Car……………………..5
    Figure 1.2 Ferrari Car……………………7

    But I want a suffix at the end of each number. I want like this:

    Figure 1.1. BWM Car……………………..5
    Figure 1.2. Ferrari Car……………………7

    *see the dot (.) after 1.1

    Also this dot (.) should be on each figure explanation. I will be happy if you can help me.

    Here is my all document temaplate: http://pastebin.com/UttcnKpY

    Thanks in advance.

    • tom

      All you have to do is add this line to your preamble. It redefines the figure number.

      \renewcommand{\thefigure}{\arabic{chapter}.\arabic{figure}.}

      HTH, Tom

  13. Leon

    Hi Tom.
    Thanks for the article, but I have a question.

    My paper have a lot of figures in the same chapter. When I compile the LateX, however, I get Figure number overlaping its title.

    I want to increase the spacing between the Figure number and the Figure title. Do you know how I do that?

  14. Zakaria CHOUQAR

    Lemme ask you dear Tom; I have this annoying problem with table of contents: I’m a beginner in Latex. When I add \tableofcontents command, Latex encounters issues with compiling. And I get “Undefined Control Sequence”.. Do I need a use package here or where lies exactly the problem?? Thank you.

    • tom

      You don’t need to load a package to use \tableofcontents. Thus, the issue is with something else. However, I won’t be able to help without your code. Could you post a minimal working example here.

      Thanks, Tom.

  15. Anggha

    Hi Tom, thanks for your post! Anyway, can you tell me how to add more horizontal space between the section’s number and its title? Cheers!

    • tom

      Hi Anggha,

      I assume you are referring to the table of contents. The code below let’s you change the space reserved for the section number. By default, chaptered document classes use 2.3em and others such as article 1.5em. For more details see the tocloft documentation.

      \usepackage{tocloft}
      \setlength\cftsecnumwidth{1.5em}

      Best, Tom

    • tom

      Long captions should automatically be wrapped in the list of figures and tables. Please provide a minimal working example for illustration of your problem and I’ll see what I can do…

      Thanks, Tom

  16. Laxmi

    In my report, till the table of contents pages are numbered in roman and after that full report is numbered in arabic. But i’m getting only arabic page no.s in the table of contents. Please give the code to solve this. i hope u got my problem

    • tom

      Hi Laxmi,

      It’d be easier for me if you sent a minimal working example. Here a code stab that illustrates how you can have roman page numbers in the lists and later arabic page numbers.

      \documentclass[12pt]{report}
      \begin{document}
      \pagenumbering{roman}
      \tableofcontents\clearpage
      \listoffigures\clearpage
      \listoftables\clearpage
      \pagenumbering{arabic}
      \chapter{Introduction}
      \end{document}
  17. poulose

    Dear Tom,

    I have used the \addcontentline to include the figures and tables in TOC using the code mentioned here.

    \addcontentsline{toc}{section}{\listtablename}
    \addcontentsline{toc}{section}{\listfigurename}

    I would also additionally like to list in it the TOC itself on the page.

    Also if it is of any help, the documentclass of article is used and the cover page, page, appendix are all roman numeral, but the main body of the report is arabic.

    I would like to include the TOC in the TOC page itself and also show the roman numerals page number as has been done for the above two sections which were added added.

    Please can you kindly suggest what can to be done to this end.

    Regards and Thank you,
    Poulose
    PS: (Used to work earlier when I used the amsart documentclass)

    • tom

      Hi Poulose,

      Here’s a minimal example that adds the contents heading to the table of contents and uses roman page numbering in the front matter.

      \documentclass[11pt]{article}
      \begin{document}
      \pagenumbering{roman}
      \addcontentsline{toc}{section}{\contentsname}
      \tableofcontents
      \addcontentsline{toc}{section}{\listtablename}
      \listoffigures
      \addcontentsline{toc}{section}{\listfigurename}
      \listoftables
      \clearpage
      \pagenumbering{arabic}
      \section{Introduction}
      \end{document}
  18. Jim Riker

    Tom,
    This is a really useful blog, thanks for setting it up. Here’s my problem: we are using tocloft.sty to generate the TOC, LOF, and LOT. The TOC comes out pretty nice, but there are no “dot leaders” for the main sections (like INTRODUCTION), although there are dot leaders for the subsections. Similarly for the LOF entry in the TOC, i.e., no dot leaders. How can I force LaTeX to include dot leaders on all entries in the TOC?

    Also, in the list of figures, the verbiage is bolded, and the report monitors want them unbolded. Can you help with these two issues? Thanks for your time!

    Jim

    • Never mind, I figured it out. The commands below will generate dot leaders for the LOF, the chapter leads, etc.

      \renewcommand{\cftpartleader}{\cftdotfill{\cftdotsep}} % for parts
      \renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}} % for chapters
      \renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}  % for sections

      I found this in another google search.

      For unbolding the LOF, just remove \bf from the caption of the figure. Interestingly, the caption is still bolded in the PDF file, but not in the LOF. Perfect.

  19. Dylan

    Hi Tom,

    Titles for non-numbered \chapter*{} entries that I add to my toc using \addcontentsline{toc}{chapter} (i.e. abstract, acknowledgements, nomenclature) appear indented compared to numbered chapter{} by about the same length that would be left between the chapter number and title. I would like all chapter titles, numbered or not to be flush with the left margin.

    Right now it looks like this:

    Table of Contents

    Abstract
    Acknowledgements

    List of Tables
    List of Figures
    Nomenclature

    1 Introduction
    2 Literature Review

    How can I remove this phantom distance between the left margin and non-numbered chapter titles, while leaving it for numbered chapters?

    Regards,

    Dylan

    • tom

      Hi Dylan,

      Thanks for your question. I can’t reproduce the issue with the information you provided. In the example below, starred and non-starred chapters are properly aligned. Please provide a minimal working example similar to the one below to illustrate the behavior.

      Thanks, Tom

      \documentclass[11pt]{report}
      \begin{document}
      
      \tableofcontents
      \clearpage
      \addcontentsline{toc}{chapter}{Abstract}
      \chapter*{Abstract}
      \chapter{Introduction}
      \chapter{Methods}
      
      \end{document}
  20. Michael

    Hi,

    I am writing a new thesis class for my university project, and I want to change the default chaptername {Chapter 1} to {CHAPTER ONE} with all words capitalized and would like it to be appended to toc as “CHAPTER ONE INTRODUCTION” for example, how do I go about the renewcommand.

    Thanks

    • tom

      Hi Michael,

      Thanks for your interesting question. The fmtcount package can “spell out” numbers. Below is a minimal working example, which more or less does what you asked for. You might have to change the spacing in the TOC. The tocloft package should do the trick.

      Let me know if you have any further question.

      Best, Tom

      \documentclass{report}
      \usepackage{fmtcount,etoolbox,fancyhdr,blindtext,tocloft}
      \pagestyle{fancy}
      \renewcommand\chaptername{CHAPTER}
      \renewcommand{\thechapter}{\NUMBERstring{chapter}}
      \renewcommand\cftchappresnum{\chaptername~}
      \newlength\mylength
      \settowidth\mylength{\cftchappresnum\cftchapaftersnum\quad}
      \addtolength\cftchapnumwidth{2\mylength}
      \addtolength\cftsecnumwidth{\mylength}
      \setcounter{tocdepth}{1}
      \begin{document}
      \tableofcontents
      \blinddocument
      \blinddocument
      \blinddocument
      \end{document}
  21. Blanca

    Hi Tom, what a wonderful blog!

    I am doing the thesis with tha classicthesis style, but I have introduced the publications at the end of the thesis and it doesn’t appear in the contents. I have included two lines right before \chapter*{publications}:

    \addtocontents{toc}{\protect\vspace{\beforebibskip}} 
    \addcontentsline{toc}{chapter}{Publications}

    Now it appears correctly, but when I press the link it doesn’t take me to the publications, but a few pages before.

    Also, I have done the same with the abstract but at the begining right after the acronyms. As in the case of the publications the link is incorrect, and at the top, instead of being written “abstract”, “acronyms” is written

    Thanks!!

    • tom

      Hi Blanca,

      Thanks for getting in touch. It’s difficult to help without seeing some code. Could you please provide a minimal working example.

      Btw, you might find the discussion here helpful.

      Best,
      Tom

  22. Tarun Parashar

    Hi Tom, How could i create a toc like

    ABSTRACT
    ACKNOWLEDGEMENT


    CHAPTER-1 ( 14 BOLD ALL CAP )
    CHAPTER TITLE ( 14 BOLD ALL CAP ) …………………………………1
    1. 1 SECTION TITLES ( 12 BOLD ALL CAP ) ………………………….3
    1.1.1 SUB-SECTION TITLE ( 12 BOLD ALL CAP ) …………………..5

    • tom

      Hi Tarun,

      Thanks for your question. You can patch the list commands to make them uppercase. This is shown here. The font size depends on your document font size. Approximate sizes and the corresponding macro can be found on this page.

      Best, Tom

  23. Maiki Mafessoli

    Boa noite. Estou tentando retirar a numeração da págia na lista de figuras, lista de tabelas e sumário. Fica aparecendo a numeração da parte inferior (rodapé) mesmo colocando \thispagestyle{empty}. O que posso fazer? Desde já agradeço.

    Good evening. I’m trying to pull a page numbering in a list of figures, a list of tables and a table of contents. The numbering of the bottom (footer) even appears by placing \ thispagestyle {empty}. What can I do? Thank you very much in advance.

    • tom

      Hi Maiki,

      \thispagestyle works for a single page only. Use \pagestyle{empty} instead, as shown in the example below.

      HTH,
      Tom

      \documentclass[11pt]{article}
      \usepackage{blindtext}
      \begin{document}
      \pagestyle{empty}
      \tableofcontents
      \clearpage
      \pagestyle{plain}
      \blinddocument\blinddocument\blinddocument
      \blinddocument\blinddocument\blinddocument
      \blinddocument\blinddocument\blinddocument
      \blinddocument\blinddocument\blinddocument
      \end{document}
  24. A7donso

    Hi

    What can be the reason that TOC,LOT,LOF appear in blank, i.e. there is a sheet with their corresponding title, but without entries. I have compiled many times the document, and no different results.

      • A7donso

        Hi,

        My main document is something like this:

        […]Code removed[…]

        I don’t know what i am doing wrong, TOC,LOF, and LOT are only sheets with title page but without any other thing. Thanks a lot.

      • tom

        Hi there,

        I removed your code, because it was impossible to debug. I’m happy to help if you provide a minimal working example that I can run on my system.

        Best, Tom

  25. Marie-Christine

    Hi Tom,

    What a great and very helpful blog!

    My problem refers to the numbering of pages in the table of contents.
    My table of contents is longer than one page.

    When the PDF is created, in the table of contents everything before the toc is page-numbered correctly, but everything after the toc has a wrong page number (lagged).
    In fact, the number of pages of the toc, lot and lof are not correctly counted, and each is treated as if they were only one page.

    The table of contents is 5 pages long, the list of tables is 5 pages long and the list of figures is 3 pages long – and they are counted as if they where only one page long)

    So for example what I see in the PDF wrongly shows:
    Abstract…….5
    Table of contents….7
    List of Tables….8
    List of Figures….9
    Introduction…..10

    Which is a mistake and it actually should have been:
    Abstract…….5
    Table of contents….7
    List of Tables….12
    List of Figures….17
    Introduction…..20

    I’m using this code to produce (unfortunately I wrote my entire thesis using Scientific Workplace which was a big mistake but now it is too late to change)

    \cleardoublepage
    \phantomsection \label{contents}
    \tableofcontents
    \addcontentsline{toc}{chapter}{Table of Contents}
    
    
    \cleardoublepage
    \phantomsection \label{listoftab}
    \listoftables
    \addcontentsline{toc}{chapter}{List of Tables}
    
    
    \cleardoublepage
    \phantomsection \label{listoffig}
    \listoffigures
    \addcontentsline{toc}{chapter}{List of Figures}

    Could you please help? I’d really appreciate it.

    Many Thanks,

    Marie-Christine

    • tom

      Hi Marie-Christine,

      Adding the list before creating them should fix the issue (see below). Alternatively, you can also load the tocbibind package. See the documentation for more details. I have no experience with Scientific Workplace, but this Q&A suggests that it shouldn’t be a problem to switch to standard LaTeX.

      All the best with your thesis!
      Tom

      \cleardoublepage
      \phantomsection \label{contents}
      \addcontentsline{toc}{chapter}{Table of Contents}
      \tableofcontents
      
      \cleardoublepage
      \phantomsection \label{listoftab}
      \addcontentsline{toc}{chapter}{List of Tables}
      \listoftables
      
      \cleardoublepage
      \phantomsection \label{listoffig}
      \addcontentsline{toc}{chapter}{List of Figures}
      \listoffigures
  26. Carlos

    Hi Tom,

    I am using the CSM-Thesis template for my master’s. The template can be easily found on internet.
    The problem that I have is when my list of figures is generated, the list keeps the long name and any modification that I try to use with \caption does not help at all. You can see the code that the template uses to call the figure and put the long name in the list of figure.

    \csmfigure[ht]{1_1}{figures/Fig_1_1}{4.9in}{Location map of the Neuqu\'en Basin in the west-central side of Argentina. The embayment zone of the Neuq\'en Basin is located in the detailed map on the right. Modified from \citet{EIA2015}.}

    The package used in this is also called \usepackage{csm-thesis} and probably the solution is modifying the code inside the package, but how could I fix this if I am not good coding in latex?

    Thanks,

    Carlos

    • tom

      Hi Carlos,

      Thanks for your question. I downloaded the csm-thesis template here. You can’t have a short caption for the list-of-figures using their csmfigure macro. Use the csmlongfigure macro instead, which is defined in csm-thesis.sty. The macro takes 6 arguments, where argument 5 is the short caption and argument 5 + 6 concatenated is the long caption. Here is the example from their template:

      \csmlongfigure{Strongbad}{figures/strongbad}{1in}{A world-class hero}{ of awesomeness~\cite{ref:Wikipedia}.}

      I hope this helps,
      Tom

  27. Hi Tom,
    I’m currently writing up my PhD Thesis using amsart, and I have an instance where my subsection is just a maths term. In order to make it boldfont to match all my other subsections, I’m using mathbf, however this makes the entry in the toc also bolded. As far as I can tell, using \subsection[toc name]{in work name} no longer exists, what else can I use?
    Cheers, Jos

    • tom

      Hi Jos,

      Thanks for your question. The simplest solution would be to suppress the subsection from being added to the TOC and then add it manually.

      HTH,
      Tom

      \documentclass[12pt]{amsart}
      \usepackage{amsthm}
      \begin{document}
      \tableofcontents
      \section{Intro}
      \subsection{First}
      Some content
      \subsection{Second}
      Some content
      \addtocontents{toc}{\protect\setcounter{tocdepth}{0}}
      \subsection{$\mathbf{abc}$}
      Some content
      \addtocontents{toc}{\protect\setcounter{tocdepth}{3}}
      \addtocontents{toc}{\protect\contentsline{subsection}{\thesubsection.\hspace{.5\linespacing} abc}{}}
      \subsection{Third}
      \section{Methods}
      \end{document}
  28. Ahmed

    Hi Tom,
    I have one request. In my thesis I wrote Abstract and Acknowledgments after my title page and beforeTOC while abbreviations after LOT and before the first chapter. Now how to insert Abstract, Acknowledgments, and abbreviations in TOC? I used, for example, \addcontentsline{toc}{chapter}{\numberline{}Acknowledgements}..but it yield wrong numbering of Acknowledgements and says that Acknowledgements lie on the same page number as TOC!
    Any help will be appreciated,
    Thanks,
    Ahmed

    • tom

      Hi Ahmed,

      Below is a minimal working example that shows how to get the page numbers in the TOC right. Abbreviations works accordingly.

      Best, Tom

      \documentclass[11pt]{report}
      \usepackage{blindtext}
      \begin{document}
      \addcontentsline{toc}{chapter}{Acknowledgements}
      \chapter*{Acknowledgements}
      \blindtext
      \clearpage
      \addcontentsline{toc}{chapter}{Abstract}
      \chapter*{Abstract}
      \blindtext
      \clearpage
      \tableofcontents
      \clearpage
      \blinddocument
      \end{document}
      • Nada

        Hi,

        I need to add two headings(Title, Page) into the table of content page.

        Can you suggest a simple method?

        Thank you

      • tom

        Hi Nada,

        You can use the macro: \addcontentsline{list}{level}{text}. Place the macro before the actual heading.

        You’ll find a minimal example below.

        Cheers, Tom.

        \documentclass{report}
        \begin{document}
        \tableofcontents
        \addcontentsline{toc}{chapter}{Heading 1}
        \end{document}
  29. Dev

    Hi Tom…

    In my dissertation, the table of contents heading is showing up on only two pages. It does not show up in the third page. How to add table of contents (continued) in third page. Also in the list of contents bibliography is the last one and it does not have the dots between the content name and the page number. For ex: it should be Bibliography……………90 but it is showing Bibliography 90. How to add the dots between them? Please suggest a simple way. Thanks.

Leave a Reply