459 Comments

  1. iliana

    Hi! I had a problem with the \listoffigures comand while I was writting a document in spanish; I would like that in the document appears Lista de Figuras, instead List of Figures, what can I do? Thank you very much for any help you can give me

  2. Hi there,

    You can change the title as follows:

    \renewcommand\listfigurename{Lista de Figuras}
    \listoffigures

    Similarly, you can change “Table of Contents” (\contentsname) and “List of Tables” (\listtablename).

    You might also want to consider changing you whole document language to Spanish:

    \usepackage[spanish]{babel}

    Which not only renames “List of Figures” to “Indice de figuras”, but uses Spanish hyphenation, etc.

    • Hi,
      I tried that and it does change the title of the section “List of Figures” to “Lista de figuras”, but the entry in the Table of Contents is still “List of figures”.

      How can I change the name of the entry inside the Table of Contents?

      Thanks

      • Hi!

        You have to manually add it to the table of contents. By the way, loading the babel package with the option spanish automatically changes the names. Have a look at the minimal working example below:

        \documentclass[12pt]{report}
        \usepackage[spanish]{babel}
        \begin{document}
        \tableofcontents
        \addcontentsline{toc}{chapter}{\listfigurename}
        \listoffigures
        \chapter{First}
        \begin{figure}[ht]
        \centering
        \rule{4cm}{3cm}
        \caption{Figure placeholder.}
        \end{figure}
        \end{document}

        Best, Tom.

      • Hi!
        I tried that but it just creates another entry in the Table of Contents, which doesn’t point to any page (you click on it an nothing happens). Also, another “List of figures” entry appears, so I have that entry twice: one in spanish and the other in english. I already used the babel package and still doesn’t work. My code is the following:

        \lhead{\emph{Índice general}}
        \tableofcontents
        \addcontentsline{toc}{chapter}{\listfigurename}
        \listoffigures
        \lhead{\emph{List of Tables}}
        \listoftables

        Thanks for your help!

      • Please provide a complete minimal working example. The question you had before was different or did I misunderstand something? If you want to cross-link the chapters in the table of contents, load the hyperref package after loading all the other packages in your preamble.

        Cheers, Tom.

  3. Andrey

    Hello!

    Thanks for the useful information on Latex.
    I had a problem with \listoffigures.
    Basically, when I generate the list, it does not include the captions for thos figures tha are composed by several subfigures…
    Any help will be much appreciated.
    Regards!

  4. Hi Andrey,

    Good question indeed. The answer is astonishingly easy. You just need to change the list-of-figure depth to 2 before generating the list:

    \setcounter{lofdepth}{2}

    By the way, if you want numbers instead of (a), (b) and (c), you would need to change \thesubfigure command. E.g.:

    \renewcommand{\thesubfigure}{\thefigure.\arabic{subfigure}}

    Does this answer your question?

    Cheers,
    Tom

  5. Axel

    Hi,
    I’m preparing a book and have more than 9 chapters and more than 9 figures in those chapters. Hence, the figure numbers look like XX.XX and they are so wide that they touch the titles in the list of figures. How can I increase the width for the numbers allocated in the list of figures?

    Many thanks in advance,
    Axel.

  6. Salut Axel,

    Here is how you can increase the space between the number and the caption in your \listoffigures. Add the following two lines before your \begin{document}:

    \usepackage{tocloft}
    \setlength{\cftfignumwidth}{3em}

    With the tocloft-package you can control the design of table of contents, figures and tables.

    Cheers,
    Tom

    • Kathleen

      Thank you for this!! I know this is like 3 years old and you might not even see it, but I’m trying to get my dissertation turned in and this was the last formatting problem I had, and now it’s fixed and I can go to bed!

      • Jon

        Ditto Kathleen– I’m just finishing my thesis and this was one of the last things I had to fix. Thanks for the help!

    • John Stasko

      It doesn’t seem to work for me.

      Firstly, it doesn’t change my \tableofcontents, but that’s not where the real problem lies. It’s in my \listof{diagrams}{List of Diagrams}, since I’m using the float package.

      I’ve got the following packages loaded, maybe it’s too much:
      float, tocbibind, tocloft.

      Thanks!

      • John Stasko

        Well my solution for now was to insert some hard spaces “\ \ ” into the caption for the diagrams.

      • Hey John,

        The solution I gave was specifically for the space available for figure numbers in the list-of-figures. If you have the same issue in the tableofcontents, say with section, the command would be:

        \setlength{\cftsecnumwidth}{3em}

        You can find a complete list in the tocloft documentation.

        Now when it comes to a custom list that you define yourself, that’s a completely different story. If you provide a minimal example, I will try my best to help.

        Best, Tom.

  7. Lydia

    Great website, your tips are very helpful.

    I have a random question — is there a way to suppress page numbering on your List of Tables? I want the page numbers for the actual tables in the list, I just need to start my whole document’s page numbers after the table of contents, etc. I was able to suppress page numbering for the Table of Contents and List of Figures using the fancyhdr package and this code:

    \fancypagestyle{plain}{
       \fancyhf[]{}
    }
    \renewcommand{\headrulewidth}{0pt}

    but that doesn’t seem to work for the tables.

    Thanks!
    Lydia

  8. Hi Lydia,

    Sorry for my late reply. Actually, you can suppress the page numbering on individual pages with the following command:

    \thispagestyle{empty}

    The page-style of the next page will not be affected.

    What you actually did with the fancyhdr package was not setting any header nor footer and set the line seperating the header and footer from the actual content to zero. So I am surprised you still got page numbering on your list of tables.

    Hope this will work,
    Tom

  9. Monti

    Hi, I want to have a listoffigures, so that the list begins like this:

    1.1. Figure A…………(p.20)
    1.2. Figure B…………(p. 30)

    and so forth.

    Right now, in Latex, I get the following for my list of figures:

    1.2.1. Figure A…….(p.20)
    1.2.2. Figure B…….(p.30)

    How can I get rid of the extra .1 and .2?

    • Tom

      Put the following before your \begin{document}:

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

      Remove the following from wherever you do not want to restart the second number at 1.

      \setcounter{figure}{0}
  10. Peto

    Hi,

    is it possible to make Latex use only part of the caption in the figure. Like 1st sentance so that the list of figure is concise and the figure can have longer captions.

    Cheers,
    Peto

  11. Hi Peto,

    This can be done by using square brackets with the text you want Latex to show in the list of figures, before the actual caption text:

    \caption[list-of-figure text]{actual caption text}

    Cheers,
    Tom

  12. Kate

    Hello,

    I am using a custom thesis.cls to write my thesis. I want to number all pages of the front matters, i.e. the Acknowledgment then Table of Content, List of Tables, list of figures and abstract in roman numerals. Then i start my chapter.1 at page 1 (arabic numerals)
    I managed to start my chapter.1 correctly by placing the command \pagenumbering{arabic}
    just before Chapter 1. However, when i put \pagenumbering{roman} before the Acknoweldgment page, I get only this page in roman “i”, but the others starting from the ToC, all get arabic numerals. When i repeated the command in top of the abstract i was able to get that page to start at “i” but does not continue the counter from prevoius pages. I am now stuck with ToC, LoF and LoT.

    Can you help?

  13. Hi Kate,

    Thanks for your comment. The solution to your problem is easy, but not really obvious. What you do is insert a \newpage after your last page having roman numbering. E.g.:

    \pagenumbering{roman}
    \tableofcontents
    \listoffigures
    \newpage
    \pagenumbering{arabic}

    Hope it works now,
    Tom

  14. Vivek

    I need the word chapter (e.g., ‘Chapter 1: … )’ to appear in my table of contents. However, my thesis file only produces a list of numbers such as

    1 Introduction
    1.1 Motivation
    1.2 Previous work
    2 Algorithm

    Instead I need
    Chapter 1: Introduction and so on…
    The usual chapters are all fine and produce a ‘Chapter x’ heading but just the table of contents does not have the word Chapter x :
    Would appreciate suggestions..
    Thanks

  15. Hi Vivek,

    Do this:

    \usepackage{tocloft}
    \renewcommand{\cftchapfont}{Chapter }

    The line above will add the word “Chapter” before the number in your TOC. Don’t forget the white space, otherwise the number will follow just after “Chapter”.

    Best regards,
    Tom

  16. Andreu

    Hi,

    I would like to ask some questions.

    First of all, instead of numbering the tables like : 1.1 , 1.2 , 1.3 ,…, 2.1 ,.., 3.1
    I would like to number them with integer and consecutive numbers. Moreover, I would like to keep the numeration between chapters. That is to say, if I end one chapter with table 6, I would like to have table 7 in the following chapter, avoiding to begin again with table number 1.

    My last question is, how can I start to numerate my chapter 1 with the page number 1. I managed to start numbering in my chapter number 1, with the command \thispagestyle{empty}, but it starts with the number 5. Is it possible to change it?

    Thanks a lot.

  17. Hi Andreu,

    You have to redefine the table counter (\thetable) as follows:
    Define your own counter.

    \newcounter{mytable}

    Tell Latex to replace the existing table counter with your new counter “mytable” and increase it everytime you use it.

    \renewcommand{\thetable}{\addtocounter{mytable}{1}\themytable}

    To answer your second question, you can set the page counter to any value:

    \setcounter{page}{1}

    Cheers,
    Tom

  18. kobby

    Hello,
    I am using Latex and I have a question.
    I would like the Table of contents to appear as Table of Contents but not only Contents.

    I used the following code.

    \pagenumbering{roman}
    Acknowledgement,
    abstract
    \tableofcontents
    \listoffigures
    \newpage
    
    \pagenumbering{arabic}

    can this be done.
    Thanks

  19. Hi Kobby,

    There is already a comment on this topic (see comment by iliana above):
    What you would have to add before your TOC:
    \renewcommand\contentsname{Table of Contents}

    Cheers,
    Tom

  20. Andreu

    Hi,

    First of all, I would like to thank you for your piece of advice. But I still have problems with the tables. I defined my own counter, and I succeed in numbering my TOC with integer numbers, but now the captions of the tables don’t match with them. Do you know if it’s possible to solve it?

    Thanks again for your time.

  21. Hi Andreu,

    I don’t exactly understand your problem. The tables should not appear in your TOC, did you mean the list of tables?
    If I use the command I proposed above, I get the caption number as I understand you want them to be (integer values continuous over all chapters). If the number does not match with the number in the LOT, try to typeset (generate the PDF) twice, so Latex can update the LOT.

    Let me know if it still doesn’t work,
    Tom

  22. Andreu

    Hi Tom,

    I’m sorry, you were right, I was referring to the list of tables.
    My problem is that using your proposed command, I get, in the list of tables and the table labels, integers values continuous over all the chapters but they don’t match with the table captions, which are set randomly. I’ve tried to typeset more than twice, but it doesn’t work yet.
    Perhaps, the problem is that I’m not using your command in a properly way.

    Thanks again in advance.

  23. Anne

    Hello,
    Talking about List of Figures I want to change the numbering of the figures.
    Right now it looks like 2.1,2.2,2.3,3.4,3.5…
    So when I start a new chapter the first numbe ris increasing for the next figure but also the second number is. I want the second number to start again from 1..
    How can I do that?

  24. Anne

    Okay I found the problem,
    I somehow had a \renewcommand included that changed the order!
    That happens when you don’t start from the scratch :-D
    Thx

  25. Susan

    Hi,

    I am writing my thesis at the moment and as it looks today,
    I will probably need latex-help from time to time.
    Today I do not understand, why my lists (listoftable and listoffigures) do not occur in the table of content. I already added [bibtotoc] to the document properties, but that only brought the references into the content. Would be great if someone had an idea.

    I am using:
    \documentclass[a4paper,10pt,twoside,bibtotoc]{scrartcl}

  26. Hi Susan,

    Usually, if you want to add something to the table of contents (TOC), you can use “addcontentsline”, e.g.

    \listoffigures\addcontentsline{toc}{section}{List of figures}

    The first command produces the list of figures and the rest adds it to the TOC.

    Now if your list of figures spans more than one page, Latex will automatically use the last page number in the TOC, which is usually not wanted. There is another package which I would suggest you to use called
    tocbibind.

    Hope this works out.
    Good luck with your thesis!
    Tom

    • Bimal Naik

      Hi, Tom
      Thanks to you for such nice & needful reply.Your reply is solve my problem of adding list of table & figure entry to TOC.

  27. Jakob

    Hi, thanks for all the tips here! Very useful.

    I’m trying to add an entry for the lot and lof to my toc. I’ve done \listoffigures\addcontentsline{toc}{section}{List of figures} but this returns the last page of the lof rather than the first. I can see why LaTeX would do that, but I don’t know how to solve it to take the lof’s first page. It takes the one before the lof if I put \addcontentsline before \listoffigures. Any thoughts?

    Cheers,
    Jakob

  28. Hi Jakob,

    Susan had a related question. I would suggest you use tocbibind.
    E.g.:

    \usepackage[nottoc]{tocbibind}

    If you don’t want the TOC to be listed in itself. Tocbibind will add almost everything to the TOC by default.

    Cheers,
    Tom

  29. Jenny C

    One more quick question, how do I maintain the caption in my list of tables/figures, but not include it in the document itself where the figure is? The output I get now when I type \caption{} is “Figure 1.1:” I’d like to get rid of the colon waiting for text…

  30. Hi Jenny,

    You can solve your problem using version 3 of the caption package:

    \usepackage[labelsep=space]{caption}

    If you don’t have the latest version of caption, the obsolete package caption2 can also solve the problem.

    usepackage{caption2}
    \renewcommand\captionlabeldelim{}

    Which basically set the label delimiter to nothing.

    Cheers,
    Tom

  31. Moosa

    Hi,
    I am wondering If I want to exclude on of the tables or figures from appearing in the List of tables or figures. Like I am using table environment to virtually format something and I don’t want this virtual table to appear in List of Tables at the begninng.

    Thanks

  32. Hi Moosa,

    You can exclude captions from your LOF and LOT by adding the following two lines to your document, one before the figure/table you want to exclude and the other after:

    \captionsetup[figure]{list=no}
    ...
    \captionsetup[figure]{list=yes}

    Cheers,
    Tom

    • Phil

      Moosa (and others),

      To exclude a specific caption, I found that you can just leave the first argument in the caption blank. The \captionsetup[figure]{list=no} didn’t work for me. Try:

      \caption[]{X versus Y}

  33. Roxanna

    Hi!

    Great blog! Very helpful!

    I have a question about making the captions shorter in the list of figures. Do I just add \caption[]{} where I have all the other information in the text about the figures, or do I have to add something else?

    Thanks!

  34. luzmara

    Hi,
    I need the word table and figure (e.g., ‘Table 1. … Figure 1.)’ to appear in my list of tables and figures. However, my thesis file only produces a list of numbers such as

    LIST OF TABLES

    1 XXXXXX ……… 5
    2 YYYYY ………… 8

    LIST OF FIGURES

    1 TTTTTTTTT…….12
    2 ZZZZZZZZ…….30

    Instead I need
    Table 1. XXXXXXX………5
    and
    Figure 1. TTTTTTTTTTTT………12

    The usual tables and figures are all fine and produce a ‘Table x’ and ‘Figure t’ heading but just the list of tables and figures does not have the word Table x. and Figure t.

    Would appreciate suggestions..
    Thanks

  35. Maggie

    Hi. thank you for your useful and easy-to-follow info. I just wonder if I want to put “Table” and “Figure” these words into my lists of figures and lists of tables, what should I do? I’ve tried \isucaption, but it gives me an error message. by the way, I defined mine like this…

    \usepackage[isu,small,bf,up]{caption2}

    Many Thanks in Advance.

  36. Hi Maggie,

    “isu” is not really a valid option of the caption2 package. All options are listed in the documentation on page 3:
    http://www.cs.brown.edu/system/software/latex/doc/anleitung.pdf

    Anyway, I am not sure if \isucaption is able to do what you want. I propose you try tocloft, which is a powerfull package to customize your TOC, LOF and LOT.
    Here is how to add “Figure” and “Table” in front of each LOF/LOT entry:

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

    Cheers,
    Tom

  37. Hi,
    I am writing my thesis using LATEX and I have used \listoffigure to generate a list of figure. Here is the outcome,

    List of figures
    1.1 This is a bird in chapter 1………1
    1.1 This is a pig in chapter 1………12
    2.1 This is another bird in chapter..33

    But rather, I need my list of figure to be presented in the numbering order as follow:

    List of figures
    fig.1 This is a bird in chapter 1………1
    fig.2 This is a pig in chapter 1………12
    fig.3 This is another bird in chapter..33

    I have used:

    \addcontentsline{toc}{chapter}{List of Figures}
    \listoffigures

    to add the list of figures and

    \begin{figure}[h]
    \begin{center}
    \label{pageoffig1}
    \includegraphics[width=13cm]{abc.jpg}
    \caption {\this is abc}
    \end{center}
    \end{figure}

    to add image in my thesis. So what command should i add in order to make what i want? Thanks

  38. Hi Ken,

    There are two possibilities to solve your problem:
    1. Remove the keyword “Figure” which is printed before your caption and add the follwoing code (see below how this is done).

    \newcounter{myfigure}
    \renewcommand{\thefigure}{\addtocounter{myfigure}{1}fig.\themyfigure}%

    2. The easier way would be to use the “tocloft”-package:

    \usepackage{tocloft}
    \renewcommand{\cftfigfont}{fig.}
    \newcounter{myfigure}
    \renewcommand{\thefigure}{\addtocounter{myfigure}{1}\themyfigure}%

    Using the above code will obviously produce “fig.X” in your LOF and “Figure X:” in your captions. If this is not what you want, you would have to manually change the keyword for your captions.

    This is done using the following after your \begin{document}:

    \renewcommand{\figurename}{fig.}

    Cheers,
    Tom

  39. Maggie

    Hello Tom,

    Thank you so much for your reply. I actually tried that earlier, but it gives me an error message

    \newcounter{lofdepth}\setcounter{lofdepth}{1}

    I guess it is because I use \setcounter{lofdepth}{2}.

    Actually, now I face another problem – I want to add “Appendix” word into my Table of content. Do you also know any easier way? I tried to change it manually, but it mess up all my figures…

    Thank you again so much for your lovely help xxxxxxxxxxxxx

  40. Hi, Tom,
    Thanks for your answer. When I insert

    \usepackage{tocloft}
    \renewcommand{\cftfigfont}{fig.}
    \newcounter{myfigure}
    \renewcommand{\thefigure}{\addtocounter{myfigure}{1}\themyfigure

    before \begin{document}, I find that all the figure no. mess up. Do I need to add a line in between:

    \begin{figure} [h]
    \begin{center}
    \label{pageoffig1}
    \includegraphics[width=13cm]{abc.jpg}
    \caption {\this is abc}
    \end{center}
    \end{figure}

    so as to fix this problem. Many thanks!
    Cheers
    Ken

    • Hi Ken !!

      Please, I need help !

      What did you do to fix the that wrong figure numbering ?

      I use the code:

      \usepackage{tocloft}
      \renewcommand{\cftfigfont}{fig.}
      \newcounter{myfigure}
      \renewcommand{\thefigure}{\addtocounter{myfigure}{1}\themyfigure

      And, in fact, every figure number is crazy, I mean: By now Figure 1 is Figure 38, Figure 2 is Figure 42, Figure 3 is Figure 47 and so on. I don’t know what to do.

      Please, let me know what did you do..

      Thank you in advance….

      • Well, I’ve found a solution: (Actually I’m not sure about how, but it works fine)

        Just take this line away:

        \renewcommand{\thefigure}{\addtocounter{myfigure}{1}\themyfigure

        Just delet it, and everything is gonna be OK.

        Enjoy !

  41. Jag

    Hi,
    I am writing my thesis using a class file. My thesis includes more than 100 figures. In the top of list of figures, I see “Appendix Figure” instead of “Figure” from third page onwards. Is there a way I can fix this?
    Thanks!
    Jag

  42. Hi Jag,

    It might be that your class file defines the header to show “Appendix Figure” for figures which are part of the appendix. You might want to check your class file and see if there is something similar to this totorial explaining exactly what you want to omit.
    Sorry, I cannot tell you more than that without seing your Latex document/class file.

    Good luck with your thesis,
    Tom

  43. simo

    hi every one!
    i have a prob in using minitoc ,the chapters and sections dont appear in the minitoc ( i have 2 lines instead) and this happen when i start only to add the

    \addcontentsline{toc}{chapter}{Liste Des Figures}
    \listoffigures

    and because i need the list of figures and also the list of tables ,i would be very happy to find a solution ,thks

    here is the code

    \begin{document}
    \ifpdf
    	\DeclareGraphicsExtensions{.pdf,.jpg,.png}
    \else
    	\DeclareGraphicsExtensions{.eps}
    \fi
    \pagestyle{empty} %No headings for the first pages.
    \include{title}
    \dominitoc
    \pagestyle{plain}
    \pagenumbering{roman}
    \tableofcontents
    \clearpage
    \addcontentsline{toc}{chapter}{Liste Des Figures}
    \listoffigures
  44. Hi Simo,

    You can only add the list of figures to your table of contents after creating it. So simply change the order of the following two commands:

    \addcontentsline{toc}{chapter}{Liste Des Figures}
    \listoffigures

    to

    \listoffigures
    \addcontentsline{toc}{chapter}{Liste Des Figures}

    Cheers,
    Tom

  45. Gaby

    Hi Tom
    I have repeating figures’ names (generated by a script that collect regression results) and I want to add the section name before every batch, e.g. instead of
    1. Test1 ….
    2. Test2 ….
    3. Test3 ….
    4. Test1 ….
    5. Test2 ….
    6. Test3 ….
    and so on, to be:
    Ver. 1.4
    1. Test1 ….
    2. Test2 ….
    3. Test3 ….
    Ver 1.5
    4. Test1 ….
    5. Test2 ….
    6. Test3 ….

    Thanks
    Gaby

  46. Hi Gaby,

    I suggest you try the following piece of Latex code. You will have to customize it to your needs, but as a first approach it should solve your problem.

    \newcounter{mybatchcounter}
    \newcommand{\batch}[1]{
    \addtocounter{mybatchcounter}{1}
    \section{Batch \themybatchcounter}
    \begin{figure}[ht]
    \centering
    \includegraphics[width=\textwidth]{#1/Test1.jpg}
    \caption{}
    \includegraphics[width=\textwidth]{#1/Test2.jpg}
    \caption{}
    \includegraphics[width=\textwidth]{#1/Test3.jpg}
    \caption{}
    \end{figure}
    \newpage}
    \batch{batch1_dir}
    \batch{batch2_dir}

    Let me know if this is not what you were looking for.

    Cheers,
    Tom

  47. Jon

    Hi, great blog. Anyway, in my table of contents I need the word ‘Chapter’ before my chapters, but if I add the code:

    \usepackage{tocloft}
    \renewcommand{\cftchapfont}{Chapter }

    then I get the word Chapter before my chapters but also before my List of Figures and List of Tables. Is there a way for my Table of Contents to just say
    List of Figures…
    Chapter 1: Introduction

    instead of
    Chapter List of Figures
    Chapter 1: Introduction.

    Also, two quick questions:
    1) Is there an easy way to center the heading for the Table of Contents
    2) Is there an easy way t o add dots to every line in the Table of Contents (right now I only have dots to my sections).

  48. Hi Jon,

    I am not sure if I completely understand all of your problems, but I can certainly give you some hints.

    If you want “Chapter” in the TOC entries, but not in the LOF/LOT, simply use the command:

    \renewcommand{\cftchapfont}{}

    after generating your TOC.

    However, I don’t understand why you get “Chapter” in front of your list titles, this seems a bit weird to me. I tried your code and I only got “Chapter” in front of my TOC entries.

    1) You can use

    \centering{\cfttoctitlefont}

    to centre your TOC title, it worked for me.
    Similarly, you can centre LOF and LOT titles.

    2) Adding dots between chapters can be done as follows:

    \renewcommand{\cftchapleader}{\cftdotfill{\cftsecdotsep}}

    Cheers,
    Tom

  49. Gaby

    Hi Tom,
    Thanks for the reply,
    I looked at my original post, and realized that I was not clear about what I was trying to do. I hope this time i’ll be more precise:
    I have figures in different sections that get the same name (the figures), and when I generate the list of figures there is no possibility to know to which section the figure belongs to.
    What commands do I need to add so that the LOF will look like:
    Section 1.4 Superman vs. Spiderman with Kripton
    1. Test1 ….
    2. Test2 ….
    3. Test3 ….
    Section 1.5 Superman vs. Spiderman without Kripton
    4. Test1 ….
    5. Test2 ….
    6. Test3 ….

    and not like:
    1. Test1 ….
    2. Test2 ….
    3. Test3 ….
    4. Test1 ….
    5. Test2 ….
    6. Test3 ….

    I managed to do that by manualy changing the LOF file, but those changs apply only for the next compilation, since they are overwritten with the newly generated LOF file.

    Thanks
    Gaby

  50. Jon

    Tom, thanks for the help. I ended up resolving my ‘Chapter’ problem with the following code (just adding it in case anybody else has a similar problem):

    \usepackage{tocloft}
    \renewcommand{\cftchappresnum}{Chapter }
    \renewcommand{\cftchapaftersnum}{:}
    \renewcommand{\cftchapnumwidth}{6em}
    \renewcommand{\cftchapleader}{\cftdotfill{\cftsecdotsep}}

    and then adding my bibliography or list or whatever to the Table of Contents where needed via:

    \addcontentsline{toc}{chapter}{Bibliography}
  51. Jag

    Thanks Tom! I finally figured it out after some head-scratching..

    —————————————–
    Hi Jag,

    It might be that your class file defines the header to show “Appendix Figure” for figures which are part of the appendix. You might want to check your class file and see if there is something similar to this totorial explaining exactly what you want to omit.
    Sorry, I cannot tell you more than that without seing your Latex document/class file.

    Good luck with your thesis,
    Tom

  52. Neil Murray

    Hi Tom,

    I would like to change the font size in the “List of figures” title, possbly even change it from bold to italic. How would I do this.

    Thanks,

    Neil.

  53. Hi Neil,

    You can easily change the titles using the “tocloft” package:

    \renewcommand{\cftXtitlefont}{\Huge\itshape}

    Just replace the X with either “toc”, “lof” or “lot” and use any font size you like.
    Available font sizes are: \tiny, \scriptsize, \footnotesize, \small, \normalsize, \large, \Large, \LARGE, \huge, \Huge.

    Cheers,
    Tom

  54. Neil Murray

    Hi Tom,

    That worked but when I use tocloft the fancy header and footer disappears from the pages that have the loc, lof and lot.

    Neil.

  55. Hi Neil,

    I am not sure if the actual problem is the tocloft package. Does the header/footer appear on the TOC/LOF/LOT pages when you are not using the tocloft package?

    Anyway, you can “force” the header to appear, e.g. for the table of contents:

    \addtocontents{toc}{\protect\thispagestyle{fancy}}
    \tableofcontents

    Hope this works out,
    Tom

  56. Neil Murray

    Hi Tom,

    Yep, the header/footer appears/disappears when I turn on and off tocloft. However your fixed worked perfectly.

    Thanks alot for the help!

    Neil.

  57. Philipp

    Hi Tom,

    do you know if there’s a way to get the \tableofcontents command to also show an entry for the list of figures and the list of tables?
    Speaking about which: since my dissertation only contains two tables, do you know a way to combine these two lists?

    Cheers,
    Philipp

  58. Hi Philipp,

    Thanks for your comment. You can actually add anything you like to the table of cotents by using the following command:

    \addcontentsline{file}{type}{text}

    where file would be “toc” in your case. As type you would simply use figure or table and the third argument would be the text you want to have in the table of contents.

    However, personally I prefer to use a separate list of figures and tables, even if there are only two entries. You can have them on the same page as the TOC.

    Anyway, it’s your choice and you should be able to do it with the information above.

    Have fun,
    Tom

  59. Philipp

    Hi Tom,

    sorry, I didn’t express this properly. I’m definitely going to use a separate \listoffigures and \listoftables. And I’d like to put references to them into the tableofcontents. I know the command \addcontentsline. The problem is that my list of figures is longer than a page. So if I use \addcontentsline before \listoffigures, I will get a too low page number in the toc, if I use it afterwards, the page number will be too high. I wondered if there’s an elegant way to get this right.

    Cheers,
    Philipp

  60. Hi Philipp,

    Simply insert a page break before your lof/lot:

    \tableofcontents
    \newpage
    \addcontentsline{toc}{figure}{List of Figures}
    \listoffigures
    \newpage
    \addcontentsline{toc{table}{List of Tables}
    \listoftables
    \newpage

    Cheers,
    Tom

  61. Rand

    Hello,

    I need to add the word “Page” to the list of tables and to the list of figures on the top of the page numbers. I don’t want the page numbers just appear, I want the word Page on the top of them.

    I have succeed to add “Page” to the table of contents but I couldn’t do that in the list of tables or the list of figures.

    Is there any one can help me?

    regards
    Rand

  62. Hi Rand,

    Using the following command, you can produce the word “Page” in your toc/lof/lot (just replace X):

    \addtocontents{X}{\protect\makebox[\textwidth][r]{Page}\protect}

    Make sure, you don’t add the command just after your \listoffigures. Inside your first chapter should be fine. I don’t exactly see why, but at least it works :-) .

    Cheers,
    Tom

    • gizmo

      Hi tom,

      I’m trying to use your suggestion for Rand with pdflatex, and on the “first compile” (first time through pdflatex), it seems to add the desired string to the toc. However on the “second compile” (second time through pdflatex where page numbers are resolved, I guess), pdflatex flags the string in the toc file as an error.

      Thanks,
      gizmo

      • Hi Gizmo,

        Thanks for pointing this out. I had a look at the problem and you are right, the code I posted is not working very well. However, I found this, which seems to work smoothly:

        \addtocontents{toc}{~\hfill\textbf{Page}\par}
        \addtocontents{lof}{~\hfill\textbf{Page}\par}
        \addtocontents{lot}{~\hfill\textbf{Page}\par}

        Add the lines just after you produce the toc/lof/lot.

        Tom.

  63. Robert

    Hi Tom,
    I have a large table with multiple rows. I have taken care to split the table into two which results in two similar table environments and produces the table segmented into two over two pages as i wanted (for some reason longtable never worked for me). In addition, i was able to paste the table notes below the second table, and there were a lot of these (there seems to be no sound table package which allows continuation over multiple pages and takes care to include the table notes appearing below the bottom margin of the table). The only problem with my table now is that even if i append Continued atop the second part of the original unsegmented table, this word along with an increased table numbering gets included in the listoftables. I know about the \captionsetup[figure]{list=no} command mentioned above. In all honesty, i have no idea whereabouts in the table environment this gets included but i would like this second table to remain unnumbered and in addition would like to be able to have Table 4.1, say, appear on top of the second segment along with the word -Continued……any ideas????

    Thanks in advance,
    Robert.

  64. Hi Robert,

    I hope I correctly understood your issue. Have a look at the following very short example and let me know what you think?
    Btw. Explicitly using the caption-package, Latex will not add a list of table entry if you leave the optional brackets empty:

    \caption[]{Your caption text}

    Cheers,
    Tom

    \usepackage{caption}
    ...
    \begin{table}[ht]
    \centering
    \begin{tabular}{|c|c|}
    \hline
    a&b\\
    \hline
    c&d\\
    \hline
    \end{tabular}
    \caption{First part}
    \label{tab:a}
    \end{table}%
    \addtocounter{table}{-1}
    \begin{table}[ht]
    \centering
    \caption[]{Continued}
    \begin{tabular}{|c|c|}
    \hline
    a&b\\
    \hline
    c&d\\
    \hline
    \end{tabular}
    \label{tab:b}
    \end{table}%
  65. yan

    hi every one
    i have a problem with the caption of figure , after compiling , the same title repeat twice i dont know why?? and i have errors

    \begin{figure}[h]
    \includegraphics{K4MAFJ01__2}
    \caption{agents that maintain state}\label{fig:fig2}  %this one
    \end{figure}

    the result is like this : the figure right here after these two titles
    agents that maintain state
    Fig1.1 agents that maintain state %in italic just after
    Fig1.1 agents that maintain state
    the errors are :Missing \endcsname inserted

    1.53 …{references\relax}{figure.1.1}{}}
    Latex Error: Missing \begin{document}
    the source of the prob here:
    \@writefile{toc}{\contentsline {chapter}{\numberline {1}Some small hints}{1}{chapter.1}}
    \@writefile{lof}{\addvspace {10\p@ }}
    \@writefile{lot}{\addvspace {10\p@ }}
    \@writefile{lof}{\contentsline {xchapter}{Some small hints}{1}{chapter.1}}
    \@writefile{lot}{\contentsline {xchapter}{Some small hints}{1}{chapter.1}}
    \newlabel{hints}{{1}{1}{Some small hints\relax }{chapter.1}{}}
    \@writefile{toc}{\contentsline {section}{\numberline {1.1}References}{1}{section.1.1}}
    \newlabel{references}{{1.1}{1}{References\relax }{section.1.1}{}}
    \@writefile{toc}{\contentsline {section}{\numberline {1.2}Dividing large Documents}{1}{section.1.2}}
    \newlabel{dividing}{{1.2}{1}{Dividing large Documents\relax }{section.1.2}{}}
    \@writefile{toc}{\vspace *{\baselineskip }}
    \@writefile{toc}{\contentsline {starchapter}{Bibliographie}{1}{section.1.2}}
    \@writefile{lof}{\contentsline {figure}{\numberline {1.1}{\ignorespaces agents that maintain state}}{2}{figure.1.1}}
    \newlabel{fig\@DP fig2}{{1.1}{2}{References\relax }{figure.1.1}{}}

    thank you for your responses

  66. Hi Yan!

    First of all, I always get errors if I use underline (“_”), so trying to escape them with a backslash might help:

    \includegraphics{K4MAFJ01\_\_2}

    What might have happened is that you are trying to include files which do not yet exist. If so, just comment out the

    \include{file}

    The figure environment looks all right, so I am not sure why you get the caption twice and I can’t remember having seen such a thing before. If you are still having the problem, could you post some more code, please?

    Also, you might have some lines of code before you start your document which should actually be inside the document. So it would be interesting to see what code you have before \begin{document}.

    If you get errors like these, it is always advisable to delete the auto-generated files like .toc, .aux, .log, etc. (but not the .tex file of course :-) ), as they may contain the error and when you re-generate the PDF, Latex will access them…

    Cheers,
    Tom

  67. yan

    thank you Tom, here is all the code

    \documentclass[a4paper,oneside,11pt]{report}
    \usepackage[left=1in,right=1in,top=1.1in,bottom=1.1in]{geometry}
    \usepackage[french]{babel}
    \usepackage[pdftex]{hyperref}
    \hypersetup{
        colorlinks,%
        citecolor=black,%
        filecolor=black,%
        linkcolor=black,%
        urlcolor=black}
     \newif\ifpdf
    \ifx\pdfoutput\undefined
    	\pdffalse              %%normal LaTeX is executed
    \else
    	\pdfoutput=1
    	\pdftrue               %%pdfLaTeX is executed
    \fi
    \ifpdf
    	%\usepackage{ae}       %%Use only just one of these packages:
    	%\usepackage{zefonts}  %%depends on your installation.
    \else
    	%%Normal LaTeX - no special packages for fonts required
    \fi
    
    %% Language %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %\usepackage[francais]{babel}
    \usepackage[T1]{fontenc}
    \usepackage[latin1]{inputenc}
    %% Packages for Graphics & Figures %%%%%%%%%%%%%%%%%%%%%%%%%%
    \ifpdf %%Inclusion of graphics via \includegraphics{file}
    	\usepackage[pdftex]{graphicx} %%graphics in pdfLaTeX
    \else
    	\usepackage[dvips]{graphicx} %%graphics and normal LaTeX
    \fi
    %\usepackage[hang,tight,raggedright]{subfigure} %%Subfigures inside a figure
    %\usepackage{pst-all} %%PSTricks - not useable with pdfLaTeX
    %% Math Packages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \usepackage{amsmath}
    \usepackage{amsthm}
    \usepackage{amsfonts}
    \usepackage{xtab}
    \usepackage{array}
    \usepackage {graphicx}
    \newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
    \begin{document}
    \ifpdf
    	\DeclareGraphicsExtensions{.pdf,.jpg,.png}
    \else
    	\DeclareGraphicsExtensions{.eps}
    \fi
    \pagestyle{empty} %No headings for the first pages.
    \include{title}
    
    %% Title Page %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %% ==> Write your text here or include other files.
    \pagestyle{plain}
    \addcontentsline{toc}{chapter}{Contents}
    \tableofcontents %Table of contents
    \pagenumbering{roman}
    %% The List of Figures
    \clearpage
    \addcontentsline{toc}{chapter}{List of Figures}
    \listoffigures
    %% The List of Tables
    \clearpage
    \addcontentsline{toc}{chapter}{List of Tables}
    \listoftables
    \clearpage
    \pagenumbering{arabic}
    \chapter{Some small hints}
    \section{References}
    \begin{figure}[h]
    \centering
    \includegraphics[scale=0.5,angle=270]{xxs}
    \caption{agents that maintain state}
    \end{figure}
    \section{Dividing large Documents}
    \end{document}
  68. yan

    hi Tomi discovered that the package hyperref caused this prob i dont know why??? when i put it like a comment , the title is good
    what should i do??

  69. Hi Yan,

    Your code works perfectly with me, so what I would recommend you is that you get the latest version of the Latex distribution. The hyperref package should not cause any problems. The only thing what you can try is change the order of the packages you use. But as I said, I can generate the PDF (using pdflatex) from your code without errors.

    Tom

  70. yan

    you’re right Tom thank you very much , i used to have a lot of warnings and errors , and with this new package nothing ,incredible
    Good luck

  71. yan

    hi tom ,i have some warnings , i think the prob is with the package

    hyperref and minitoc , here are the warnings
    Package minitoc(hints) Warning :W0030
    minitoc(hints) — The \part command is altered after minitoc

    Package minitoc(hints) Warning :W0023
    minitoc(hints) — it may be the consequence of loading the ‘hyperref’ package

    Regards.

  72. yan

    good day
    it seems like we can not ovoid this warning messages, but they’re not harmful
    i would like to know how to edit good graphics, cause when i tried to add jpg images that i saved from word2007 they didnt seem good at all .
    and when i try to add it like a pdf , i got a lot of additional space around the framework of my graphic.
    thank you.

  73. Shane

    Thanks! Your answer to Axel mostly fixed my problem.

    However, I had to use

    \usepackage[subfigure]{tocloft}
    \setlength{\cftfignumwidth}{3em}

    or else I got a “Command \c@lofdepth already defined” error (probably because I use the subfigure package). Also, tocloft does not create a list of figures on a new page by default so I needed to put a \clearpage command before \listoffigures.

    Thanks again; this saved me some hair-pulling!

  74. Hi Yan,

    I am glad you could fix some of your problems. I probably won’t be able to solve your issue with the word graphics. If you have the original image, you should definitely use it. I don’t know what Microsoft is doing exactly (compression, scaling, etc.), but the image quality is definitely suffering. I don’t think you can avoid that. Except if you scale them down in Latex…

    Concerning the itemize issue, let me write a post on how to change the default setting of the four levels in order to get bullets on the first level.

    Tom

  75. yan

    the problem is that i get dash in the first level ,dash in the second ,..and so on
    i dont think its a prob of reordering , even the dash that appear start from the left like this
    -not like this :
    -i cant find the white space that u can see before the dash
    first level dash
    second level dash , and the dash is thick a little comparing to the the original
    that i found in executing a test file.

    thanks.

  76. yan

    i discovered that the french package caused this prob , when i omit the package, all the items are good and in order
    what should i do Tom.?

  77. yan

    the german package for babel works perfect for itemize
    what the hell with these french :) complicated
    please Tom help

  78. Ali

    Dear Tom

    Can you please guide me in one problem. I am writing my Master Thesis and I have generated TOC with the following commands in Latex.

    \pagenumbering{roman}
    \input{abstract.tex}
    \input{acknow.tex}
    \tableofcontents
    \listoffigures
    \listoftables
    \newpage

    The problem is when I run the file, I see Abstract, Acknowledgement but not Table of contents, List of figures and List of Tables in my TOC. Can you please help me in this regard

    I shall be highly thankful

    Regards

    Ali

  79. Hi Ali,

    From the information given above, you might want to try including the files without the file extension (.tex). I tried to run it with the extension and I got the inverse, the abstract didn’t get included, but the toc did.

    Hope this helps,
    Tom.

  80. yan

    hi Tom , i would like to change the spacing(underline) on the minitoc table
    this time ,there is a large spacing, what command should i use??
    thanks

  81. Ed

    Hi Tom,

    I’ve created a table that is six pages long. The table looks fine, but when I use the \listoftables command, the table has six entries in the list of tables, one for each page. Is there any way to have only one entry in the list of tables?

    Tanks,
    Ed

  82. Jing

    Hi Tom,

    I tried to make a list for my figures in my thesis. But I always got error messages.

    I insert my figure in this way:

    \begin{figure}\label{fig1}
    %\begin{center}
    \hspace{-1.5cm}\includegraphics[width=7.0in, height=6.0in]{fig1}
    \begin{center}
    \noindent \hskip1cm  (i) \hskip 3cm  (ii) \hskip 3cm  (iii) \hskip 3.4cm  (iv)
    \end{center}
    \caption{\small The phase portraits of $I_i(t)$ vs $S_i(t)$($i=1,2$)
    for (\ref{simple-model})
     with  (\ref{data1}),   $D_{I_i}=0,\,\,i=1,2$ and (i) $D_{S_1}=0,\,\,\,D_{S_2}=0$;
    (ii) $D_{S_1}=0.02,\,\,\,D_{S_2}=0.2$; (iii)
    $D_{S_1}=0.4,\,\,\,D_{S_2}=0.2$; (iv)
    $D_{S_1}=0.8,\,\,\,D_{S_2}=0.2$. Initial values are given by
    (\ref{IV-1}).}
    %\end{center}
    \end{figure}

    As you see the above, the caption is pretty long. But I don’t have a better name for it. Also in my main.tex file. I used

    \newpage
    \listoffigures
    \addcontentsline{toc}{table}{LIST OF FIGURES}

    But when i run it, I always get the error message something like that:

    in main.lof missing number, treated as zero \protect, than the window give me the file of main.lof in which the error has highlighted the following thing:

    \contentsline {figure}{\numberline {2.4.1}{\ignorespaces \let \relax \fontsize {12}{14.5}\selectfont \abovedisplayskip 12\p@ plus3\p@ minus7\p@ \abovedisplayshortskip \z@ plus3\p@ \belowdisplayshortskip 6.5\p@ plus3.5\p@ minus3\p@ \belowdisplayskip \abovedisplayskip \let \leftmargin \leftmargini \parsep 5\p@ plus2.5\p@ minus\p@ \topsep 10\p@ plus4\p@ minus6\p@ \itemsep 5\p@ plus2.5\p@ minus\p@ \leftmargin \leftmargini \parsep 5\p@ plus2.5\p@ minus\p@ \topsep 10\p@ plus4\p@ minus6\p@ \itemsep 5\p@ plus2.5\p@ minus\p@ =\relax \fontsize {10.95}{13.6}\selectfont \abovedisplayskip 11\p@ plus3\p@ minus6\p@ \abovedisplayshortskip \z@ plus3\p@ \belowdisplayshortskip 6.5\p@ plus3.5\p@ minus3\p@ \def \leftmargin \leftmargini \parsep 5\p@ plus2.5\p@ minus\p@ \topsep 10\p@ plus4\p@ minus6\p@ \itemsep 5\p@ plus2.5\p@ minus\p@ {\leftmargin \leftmargini \topsep 9\p@ plus3\p@ minus5\p@ \parsep 4.5\p@ plus2\p@ minus\p@ \itemsep \parsep }\belowdisplayskip \abovedisplayskip \relax \fontsize {10.95}{13.6}\selectfont \abovedisplayskip 11\p@ plus3\p@ minus6\p@ \abovedisplayshortskip \z@ plus3\p@ \belowdisplayshortskip 6.5\p@ plus3.5\p@ minus3\p@ \def \leftmargin \leftmargini \parsep 5\p@ plus2.5\p@ minus\p@ \topsep 10\p@ plus4\p@ minus6\p@ \itemsep 5\p@ plus2.5\p@ minus\p@ {\leftmargin \leftmargini \topsep 9\p@ plus3\p@ minus5\p@ \parsep 4.5\p@ plus2\p@ minus\p@ \itemsep \parsep }\belowdisplayskip \abovedisplayskip The phase portraits of $I_i(t)$ vs $S_i(t)$($i=1,2$) for (2.4.3\hbox {}) with (2.4.1\hbox {}), $D_{I_i}=0,\tmspace +\thinmuskip {.1667em}\tmspace +\thinmuskip {.1667em}i=1,2$ and (i) $D_{S_1}=0,\tmspace +\thinmuskip {.1667em}\tmspace +\thinmuskip {.1667em}\tmspace +\thinmuskip {.1667em}D_{S_2}=0$; (ii) $D_{S_1}=0.02,\tmspace +\thinmuskip {.1667em}\tmspace +\thinmuskip {.1667em}\tmspace +\thinmuskip {.1667em}D_{S_2}=0.2$; (iii) $D_{S_1}=0.4,\tmspace +\thinmuskip {.1667em}\tmspace +\thinmuskip {.1667em}\tmspace +\thinmuskip {.1667em}D_{S_2}=0.2$; (iv) $D_{S_1}=0.8,\tmspace +\thinmuskip {.1667em}\tmspace +\thinmuskip {.1667em}\tmspace +\thinmuskip {.1667em}D_{S_2}=0.2$. Initial values are given by (2.4.4\hbox {})}}{47}

    Could you help me out with this? I will really appreciate. I really don’t know how to fix it. I am so frustrated at this moment.

    Thank you so much.

  83. Hi Jing,

    I used your code to recreate the error, but it seems there is nothing wrong with your code in general.
    One thing you might want to try is to put the label after the caption. Otherwise, I can only suggest you get the latest version of Latex and hope this will solve your problem.

    Good luck!
    Tom.

  84. Oguzhan

    Hi,

    very useful blog. thnx

    I have a question,

    I use

    \documentclass[12pt, abstracton, headsepline, liststotoc]{scrartcl}

    as document class and I want lof & lot (without number) appear in toc however it does not.
    [liststotoc] is supposed to do this work but still no output.

    could you pls help me
    thnx
    oguzhan

  85. Hi Oguzhan,

    I don’t know where your problem comes from, it worked perfectly with my Latex distribution. You might want to try the following things:
    1. Delete all tex-output files (.aux, .toc, etc. except .tex) and try again.
    2. Reduce the code to a minimum and see if it works.
    3. Get the latest Latex distribution.

    Good luck,
    Tom.

  86. joker

    Hi,

    In my table of contents I need the word ‘page’ before my page number,
    and I would like that appear the number of page of list of figure in my table of contents, like this:

    List of figures ……………… page 1
    Chapter 1 ………………….. page 5
    Chapter 2 ………………….. page 7

    Is there any one can help me?

    regards

    joker

  87. Hi Joker,

    Adding the word page before the page number can be achieved using the tocloft package:

    \usepackage{tocloft}
    \renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep} \bfseries Page}
    \renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep} Page}

    See the tocloft documentation.

    Concering your second question, please refer to my previous comments on this article, e.g. here.

    Cheers,
    Tom.

  88. Fatima

    Hi!

    How can you reduce the space before and after the title “Content” of the table of contents, i.e., the space between “Content” and the first line of contents in the table of contents?

    How can you do the same for “List of Figures” and “List of Tables”
    ?

    Thanks

    • Hi Fatima,

      Here is a little trick how you can increase or decrease in your case the space between the title and your first entry:

      \addtocontents{toc}{\vspace{-0.5in}}

      Use this command before your first entry, but after your \tableofcontents command. It manually adds an additional entry, which is space instead of text.

      By using “lof”/”lot” instead of “toc”, you can add/remove space to the list-of-figures / list-of-tables.

      Reference: tocloft-documentation

      Cheers,
      Tom.

  89. yan

    hi yan how are u, i’m writing an article using a structure of twocolumn, \documentclass[a4paper,twocolumn,10pt]{article} i would like to write the abstract without using two column i mean in one part.
    help!!pls

  90. luzmara

    Hi,

    In my table of contents appears my list of figures and tables, then the introduction and my sections. I nedd to put a point between the name of my section, lits of figures and tables and the page number, I’m working with document class article

    Its appears like this

    abstract 1
    list of figures 2
    list of tables 3
    1. Introduction 4
    2. literature 5
    2.1. literature century XX ……… 6
    .
    .
    3. conclusions 30

    I nedd like this

    abstrarct ………………………….. 1
    list of figures …………………….. 2
    list of tables ……………………… 3
    1. introduction …………………… 4
    2. literature ………………………. 5
    2.1 literature century XX ……… 6
    .
    .
    .
    3. conclusions …………………… 30

    Thanks,

  91. yan

    hi Tom its me again ,it seems that package multicols dont deal with figures, seems that the figure dont fit into one colulmn?? what should i do??

  92. Chris

    Hi! This seems to the expert page for the \listoffigures!
    I have a question.
    I have a problem with latex files in book format.
    I use \listoftables and \listoffigures.
    It does generate a proper list of figures with roman numbering,
    *but* then two empty pages follow that however include the page
    titles “list of figures” *and* crucially they start the numbering in arabic numbering. It looks very strange and it means my introduction starts from page 3. I can understand may be it decides 2 empty pages are needed but why title them as list of figures (and even that is probably ok) and especially, why switch to arabic numerals and start counting before the introduction? I hope it makes sense, sorry to take people’s time with this. Many thanks in advance.

    • Hi Chris,

      I am quite surprised about your issue. I would expect Latex to add one page after listoffigure/listoftable to make the number of pages used even. Also, I could explain the header on the empty page, but not the entire title “List of figures”.
      The following code however should solve your numbering problem and might also help with some of the other problems. Give it a try:

      \tableofcontents
      \listoffigures
      \listoftables
      \cleardoublepage
      \setcounter{page}{1}
      \pagenumbering{arabic}

      Cheers,
      Tom.

  93. morris

    hi tom.

    is there any way to get rid of the page numbers and the dots in listoffigure?

    i.e., now we have

    1 XXXXXX ……… 5
    2 YYYYY ………… 8

    but i just want

    1 XXXXXX
    2 YYYYY

    or better

    Fig. 1 XXXXXX
    Fig. 2 YYYYY

    thanks.

  94. Hi Morris,

    Here is how you can omit the dots and the page numbers in the list of figures:

    \usepackage{tocloft}
    \renewcommand{\cftfigdotsep}{\cftnodots}
    \renewcommand{\cftfigpagefont}[1]{}
    \renewcommand{\cftfigafterpnum}{\cftparfillskip}

    Please see my previous comments or the tocloft documentation on how to add “Fig.” in front of every entry.

    Tom.

  95. morris

    thanks tom.

    i still cant get rid of the numbers though, i still got

    Fig. 1 XXXXXX 5
    Fig. 2 YYYYY 8

    i want:

    Fig. 1 XXXXXX
    Fig. 2 YYYYY

    i tried to read the fine tocloft manual a bit in the meantime.

    \renewcommand{\cftdot}{} would also get rid of the dots… cant figure out a way to make the numbers disappear. may need to renewcommand listoffigures. will check back from time to time.

    great blog!

  96. yan

    hi Tom, i have these two warnings i dont know why??

    LaTeX Font Warning: Font shape `T1/lmr/bx/sc’ undefined
    (Font) using `T1/lmr/bx/n’ instead on input line 14.

    LaTeX Font Warning: Some font shapes were not available, defaults substituted.
    Thks Tom.

  97. Neil Murray

    Hi Tom,

    Nothing to do with figures but you seem to know everything about Latex.
    Anyhow,
    I am trying to change the section font type in a document that uses the res.cls which in tern uses the article.sty formats. I have tried using various variations of \renewcommand{\sectionfont}{\sffamily} but with no joy. what am I doing wrong?

    Thanks.

    Neil.

  98. Susann

    Hey Tom,
    is there a way to reduce the vertical space between entries in the list of figures / list of tables?
    Thank you!
    Susann

  99. Kay

    Hi,

    I have a couple of figures in my appendix. How do I get rid of appendix figures listed in ‘List of Figures’.

  100. AnneDi

    Hi, I need to show entries in list of figures like

    Figure 2.1 ——————
    Figure 2.2 ——————

    like that.

    but it shows like

    2.1 ———————–
    2.2 ———————–

    does anyone has any idea how to do this?

  101. Dan

    I’m writing a technical document with a lot of figures, mainly in several appendices. Ideally, I would like each appendix to have its own table of figures instead of having hundreds of figures listed in the main document’s TOF. Is there a way to do this?

    Thank you.

  102. Sebastian

    Hi,

    I have a text with an appendix consisting in a lot of figures, and I don’t want them to be in the list of figures. How can I force the command \listoffigures to display only the figures in the chapters?

    Thanks

  103. Carlos

    Hi everyone!

    How do I get my list of Figures to show a list like:

    Figure 1. Blah Blah
    Figure 2. Blah Blah
    etc…

    Please help me out here, it’s for my thesis.

    • Hi Carlos!

      To have Latex put the word “Figure” in front of your number, use the following package:

      \usepackage{tocloft}

      Redefine the way how list entries look by using these commands:

      ...
      \begin{document}
      \renewcommand{\cftfigpresnum}{Figure } % Adds the word "Figure" in front of the number.
      \renewcommand{\cftfignumwidth}{5em} % Adds some white space.
      ...
      \end{document}

      Cheers, Tom.

      • Katja

        Thanks Tom for your great site, I was looking everywhere for an answer to this. You are the hero of the day! x

  104. sv

    Hi Tom,

    I enjoyed and benefitted from many of your postings. In a article document class, I use figures, tables, supertabular, and some of them are in tabular and tabularx environment. My huge table defined by supertabular is in landscape orientation.

    Now I want to caption all of them as Exhibits, placed after all the text and I want figures, tables, etc. to be in same sequence.

    I have tried this:

    \begin{document}
    
    \renewcommand{\figurename}{Exhibit}
    \renewcommand{\tablename}{Exhibit}
                              %--------------------------------
                             %\newcounter{table}[figure]
                             %\setcounter{table}{16}
                              %-------------------------------------
                             %\addtocounter{table}{\value{figure}}
                               %----------------------------------------
    \addtocounter{table}{16}

    Now: 1) The commented out lines do not serve my purpose, and I have to type in the exact numbers of figures as 16 in \addcounter. (I have placed 16 figures, and then my tables follow)

    2) Still, the first table (large one, but in table environment and portrait) is numbered as Exhibit 17, and the next table is numbered as 19, 20, 21, 22….

    Where did I slip?

    Thanks,
    SV

    • Hi sv,

      If you use only one counter for both, figures and tables, it will do the trick.

      \renewcommand{\thetable}{
      	\protect\refstepcounter{figure}%
      	\thefigure%
      }

      In case you want to have a “List of Exhibits”, you will also need to change the title of the list of figures: \renewcommand\listfigurename{List of Exhibits} and make sure your tables are added to the list of figures.

      Cheers,
      Tom

      • sv

        Hi Tom,

        Thanks for the help. But I get some errors.

        This is my code:

        \begin{document}
        
        \renewcommand{\figurename}{Exhibit}
        \renewcommand{\tablename}{Exhibit}
        \renewcommand{\thetable}{\protect\refstepcounter{figure}%
        \thefigure%}

        The error message I get is

        Runaway argument?
        {\protect \refstepcounter {figure}\the figure \par \par \thispagestyle \ETC

        ! File ended while scanning use of \@argdef.

        \par
        filename.tex

        Thanks,
        SV

  105. sv

    Hi Tom,

    I found a solution, now. The codes I used are as below:

    \begin{document}
    
    \renewcommand{\figurename}{Exhibit}
    \renewcommand{\tablename}{Exhibit}
    
    __________TEXT____________________
    
    __________Figures____________________
    
    \setcounter{table}{\arabic{figure}}
    
    ___________Tables___________________
    
    \end{document}

    Now I get all figures captioned as Exhibit 1, Exhibit 2,… Exhibit n and the the tables follow with captions Exhibit n+1, Exhibit n+2,….
    This is an article and not a report, and so I don’t need the list of exhibits.

    Thanks,
    SV

  106. Javier

    Hi! I had a problem with the \listoffigures comand while I was writting a document in spanish; I would like that in the document appears Lista de Figuras, instead “Lista de ffiguras” , what can I do?
    Is a compilation problem?
    Thanks

  107. Mary

    Hi, Tom,

    I am using report document class to write my dissertation. My table captions are so long that they enter the columns of page numbers in list of tables. How can I make each line of the entries shorter?

    Another question: how can I force the end of the pages in list of tables to redistribute entries to avoid a widow entry on the last page?

    Thanks a lot.

    • Hi Mary,

      Your first question is easily answered:

      \caption[Short list of tables caption text.]{Long table caption text.}

      Your second question is more difficult and I probably won’t be able to answer it to your satisfaction, since it depends on how flexible you are with your document. Basically, you have several possibilities, I could think of. You could change the margin of the page and squeeze the last entry on the same page as the others. Or you might think about changing the font size or spacing between lines of the list of tables/figures. I am sure there is a way to redistribute entries, but I wouldn’t know how to do it.

      Cheers,
      Tom

  108. Sandeep

    Hi Tom,

    I am writing my thesis and I need help regarding spacing of the entries using ‘\listoffigures’. I want that the entries that span across 2 lines should be more compact. In other words, I want to change this spacing manually ? How can I achieve it ? Thanks.

    Sandeep

  109. Mads

    Hi Tom, I am working on my masters thesis and just wanted to thank you for this very useful information!

    Greetings

  110. Chris

    Hey Tom, nice work!!!
    However i still got a question:
    the figures in my bachelor thesis are numbered as follows: 1.1, 1.2, 1.3, 2.1, etc.
    i also have an introduction with two figures in it.
    unlike the other figures they are numbered 1, 2.
    Now how could i change that to 0.1 and 0.2
    thanks in advance

    chris

    • Hi Chris,

      Assuming, you are suppressing the numbering of your introduction chapter, the following code does the trick:

      \documentclass{report}
      \usepackage{graphicx}
      \begin{document}
      \renewcommand{\thefigure}{0.\arabic{figure}}
      \chapter*{Introduction}
      \begin{figure}[ht]
      \centering
      \includegraphics[scale=0.2]{figure.jpg}
      \caption{default}
      \label{default}
      \end{figure}
      \chapter{First Chapter}
      \renewcommand{\thefigure}{\thechapter.\arabic{figure}}
      \begin{figure}[ht]
      \centering
      \includegraphics[scale=0.2]{figure.jpg}
      \caption{default}
      \label{default}
      \end{figure}
      \end{document}

      Cheers, Tom.

  111. Ray

    Hi Tom, I have a question about the list of figures command. In my thesis i have long captions for figures, but want to keep them like that in the lof. however as they are long, rather than wrap to the next line, the entries in lof just go off the page. any ideas how i can stop this, and get them to wrap to the page and not go off it? cheers!

    • Hi Ray,

      Please post a minimal example, so I can see what you are doing. I tried what you described above, but the caption wraps perfectly in my list of figures.

      Thanks, Tom.

      • Ray

        after posting here i accdeintly found the cause! i asn’t using the “breaklinks” in the \usepackage[breaklinks]{hyperref} declaration. all working now though. many thanks for the quick reply though, and all the other above advice. I’ve used most of it!

      • Catarina

        Thank you so much for the existence of the site!! I have been looking for the answer for this problem since ever!

        Thank you Ray for, even solving your problem alone, posting here the solution..Thank you so much!

        Thank you Tom too. I’ve used many of your advices ;)

        *

  112. Roland

    Hi,

    I only want to display important figures in my list of figures. Therefore I have to suppress some figures in order not to be shown. How can I do this?

    Thanks, Roland

  113. vicen

    Hi, my associated problem is that the first page of the list of figures or list of tables the number of pages do not appear (and I think I have not written any strange command), any idea why or how to solve it?Thks!

  114. Kosala

    [LaTex source code removed]
    ————————————————-
    Problem: This gives an error “No room for a new \write”. Could you plese tell me how to resolve this issue?

    • Hi Kosala,

      Please give me a minimal example that I can copy into my editor and run. It should not contain any include commands, since I don’t have these files. Use blindtext if necessary. Also, please remove any personal style files.

      This guide may be of help to create a minimal example: Creating a LaTex Minimal Example.

      Thanks,
      Tom.

  115. Amani

    Hi every one

    I have problem in the list of tables since I merge each three tables in one caption… the problem that I want to make the number of page that appear in the “list of tables” like this for exaple 20–22 …I try to change it in the LOT file but I dont know why it is not working ,, the PDF file does not apply the change, not that I latex the source file first then change the LOT file than I get the PDF file
    does any one have a solusion and I will be very greatful … thanks in advance
    Amani

    • Hi Amani,

      Thanks for your comment. Please post a mini-example that illustrates your problem, so we can help solving it. Thanks, Tom.

  116. Flaces

    hi Tom

    honestly its wonderful blog, and well kept by all/you.
    I have two questions, and I put the code for clarity.

    1.
    When I refer to a subfigure as: Figure~\ref{fig1}, then what I get in the output is: Figure 1a. While I need to have Figure 1(a)?

    \begin{figure}
        \centering
        \subfloat[fig1]
        {
            \includegraphics[width=0.45\textwidth]{fig1.pdf}
            \label{fig1}
        }
        \subfloat[fig2]
        {
            \includegraphics[width=0.45\textwidth]{fig2.pdf}
            \label{fig2}
        }
        \caption{FigureA}
        \label{FigureA}
    \end{figure}

    2.
    As you can see, there are three data rows within each cell; I need to color the second and third data rows with bit lighter shades of gray, such that it does not include the first common column (e.g. row1), and the color should not cover the vertical lines getting in between the cells.

    Further, how can the vertical lines and horizontal lines can be changed to some other style like dashed or dotted?

    \begin{table}[!ht]
    \centering
      \begin{tabular}{c|c|c|c|c|c|c|c}
      \hline
      \multirow{2}{*}{Column1} & \multicolumn{7}{c} {Column2}\\
                                                & 1 & 2 & 3 & 4 & 5 & 6 & 7\\ \hline\hline
      \multirow{3}{*}{row1} & 88 & 212 & 464 & 716 & 968 & 1220 & 1472 \\
                            & 0.14 & 0.655 & 3.229 & 6.022 & 9.095 & 11.949 & 14.696 \\
                            & 8 & 16 & 27 & 34 & 38 & 40 & 41 \\ \hline
      \multirow{3}{*}{row2} & 232 & 548 & 1184 & 1820 & 2456 & 3092 & 3728 \\
                            & 1.076 & 7.223 & 34.055 & 67.003 & 95.862 & 125.097 & 154.082 \\
                            & 10 & 13 & 17 & 19 & 19 & 19 & 19 \\ \hline
      \end{tabular}
    \caption{text}
    \label{t1}
    \end{table}

    Thanks in advance.

    • Hi Flaces,

      Wow, you have quite a few questions and it took me a while to figure out how to solve them. Let me start with your first question.

      1. I suggest, you combine the references of the figure and subfigure:

      \ref{FigureA}\subref{fig1}

      This should produce the parentheses. It needs more typing, but you don’t have to redefine any commands.

      2. Rowcolor, the trickiest part and also the ugliest I have to say. Here is a possible solution. I colored the columns and set the rows back to white. The problemes start with the title row, because there “Column1″ sits in the middle of the cell and therefore, coloring the row will overwrite it. Hence, we have to set every single cell to white. I still hope, this solution is acceptable.

      \usepackage{colortbl}
      \usepackage{multirow, arydshln}
      \usepackage{color}
      \definecolor{Gray}{gray}{0.9}
      ...
      \newcolumntype{g}{>{\columncolor{Gray}}c}
      \begin{table}[!ht]
      \centering
      \begin{tabular}{c|g|g|g|g|g|g|g}
      \hline
      \rowcolor{white}
      \multirow{2}{*}{Column1}
      & \multicolumn{7}{c}{Column2}\\
      & \cellcolor{white}1 & \cellcolor{white}2 & \cellcolor{white}3 & \cellcolor{white}4 & \cellcolor{white}5 & \cellcolor{white}6 & \cellcolor{white}7\\
      \hline\hline
      \rowcolor{white}
      \multirow{3}{*}{row1}
      & 88 & 212 & 464 & 716 & 968 & 1220 & 1472 \\
      & 0.14 & 0.655 & 3.229 & 6.022 & 9.095 & 11.949 & 14.696 \\
      & 8 & 16 & 27 & 34 & 38 & 40 & 41 \\
      \hdashline[5pt/5pt]
      \rowcolor{white}
      \multirow{3}{*}{row2}
      & 232 & 548 & 1184 & 1820 & 2456 & 3092 & 3728 \\
      & 1.076 & 7.223 & 34.055 & 67.003 & 95.862 & 125.097 & 154.082 \\
      & 10 & 13 & 17 & 19 & 19 & 19 & 19 \\
      \hline
      \end{tabular}
      \caption{text}
      \label{t1}
      \end{table}

      Dashed line:

      \usepackage{arydshln}
      ...
      \hdashline[5pt/5pt]

      The first number is the dash width and the latter the space width.

      Best, Tom.

  117. Yallen

    Hi Tom, glad to find this useful blog. I have a question.

    I used the command \titlecontents in the titletoc package to format the entry of lof. The following is the code.

    \titlecontents{figure}[0pt]{\normalfont\mdseries\singlespace}{\figuretitlename ~ \thecontentslabel : \hspace{.25em}}
    {}{\titlerule*[1pc]{}\contentspage}

    I defined \figuretitlename as “FIGURE” to make it appear in each entry of lof. However, when caption is long. The whole multi-line entry is left aligned, like this
    FIGURE 1: AAAAAAAAAAA
    AAAAA

    So my question is how to make it aligned after the colon
    FIGURE 1: AAAAAAAAAAA
    AAAAA

    Well, I try to use short and one-line captions but some have to be long…

    Thanks in advance.

    • Hi Yallen,

      Here is how you can solve your problem:

      \usepackage{tocloft}
      \renewcommand{\cftfigpresnum}{FIGURE }
      \renewcommand{\cftfignumwidth}{6em}

      Tom.

  118. Sri

    Hi,
    I’m working on my thesis. There is a strange problem I encountered. My headers are meant to display the chapter name. When there are upto 2 sections in any chapter, this header works fine. Whenever a 3rd section is inserted the header does not display the chapter name from that page onwards for the rest of the chapter. I’m quite new to latex and unable to figure out what is causing this. Any help would be greatly appreciated. This is the part of the template I’m using

    \pagestyle{fancy}
    \renewcommand{\chaptermark}[1]{\markboth{#1}{}}
    \fancypagestyle{fancyplain}{
    \fancyhf{}
    \addtolength{\headheight}{1.8pt}
    \renewcommand{\headrulewidth}{0pt}
    \renewcommand{\footrulewidth}{0pt}
    \fancyfoot[R]{\sffamily\bfseries  \thepage/\pageref{fancy:frontend} } %%\fancyfoot[RO,LE]
    }
    \fancypagestyle{fancytext}{%
    \fancyhead{} % clear all header fields
    \addtolength{\headheight}{1.8pt}
    \fancyhead[R]{\nouppercase{\rightmark}}
    \fancyhead[R]{\nouppercase{\leftmark}}
    \fancyfoot{} % clear all footer fields
    \fancyfoot[R]{\sffamily\bfseries\thepage/\pageref{fancy:mainend}} %%t[LE,RO]
    \renewcommand{\headrulewidth}{0.4pt}
    \renewcommand{\footrulewidth}{0pt}
    }
    \fancypagestyle{fancychapter}{% the page with chapters in main
    \fancyhf{}
    \addtolength{\headheight}{1.8pt}
    \renewcommand{\headrulewidth}{0pt}
    \renewcommand{\footrulewidth}{0pt}
    \fancyfoot[R]{\sffamily\bfseries  \thepage/\pageref{fancy:mainend} }
    \markboth{}{}
    }
    \renewcommand{\chaptername}{Chapter}
    
    \def\@makechapterhead#1{% For fancy chapters
      \vspace*{50\p@}%
      {\parindent \z@ \raggedright \normalfont
       \ifnum \c@secnumdepth >\m@ne
          \if@mainmatter
            \large\scshape \@chapapp \space\space \Huge\upshape\thechapter
            \par\nobreak
            \vskip 20\p@
          \fi
        \fi
        \interlinepenalty\@M
        \flushleft\parbox{\textwidth}{\raggedleft \sffamily\Huge\bfseries  #1 }
         \par\nobreak
         \vskip 15pt
         \hrule height 0.4pt
        \vskip 65\p@ %length from line to text
      }
      \thispagestyle{fancychapter}}
    
    \def\@makeschapterhead#1{% For plain chapters in mainmatter to the left
      \vspace*{50\p@}%
      {\parindent \z@ \raggedright \normalfont
       \ifnum \c@secnumdepth >\m@ne
          \if@mainmatter
          	\ifnum \thechapter =0
          	%Style just for preface in mainmatter
    		  \Huge\upshape \phantom{1}
            	  \par\nobreak
            	  \vskip 20\p@
    		  \interlinepenalty\@M
        		  \flushleft\parbox{\textwidth}{\raggedleft \sffamily\Huge\bfseries  #1 }
        		  \thispagestyle{fancychapter}
          	\else
          	  \sffamily\Huge\bfseries  #1
          	  \thispagestyle{fancychapter}
          	  %Nom Bio and *
          	\fi
            \else
    	\sffamily\huge\bfseries  #1
    	\thispagestyle{fancyplain}
    	% outside mainmatter
    	\fi
       \fi
        \par\nobreak
        \vskip 15pt
        \hrule height 0.4pt
        \vskip 65\p@
      }
    }

    and for including the chapters:

    \mainmatter
    	\pagestyle{fancytext}
    \cleardoublepage 	\phantomsection
    \input{file/chapter2}

    Thanks in advance!

  119. arnab

    Can u please help me how can I add list of figure,list of table with page number in the contents?
    like:
    list of figures………I
    List of table ………II
    1. Introduction……….1

    • Hi Arnab,

      You have to add them manually by using

      \addcontentsline{toc}{chapter}{\listfigurename}

      just after the list of figures, list of tables command respectively (toc: table of contents).

      If your lists take more than a single page, the page number will be wrong, but that should do the trick:

      \cleardoublepage
      \addcontentsline{toc}{chapter}{\listfigurename}
      \listoffigures

      Tom

  120. Hrvoje

    Hi, Tom. So happy to find this blog. I have two questions.
    1) in my paper, i use head/footrule, which must be included on every page but title page. when i used

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

    in preamble, i lost head/footruler on first 3 odd pages, which include toc, lof and lot. on 7th page i have first section, and from there on everything is just fine.

    2)my figure captions can be quite long, so it takes more than one line to write them. this is what i get in that case

    figure 1.2 texttexttexttexttexttexttexttexttexttext
    texttexttext………………………………n

    and this is what i want

    figure 1.2 texttexttexttexttexttexttexttexttexttext
    texttexttext………………………..n

    Thanks in advance!

    Best regards

    • Hi Hrvoje,

      Sorry for the late response and thanks for your comment. To answer your questions:
      1) You can force header and footer with fancyhdr using the addtocontents command. The following example shows how to do it for the toc:

      \addtocontents{toc}{\protect\thispagestyle{fancy}}

      2) I’m surprised you are having this problem. By default, multi-line entries in the index should be aligned. Try updating your LaTeX distribution if you haven’t done so for a while. If that doesn’t help, please send a minimal example.

      Thanks, Tom.

  121. magya

    Hi Tom,
    when I generate the list of figures, the list comes out with:
    Figure 4.1:. figure caption….
    Figure 4.2:.
    How do I get rid of either the : or the . from Figure 4.1:. ?
    I have only used \caption and nothing out out the ordinary.
    thanks
    M.

    • Hi Magya,

      Try specifying the separator yourself using the tocloft package:

      \usepackage{tocloft}
      \renewcommand{\cftofaftersnum}{:}

      If that doesn’t help, please send me a minimal code example that illustrates the issue.

      Thanks, Tom.

  122. Ankit

    Hi Tom,
    I am using following packages,

    \usepackage{amsmath, amsfonts, amsthm, amssymb, amscd, amsbsy, amsgen}
    \usepackage{subfigure, cite, graphicx}

    When i give \listoffigures, latex makes list of figure as,
    1.1 Captio

    but when it becomes 1.10 it shows, 1.10Caption, i want to add space in between and when i use tocloft, it gives me a bunch of error.
    Thanks,
    Ankit

    • Hi Ankit,
      I’m not sure, why you only have space for “three digits”. I tried and this only happens when my chapter and section both are two digit numbers. But there is another way to solve your problem actually and you were on the right track. You can still use the tocloft package, but you’ll have to load it with the subfigure option:

      \usepackage[subfigure]{tocloft}

      It shouldn’t matter in what order you load the packages.
      Good luck! Tom.

      • Ankit Srivastava

        Hi Tom,

        Thanks for the reply.
        The problem is because i am defining

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

        and this was creating an error

        I did huge trial and error and modified the following line in amsbook.cls

        \def\l@figure{\@tocline{0}{3pt plus2pt}{0pt}{2.5pc}{}}

        which was initially

        \def\l@figure{\@tocline{0}{3pt plus2pt}{0pt}{1.5pc}{}}

        I don’t know why but it solved my problem, also i am not able to use

        \usepackage[subfigure]{tocloft}

        It again gives me a lot of error. But i will get back to you later right now somehow its working. :)

        I really appreciate your help. This is a very useful blog, I learned a lot.

        Thanks again,

        Regards,
        Ankit

  123. hi Tom,
    You have helped so many. I am writing a thesis and the requirement for the \tableofcontents is that when the table of contents spans multiple pages (which mine does), I must find a way to put a title on each new page that says “TABLE OF CONTENTS (continued)”. By default, “TABLE OF CONTENTS” is only printed on the starting page, and I dont know how to change the name of the title on pages after the first page”
    I have already done:
    \renewcommand{\contentsname}{\begin{center}TABLE OF CONTENTS\end{center}}
    any advice on how to do this?

    • Hello!
      Thanks for that question!
      I attached a piece of code. Just save it to a Latex style file (e.g. toccontd.sty) and copy it into your document directory. Finally, add \usepackage{toccontd} to your preamble. Feel free to change it according to your needs. It won’t be compatible with any other packages modifying the table of contents or at least I didn’t check.
      Hope it helps!
      Cheers, Tom.

      % Write title
      \def\ps@continued{
         \def\@oddhead{\headmark}
         \let\@evenhead\@oddhead}
      % Define table of contents continued title
      \def\tableofcontents{
         \clearpage
         \def\headmark{\vbox{
              \hbox to \textwidth{\bfseries\Large\hfil TABLE OF CONTENTS
                 (Continued) \hfil}}}
         \pagestyle{continued}
         \table@of@cont
         \newpage}
      % Define tableofcontents
      \def\table@of@cont{%
         \thispagestyle{plain}
         \@makeschapterhead{TABLE OF CONTENTS}
         \@starttoc{toc}}
      • Hi Tom,
        Thanks for writing this.
        When I try it, I get the error:

        \table@of@cont …tyle {plain} \@makeschapterhead
        {TABLE OF CONTENTS} \@star…
        l.104 \tableofcontents

  124. Flaces

    hello Tom

    I am writing a paper using
    \documentclass[journal]{IEEEtran}

    by default, it makes the contents inside \begin{abstract}..\end{abstract} bold, which I dont want. There is a IEEEtran.cls file which perhaps is making it bold. I tried to comment out a few lines which I thought are making the abstract as bold, but it did not work. Perhaps I need to do some more steps, before it would be visible in my document. Could you please guide how I can get rid of this bold and make it instead italic?

    I am using WinEdt/Miktex/Latex.

    Thanks in advance.
    best regards
    Flaces

    • Hi Flaces,

      I downloaded the class-file (IEEEtran.cls) from here CTAN and copied it to my document directory.
      If you go to the abstract definition in IEEEtran.cls (line 3709) you’ll see a \bfseries on line 3711 which makes the abstract bold. Replace it with \itshape.

      That worked for me. Cheers, Tom.

  125. Flaces

    Thanks Tom; it works when I put the IEEEtran.cls in my document directory. I guess it would be possible to make it permanent by doing the same step in
    C:\Program Files\MiKTeX 2.9\tex\latex\ieeetran\IEEEtran.cls

    I tried, but it did not work; I did Refresh FNDB in MikTex, but still it does not work. Am I missing some step?

    thanks in advance.
    regards
    Flaces

    • Hi Flaces,

      Unfortunately, I am not very familiar with MiKTeX and it’s directory structure. This manual might provide some help…

      Cheers, Tom.

  126. marianie

    Hi Tom

    I want to leave an empty space of =5cm at the top beginning of my chapter (On the first page of my chapter only). The rest of that chapter’s pages should have top margin=3cm. How can I do that?

    I tried, but I got top margin=5cm for the whole chapter.

  127. Divya

    Hi,
    I need to remove the page numbers that come in front of each figure caption after using \listoffigures.
    How do i do that?

    Thanks
    Divya

    • Hi Divya,

      I’m not sure I understand your question. By page numbers, do you mean the figure number in front of the caption? Depending on your document class, this would be “chapter.figure” or “section.figure”. You can redefine the command using: \renewcommand\thefigure{}. But this would obviously delete the figure number throughout your document. See the caption package documentation for more details.
      If this is not what you were looking for, please provide more details or a minimal example.

      Thanks, Tom.

      • Divya

        Hi,
        I mean when we use \listoffigures command, we get the figure number, caption alongwith the page number on which the figure appears. So I want to remove the page numbers which it automatically shows.
        e.g. List of Figures
        1. Caption of figure——————-Page number(on which it appears)
        So what shd i be doing to remove the page numbers as indiacted above?

      • Hi Divya,

        Here is how you can suppress the page number in your list of figures:

        \let\Contentsline\contentsline
        \tableofcontents
        \renewcommand\contentsline[3]{\Contentsline{#1}{#2}{}}
        \listoffigures
        \renewcommand\contentsline[3]{\Contentsline{#1}{#2}{#3}}
        \listoftables

        Cheers, Tom.

  128. flaces.edn@gmail.com

    hello Tom

    I have an issue with vertical alignment of text within cells of tables, which is always aligned to top. I need to vertically align it in the middle so that it looks better; I am using:

    \documentclass[journal]{IEEEtran}
    ...
    $U$ & $\sum\limits_{i \in I}{b_i}$\\

    In this case, $U$ aligns to the top of its cell and looks bit not ok.

    Thanks.
    Flaces

    • Hi Flaces,

      The easiest solution would be to use the array package and its m{width} column type:

      \usepackage{array}
      ...
      \begin{tabular}{m{.5in}m{.5in}}
      $U$ & $\sum\limits_{i \in I}{b_i}$\\

      If this is not good enough, try the tabularx package or see this table summary document, which has nice examples.

      Best, Tom.

      • flaces.edn@gmail.com

        Hello Tom

        thanks.
        your code runs fine, but the providing widths manually is bit cumbersome, as I have too many tables. Even in my case, the text/maths is crowded to the top/bottom horizontal lines, and looks not ok.
        Seems tabularx is a way to go, as apparent from the tables given in the link, but somehow the code gives errors in my IEEEtran document. I am interested to generate Table.14 in my doc, which hopefully will fulfill my need. So could you please sent a code of a single row with cells aligned center hori/vert. both.

        thanks in advance.

  129. Isa

    Hi Tom,

    When I try to include a list of figures, I get an error “bad math environment delimiter”.
    But, there is no math environment in my captions. I already tried to rename all caption with simple numbers, but I still got the error.

    The point is that everything was okay an hour before, and I really do not know what I might have changed.

    I use this header:

    \documentclass[titlepage,a4paper,11pt,headsepline,footsepline]{article}
    
    \usepackage[utf8x]{inputenc}
    \usepackage{scrpage2}
    \usepackage{graphicx}
    \usepackage{booktabs}
    \usepackage{nomencl}
    \usepackage{booktabs}
    \usepackage{multirow}
    \usepackage{textfit}
    \usepackage{hyphenat}
    \usepackage{float}
    \usepackage{rotfloat}
    \usepackage{floatflt}
    \usepackage{rotating}
    \usepackage{color}
    \usepackage[footnotesize]{caption}
    \usepackage{url}
    \urlstyle{tt}
    \usepackage{multicol}

    Do you have any idea what the problem might be?

    Thanks, Isa

    • Isa

      Me again, I still do not know what the problem was, but I opened the .lof file and deleted some things that might cause troubles and now everything is fine again :)
      Sorry to trouble you, but I was just so frustrated…

      • Hi Isa,

        No worries. It is often a good idea to delete all meta files latex generates if you get errors that do not seem related to what you just changed. Just make sure you keep the source files :-)!

        Cheers, Tom.

  130. flaces.edn@gmail.com

    hello Tom

    I have a problem with Table numbering; there is one main table, and two subtables; when I refer to the sub tables, it gives number IIa, IIb, while I expect Ia, Ib.

    If I change caption=true, then the problem is solved but the figure caption is no more footnotesize, which is not desired.

    Please help; thanks in advance.

    regards
    Flaces
    ——

    \documentclass[conference]{IEEEtran}
    \usepackage[caption=false,font=footnotesize]{subfig}
    
    \begin{document}
    
    \begin{table}
    \centering
    \caption{Table}
      \subfloat[]{\label{t1}
         \begin{tabular}{|c|}
         a
         \end{tabular}
        }
      \subfloat[]{\label{t2}
          \begin{tabular}{|c|}
          b
          \end{tabular}
       }
    \end{table}
    
    Table~\ref{t1} and Table~\ref{t2}
    \end{document}
    • Hi Flaces,

      Interesting, it works fine when I run you code, so you may have an older version of the IEEEtrans class file (or me). Have you tried \subref{t1}?
      This may also be helpful, they propose to load the caption package as a sub fig option (see Errata):

      \usepackage[caption=false,font=footnotesize]{subfig}

      Actually, I see double table numbers when using the command above. So hopefully, it will remove it in your case :-).

      Tom.

  131. Yallen

    Hi Tom,

    Ask you for help again. It is about the page numbers after entries in the list of figures. For a multiline entry, the corresponding page number is placed after the last line. My question is how to put it after the first line of entry (like the following way).

    Chapter 1 word word word word page #
    word word word

    Thank you!

    Yallen

  132. Dayo

    I am writing my thesis using the memoir class. I put my nomenclature list immediately after the List of Table. However, the top of the second page of my nomenclature is still showing as if it is part of the List of Table. How do I solve this problem

  133. Dayo

    Hi Tom,
    It is me again, When I say the top of the second page I mean the header of the second page of the nomenclature list is showing List of Tables rather than nomenclature. Thank you for your assists.

    • Hi Dayo

      It’s hard to help without seeing your code. It would be helpful if you provided a minimal example. Nevertheless, I can give you a place to start. I assume you are aware, that you have to generate the Nomenclature index using makeindex and you have the *.nls-file along with your *.tex-file. Now one thing I can think of and you might want to try is to start a new page after your table of contents. This will make sure, the table of contents is completed:

      \tableofcontents
      \clearpage
      \printnomenclature

      You may also want to have a look at the first few pages of the package documentation.

      Cheers, Tom

    • There you go:

      \newlength{\mylen}
      \renewcommand*\cftfigpresnum{Figure~}
      \settowidth{\mylen}{\cftfigpresnum\cftfigaftersnum}
      \addtolength{\cftfignumwidth}{\mylen}

      Found here ;-)

      Cheers, Tom.

  134. Fred Durao

    Many Thanks Tom,

    And I have to confess that I ve been to “here” few minutes ago. :))

    Have a nice day.

    Fred

  135. Jacob

    Hi Tom,

    I have problem getting the page number of TOC right. When I add \listoffigures, the page number in TOC becomes incorrect (My list of figures is about 6 pages long). Even if I don’t include `list of figures’ in TOC, the numbering in TOC of the subsequent chapters is still wrong. If I exclude \listoffigures, everything is fine. Do you possibly know what could be the problem? Thanks!

    Jacob

  136. Alan

    Hi Tom,

    I have a problem on my list of figure page. The figures with a long caption are out of right margin. In other words, it won’t change lines for captions. And I don’t want to create shorter version of captions. Please help me on this. Thanks.

    Alan

    • Hi Alan,

      Usually, I would expect LaTeX to automatically add line-breaks. If you are using the hyperref package, try loading it with this option:

      \usepackage[breaklinks=true]{hyperref}

      If not, you would need to provide a short code example so I can reproduce the issue.

      Best, Tom.

  137. Afshin

    Hey Tom
    I am writing my thesis and have a problem with list of figures. How can I shrink the length of figs caption to avoid interfering between number and caption? I used what you suggested before {\usepackage{tocloft}}, but it makes errors saying that I already used cft…, but I didn’t use. Is there any package which is not compatible with this one? Thanks in advanced

    • Hi Afshin,

      In your list of figures, the long captions should not reach over their defined margin, LaTeX adds linebreaks automatically. You can get alternative short captions using:

      \caption[<short list of figure caption>]{<Actual long figure caption>}

      You don’t need the tocloft package to do that. In case you are using the hyperref package, load it with this option: breaklinks=true.
      I’m not sure why you get that error you were describing. I would need to see a minimal code example to be able to reproduce it and help you.

      Cheers, Tom.

  138. Hui

    Hi Tom,

    I am writting my thesis.

    I have a very long table using \deluxtable. It occupies several pages. As a result, in the `List of Tables’, it looks like this.

    4.2 Secondary Paschen- emitting candidates . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
    4.2 Secondary Paschen- emitting candidates . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
    4.2 Secondary Paschen- emitting candidates . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
    4.2 Secondary Paschen- emitting candidates . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
    4.2 Secondary Paschen- emitting candidates . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
    4.2 Secondary Paschen- emitting candidates . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

    So how can I remove the extra citations here (for example page 81 to 86) and just looks like this

    4.2 Secondary Paschen- emitting candidates . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

    Thanks.
    Best wishes!
    Hui

    • Hi Hui,

      I suggest you use longtable rather than deluxetable. You won’t have that problem with your “List of Tables” and it’s well documented. For a short introduction and some sample code see my post here.

      Best, Tom.

      • Hui

        Hi Tom,

        I have solved the problem by using ‘longtable’, instead of ‘deluxetable’. Thanks very much for your help!

        Best wishes!
        Hui

  139. Matt

    Hi,
    I have a problem with listoffigures which I cant see the figures with subfigures (I used minipage), so I I have added:

    \usepackage[lofdepth,lotdepth]{subfig}

    and changed minipage to subfigure method.
    But my compiler doesn’t like this package. I dont underestand whats the problem :(

    • Hi Matt,

      The subfig and subfigure are two different packages. The subfigure package was replaced by the more recent subfig package. The floating environment is called subfloat for both, figures and tables. See my post on that topic.

      I hope that solves your issue. Best, Tom.

  140. Sper

    Hi, Tom,

    First thanks a lot for your previous answers – they have helped me a lot.

    I wanted to know if it’s possible to stop LaTeX from including in the list of figures the captions of all subfigures. I am currently using the subfig package:

    \usepackage[caption=false,font=footnotesize]{subfig}

    and I would only want in the list of figures the main caption of the figures.

    I hope I worded my question sufficiently clear, if not, please ask.

    Thanks in advance for taking the time!

    Sper

    • Very clear :-).

      You can either use an option when loading the package or set the depth later on:

      \usepackage[lofdepth=1]{subfig}

      or

      \setcounter{lofdepth}{1}

      Best, Tom.

  141. Didi

    Hi Tom!

    Thanks a lot! I managed to insert the table of contents, list of figures and of tables reading your comments.
    I have just a small question: for the figures and tables I have a quite long explanation of what they are (3-4 rows), and this is inserted in the caption section. When I run the list of tables and figures, I obtain all the explanation inserted in the caption, and it is too long to be shown in the section list of figures/tables. Therefore my question is: is it possible to have 2 titles for the figures/tables so that I can write the short title in one caption and the long in another one?

    Thanks for your help!

    • Hi Didi!

      Use the optional parameter of caption.

      \caption[short caption for list of figures/tables]{long caption text for figure/table}

      Best, Tom.

  142. pma

    Hi there Tom !

    First thanks for all the good work ! Your blog is a goldmine :p

    Had a question … didn’t manage to find this one (evnthough it ghad been asked before here ..)

    I’d like to divide mi LoF and LoT by Part and chapters…

    A picture worth a thousand word so …

    Now I have :

    List of Figures

    1.1 xxxxxxx
    1.2 xxxxxxxx
    1.3 xxxxxxxx

    2.1 xxxxxx
    2.2 xxxxx
    2.3 xxxxxx

    1.1 xxxxx
    1.2 xxxxx
    1.3 xxxxxx

    And i would like to obtain

    List of Figures

    Part 1
    Chapter 1

    1.1 xxxxxxx
    1.2 xxxxxxxx
    1.3 xxxxxxxx

    Chapter 2
    2.1 xxxxxx
    2.2 xxxxx
    2.3 xxxxxx

    Part 2
    Chapter 1
    1.1 xxxxx
    1.2 xxxxx
    1.3 xxxxxx

    Hope I’m clear enough ?!

    Any clue ?

    • One way I can think of is using the command addcontentsline{}{}{}. You could for example create a \mychapter command which in addition to creating a chapter also adds itself to the list-of-figures.

      \newcommand{\mychapter}[1]{
      	\chapter{#1}
      	\addcontentsline{lof}{chapter}{Chapter \thechapter}}

      Whenever there is a figure in a specific chapter, you use \mychapter instead of \chapter. It’s still somewhat manual, but it does the trick.

      Best, Tom.

  143. Natasha

    Many thanks for this useful write up I had indeed been facing some issues but thus was very helpful indeed :)

  144. Didi

    Hi Tom!

    Sorry for disturbing you again.. I decided to put all tables and figures at the end of the paper, and would like to have a format like this:

    (centered and fat)
    Table 1
    (title) The effect of option illiquidity

    space
    This table reports… (explanation of 2-3 rows)

    space
    table results

    Because if I write the explanation in the caption, I do not get the title anymore (The effect of option illiquidity).

    Thanks a lot!

    Dijana

    • Hi Dijana,

      Have a look at the code below. It’s probably not perfect, but a start. Hope it’s what you were looking for. Best, Tom.

      \documentclass{article}
      \usepackage[labelformat=empty]{caption}
      \newcounter{mytable}
      \newcommand{\mytable}[2]{
      	\stepcounter{mytable}
      	{\bfseries
      		Table \themytable \\ #1\\ \vspace{5mm}
      	}
      	#2
      	\caption[#1: #2]{}
      }
      \begin{document}
      \listoftables
      \begin{table}[ht]
      \begin{center}
      \mytable{The effect of option illiquidity}{Lorem ipsum...}
      \begin{tabular}{|c|c|}
      \hline
      a&a\\
      b&b\\
      \hline
      \end{tabular}
      \end{center}
      \end{table}%
      \end{document}
  145. khushboo

    Hey Tom,very helpful topic..Thanks a ton!!
    But i am facing a problem,between the toc and lof and lot there are pages that are left blank.plus the numbering is not consistent and shifts from right to left. I need the contents numbering to come consistently and laso remove the extra pages.Extra pages are left even between two chapters at random,as not between every two chapters. Thank you for time…

    • Hello!

      Which documentclass are you using? There is a reason for (almost) everything that Latex does. For examples chapters in books always start on odd pages so whenever a chapter ends on an odd page, Latex leaves one page blank. Concerning the shifts from right to left, it seems you are using the twoside option. Have a look at this Wikibooks entry for more information on documentclass options. You can change headers/footers in different parts of your document using the \pagestyle command.

      Hope this helps,
      Tom

      • khushboo

        Hey !! the wiki book thing helped…and you were right the page being left was because my document class was book,i changed it to a Report and its all sorted :)thank you !!

  146. Mike

    Hi Tom,
    Thanks so much for your posts. I’ve followed your answer to one of the previous questions in relation to list of figures and list of tables, but ended up with a new problem that I am not sure how to solve…

    I have a template that uses the following code to generate the LOF and LOT:

    \def\afterpreface{\newpage
    				{\setlength{\parskip}{0.2\baselineskip}
    				\tableofcontents
    	   \iflistnomenclatureatfront
    		   \listnomenclature
    	   \fi
    	   \iffigurespage
                    \listoffigures
                    \addcontentsline{toc}{chapter}{\listfigurename}
            \fi
            \iftablespage
                    \listoftables
                    \addcontentsline{toc}{chapter}{\listtablename}
            \fi
    
            }
            \cleardoublepage
            \pagenumbering{arabic}
            \pagestyle{fancy} %{headings}
    }

    I want to add Figure and Table in the LOF and LOT respectively (as in Figure 2.2 or Table 2.2 etc). I added your suggestion

    \usepackage{tocloft}
    \renewcommand{\cftfigfont}{Figure }
    \renewcommand{\cfttabfont}{Table }[\sourcecode]

    in the preamble. This solves my problem but the LOF and LOT do not appear on separate pages. I want them to start on separate pages.

    How do I incorporate this into the above code or how to I modify it to include Figure and Table in the LOF and LOT and still have them start on new pages?

    Thank you in advance,
    Mike

    • Hi Mike,

      There is an easy answer to your question. The only thing you have to do is to end the page before creating the next index, i.e.:

      \tableofcontents
      \clearpage
      \listoffigures
      \clearpage
      \listoftables
      \clearpage

      Best, Tom.

  147. Didi

    Hi Tom!

    Thanks so much for your help!

    Another small questions: I would like to create subfigures, 4 small graphs on one page, do you think this programming is correct?

    \begin{figure}[h]
    \centering%
    \subfigure[{a1.pdf}\label{A1}]%
    {\includegraphics{a1.pdf}}\qquad\qquad
    \subfigure[{a2.pdf}\label{A1}]%
    {\includegraphics{a2.pdf}}\qquad\qquad
    \subfigure[{a3.pdf}\label{A1}]%
    {\includegraphics{a3.pdf}}\qquad\qquad
    \subfigure[{a4.pdf}\label{A1}]%
    {\includegraphics{a4.pdf}}\qquad\qquad
    \caption{a1.}
    \end{figure}

    I believe there is something wrong as I receive an error message.

    Thanks a lot!

    Dijana

    • Hello Dijana,

      Your code is perfectly fine. Do you load the necessary packages, subfigure and graphicx, in your preamble?

      \usepackage{graphicx, subfigure}

      You may also want to consider using the more recent subfig package which replaces the subfigure package.

      Tom.

  148. Mike

    Hi Tom,
    Thanks for your tip, its worked perfectly when I modified the code with addition of \newpage..

    \listnomenclature
    \fi
    \iffigurespage \newpage
    \listoffigures
    \addcontentsline{toc}{chapter}{\listfigurename}
    \fi
    \iftablespage \newpage
    \listoftables
    \addcontentsline{toc}{chapter}{\listtablename}
    \fi

    Thank you!

    Cheers
    Mike

  149. vagner

    Hi, Tom!

    I’ve been also trying to print the words Figure and Table in my ToCs, right before the object’s number. The code you’ve provided earlier works fine for that, but the page numbers just disappear from the ToCs. Furthermore, my chapter headers lose their formatting (just after including \package{tocloft} in the source). I’m using a template (which uses fancyhdr package) and I’m not experienced with latex. Could you help me, please? Thanks in advance!

    Best,
    vagner

    • Hi Vagner,

      There does not seem to be any conflict between the tocloft and fancyhdr packages.
      You can try this:

      \fancypagestyle{plain}{%
        \fancyhf{}
        % Custom fancy head/foot, e.g.:
        \fancyfoot[R]{\thepage}
       }

      If that doesn’t help, please post a minimal example that illustrates the problem.

  150. Shah

    Hi Tom,

    I have also some problems to fix in my thesis appearance. I hope you can help me in this matter.

    1. I want the List of figures and list of tables to appear at the end after Bibliography instead of having them before the TOC. To achieve this objective, I have moved the lines \listoffigures and \listoftables just before the \end{document}. When I compile my .tex document, both lists appear where I want them but they DO NOT appear in the TOC. How to fix it?

    2. I want my Appendices to appear in TOC as Appendix A (Name), Appendix B (Name), and so on. I used

    \begin{appendices}
    \include{./AppendixA/appendixA}
    \include{./AppendixB/appendixB}
    \end{appendices}

    to achieve the goal. I get the following in TOC,

    Appendices
    Appendix A (Name of Appendix) (Page #)
    Appendices
    Appendix B (Name of Appendix) (Page #)

    How to get rid of this extra “Appendices”? appendixA.tex is my file in sub-folder AppendixA of the main folder Thesis.

    I really appreciate your time and interest. Thank you very much.

    • Hi Shah,
      Thanks for your questions. Here is what I think:

      1. Easiest is to add them manually, just after your \listoffigures call add:

      \addcontentsline{toc}{chapter}{\listfigurename}

      However, in case the list is several pages long, you’ll have to use the tocbibind package to get the page number in doc right.

      2. It seems you are using the appendix package. Here is what I did:

      \documentclass[11pt]{report}
      \usepackage{appendix}
      \begin{document}
      \tableofcontents
      \begin{appendices}
      \chapter{First Appendix Name}
      \chapter{Second Appendix Name}
      \end{appendices}
      \end{document}

      In my TOC there is neither “Appendices” nor “Appendix”. I’m not sure why you get these additional words in you table of contents, but you can try without using the appendix package (\begin{appendix}...\end{appendix}) or provide a minimal example for me to reproduce your problem.

      Hope it helps. Best, Tom.

  151. Arknodee

    Hi, Tom.

    So happy to find this blog. I have one question.

    I want to this “list of contents”:

    CONTENTS
    Subject Page

    Subject 1 …………………………………………………………………………………1
    Subject 2 …………………………………………………………………………………2
    Subject 3 …………………………………………………………………………………3

    Hope I’m clear enough and thanks for your hints and tips :).

  152. Flavio

    Hi, Tom.

    This is a very good blog. I have one question related with figures.

    I changed the numeric sequence of the images and how they apear in the List of Figures.
    Code below.

    \usepackage{tocloft}
    
    \renewcommand{\cftfigfont}{Figura }
    \newcounter{myfigure}
    \renewcommand{\thefigure}{\arabic{figure}}

    Now when I do

    \begin{figure}[h]
    \center
    \includegraphics[width=6cm, height=7cm]{imagens/figura1}
    \label{fig:figura1}
    \caption{My Figure 1}
    \end{figure}

    and \ref{fig:figura1} the number that appears is the default (Something like 3.2).

    How can I do to appear my new number for figure in \ref

    Thanks for your hints

    • Hi Flavio,

      Thanks for the comment. The first thing I noticed, you define a new counter (myfigure) but you don’t use it. In your case, I think, you don’t actually need another counter, you can use the figure counter change the way the it’s printed.

      Here is a minimal example that illustrates it:

      \documentclass[11pt]{article}
      \usepackage{tocloft, graphicx}
      \renewcommand{\cftfigfont}{Figura }
      \makeatletter
      \renewcommand{\thefigure}{\arabic{figure}}
      \makeatother
      \begin{document}
      \listoffigures
      \section{First section}
      \begin{figure}[h]
      \centering
      \includegraphics{test}
      \label{fig:figura1}
      \caption{My first figure}
      \end{figure}
      See figure \ref{fig:figura1}.
      \end{document}

      Best, Tom.

  153. elfo

    Hello,

    Im trying to use minitoc in my master thesis but I cannot see any minitoc at all…

    I used \usepackage{minitoc} before \usepackage{hyperref}

    \dominitoc before \tableofcontents

    and I also used \adjustmtc at the end of all \chapter* and \section*

    What Im doing wrong?

  154. elfo

    Hi,

    I appreciate all your help but I think that my problem is solved.

    I was playing around with \adjustmtc and I discovered that it should be used only in \chapter* that also use \addcontentsline{toc}{chapter} command and not all \chapter*.

    Now, if you don’t mind I have three more questions relative to style issues that I couldn’t solve yet…

    1 – In minitoc, I dont want to have de “Contents” word, I would like to have no word at all.

    2 – I dont want to have the horizontal lines above “Contents” and at the end of minitoc.

    3 – There is any simple way to have my minitoc with the style looking the same used by my main table of contents generated by \tableofcontents command?

    • Hi elfo,

      1. \renewcommand{\mtctitle}{}
      2. \mtcsetrules{minitoc}{off}
      3. The minitoc package is quite flexible. I’m not sure however, how much you would have to change to make it look exactly like the toc. Please refer to the manual for details.

      Best, Tom.

  155. drwoodblock

    Tom,

    How do I modify your solution for adding ‘Page’ before the page numbers in the TOC to extend to the LOF and LOT?

    %\usepackage{tocloft}
    %\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep} \bfseries Page}
    %\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep} Page}
    • Hi there,

      Simply re-new the same for figure and table by replacing cftsecleader with cftfigleader and cfttableader:

      \renewcommand{\cftfigleader}{
      	\cftdotfill{\cftdotsep} Page}
      \renewcommand{\cfttableader}{
      	\cftdotfill{\cftdotsep} Page}

      Best, Tom.

  156. Esdras

    Hi Tom,

    I want to get a question about how to organize the Latex bibliography, you may already have had the same problem. In my work the bibliography is arranged in order of citation, but as the list of figures and tables comes before the first chapter, the order of citations starts in the list of figure that has citations. Then, in the first chapter, the first citation does not correspond to the first of the bibliography because the first is the first that appears in the list of figures.

    To the order of the bibliography starts with the first chapter of the text, list of figures and tables would have to come last. But this way the lists will appear at the end of the document, and I don’t want this.

    Do you know how I can solve this problem?

    Thanks for help.

    • Hi Esdras,

      If you don’t want citations in the listoffigures, use the optional caption argument:

      \caption[caption for listoffigure without citation]{caption for figure with citation \cite{blab}}

      If you wish your references to appear in the listoffigures, try the notoccite package.

      \usepackage{notoccite}
      \bibliographystyle{unsrt}

      Best, Tom.

  157. Shah

    Hey Tom,

    I have a problem due to running head in my thesis draft. The Summary and Acknowledgements follow immediately Bibliography. The running head on Summary and Acknowledgements pages is also “Bibliography”. The running head in the rest of the thesis until Bibliography is ok and there is no such problem. How to solve this?

    I really appreciate your help and time. Thank you very much.

    Shah

    • Hi Shah,

      Use \chapter{} or \section{} depending on whether you are writing a report or article. Another way would be to define environments by redefining abstract, e.g.:

      \newenvironment{acknow}{%
      \renewcommand*{\abstractname}{Acknowledgments} \abstract}{%
      \endabstract}
      ...
      \begin{acknow}
      ...
      \end{acknow}

      Cheers, Tom.

      • Shah

        HI Tom,

        It has not solved the problem. I tell you what exactly I am doing to help you read the situation.

        I have main file thesis.tex file and I include acknowledgments.tex by the following code line in thesis.tex following the

        \bibliography{./Biblio/biblio}

        line.

        \include{Acknowledgments/acknowledgments.tex}

        The file acknowledgments.tex starts with the following two lines.

        \addcontentsline{toc}{chapter}{Acknowledgments}
        \chapter*{Acknowledgments}

        With this, when I compile the running head on Acknowledgments and Summary pages is “Bibliography” instead of Acknowledgments and Summary. I hope I have explained the situation clearly!

        How to resolve this problem?

        Thank you very much for your time and help.

        Shah

      • Hi Shah,

        You can use the command \markboth{left head}{right head}. Also, you’ll have to inverse the order of \chapter and \addcontentsline to get the page number right.

        Here is a minimal example.

        \documentclass[12pt]{report}
        \usepackage[english]{babel}
        \usepackage{fancyhdr, blindtext}
        \pagestyle{fancy}
        \begin{document}
        \tableofcontents
        \chapter{First chapter}
        \Blindtext
        \chapter*{Acknowledgments}
        \addcontentsline{toc}{chapter}{Acknowledgments}
        \markboth{Acknowledgements}{}
        \Blindtext
        \end{document}

        Please provide a minimal example next time, it will save us both time and I can help you on the first attempt. Also, you may even solve your problem while creating it.

        Thanks, Tom.

  158. Rosa

    Dear Tom

    This might be a silly question, but when I create the list of tables and the list of figures the figures and tables of the different chapters of my thesis appear in different blocks, separated by a space, while the tables and figures of the appendix appear immediately after the tables of the last chapter. For example

    List of tables

    1.1 table 1 of chapter 1
    1.2 table 2 of chapter 1
    1.3 table 3 of chapter 1

    2.1 table 1 of chapter 2
    2.2 table 2 of chapter 2
    2.3 table 3 of chapter 2

    and then
    3.1 table 1 of chapter 3
    3.2 table 2 of chapter 3
    3.3 table 3 of chapter 3
    A.1 table 1 of appendix
    A.2 table 2 of appendix
    A.3 table 3 of appendix

    Any suggestions?

    Many thanks

    Rosa

    • Dear Rosa

      Which documentclass do you use? I tried to reproduce the problem you describe, and in my list-of-figures and list-of-tables, the appendices are separated by a space.

      Have a look at the minimal example below:

      \documentclass[11pt]{report}
      \usepackage{graphicx}
      \begin{document}
      \tableofcontents
      \listoffigures
      \listoftables
      \chapter{First chapter}
      \section{First section}
      \begin{table}[ht]
      \caption{default}
      \centering
      \begin{tabular}{|c|c|}
      \hline
      \end{tabular}
      \end{table}%
      \begin{figure}[ht]
      \centering
      \includegraphics[width=0.2\textwidth]{test}
      \caption{default}
      \end{figure}
      \begin{appendix}
      \chapter{First appendix chapter}
      \section{First appendix section}
      \begin{table}[ht]
      \caption{default}
      \centering
      \begin{tabular}{|c|c|}
      \hline
      \end{tabular}
      \end{table}%
      \begin{figure}[ht]
      \centering
      \includegraphics[width=0.2\textwidth]{test}
      \caption{default}
      \end{figure}
      \end{appendix}
      \end{document}

      Best, Tom.

      • Rosa

        Dear Tom

        Thanks a lot for your reply. I review the code after your example and it seems to be working now,

        I have another question however: is it possible to add the chapter name or just “Chapter 1″ etc before the block of tables or figure in the lof/lot?

        Thanks

        Rosa

      • Hi Rosa,

        I’m glad my previous solution worked. Sorry for not getting back to you earlier. Here is my proposal for your question. Define a new command that creates a chapter and adds itself to the lists. The code below will add “Chapter 1″ to the list of figures / tables. I included both, one example with page number (lof) and the other without (lot). You can modify it, depending on your preference.

        \newcommand{\mychapter}[1]{
        \chapter{#1}
        \addtocontents{lot}{\contentsline{chapter}{Chapter \thechapter \vspace{10pt}}{}}
        \addcontentsline{lof}{chapter}{Chapter \thechapter \vspace{10pt}}
        }

        Best, Tom

  159. Akim Demaille

    Hi Tom,

    I am trying to get all my chapters numbered, and appearing as numbering in the PDF bookmarks. This looks like a task for tocbibind, but apparently it does not do that, and it is unclear to me whether this is a bug, or I misunderstand the documentation.

    So basically, bellow, I would like to get the toc, tof and tot numbered.

    I have found the definition of listoftables in book.cls, so I can easily use \chapter instead of \chapter*, but you might have better ideas.

    Cheers!

    \documentclass{book}
    \usepackage[bookmarks, bookmarksnumbered, bookmarksopen]{hyperref}
    \usepackage[chapter,numindex,numbib]{tocbibind}
    \begin{document}
    \tableofcontents
    \chapter{First chapter}
    \section{First section}
    \begin{table}[ht]
      \caption{default}
      \centering
      \begin{tabular}{|c|c|}
        \hline
      \end{tabular}
    \end{table}%
    \begin{figure}[ht]
      \centering
      The figure.
      \caption{default}
    \end{figure}
    \chapter{Second chapter}
    \section{Second section}
    \begin{table}[ht]
      \caption{default}
      \centering
      \begin{tabular}{|c|c|}
        \hline
      \end{tabular}
    \end{table}%
    \begin{figure}[ht]
      \centering
      The figure.
      \caption{default}
    \end{figure}
    \listoffigures
    \listoftables
    \end{document}
    • Akim Demaille

      FWIW, I also note that there is a slight difference between the handling of tableofcontents on the one hand, and listoffigures and listoftables on the other hand: in one case the typesetting of the headers (\@mkboth) is in the chapter command, not in the other one. I have no idea whether it changes something.

    • Akim Demaille

      This is what I decided to do.

      % We also want to the tables of figures and tables to be chapters, not
      % chapter*.  These are taken from book.cls, and (i) use \chapter
      % instead of \chapter*, (ii) add a \label.  Beware that the mkboth
      % cannot be inside the \chapter command, contrary to what the original
      % definition does.
      
      % \listOf{LIST}{Name}
      % -------------------
      % For instance \listOf{lof}{\listfigurename}.
      \newcommand{\listOf}[2]
      {%
          \if@twocolumn
            \@restonecoltrue\onecolumn
          \else
            \@restonecolfalse
          \fi
          \chapter{#2}%
          \label{sec:#1}%
          \@mkboth{\MakeUppercase#2}%
                  {\MakeUppercase#2}%
          \@starttoc{#1}%
          \if@restonecol\twocolumn\fi
          }
      \renewcommand\listoffigures{\listOf{lof}{\listfigurename}}
      \renewcommand\listoftables{\listOf{lot}{\listtablename}}
      \renewcommand\tableofcontents{\listOf{toc}{\contentsname}}
  160. Steve

    This was a big help. Thanks very much.

    Judging by the number of comments here, there is a real hunger for some expert LaTeX help on this topic. You are very kind to provide it.

  161. Frederico

    Tom, your blog is very helpful. Thank you very much.
    Apologizes for my bad text and if my question have already been answered before, but I want ask to you how I can solve a small trouble.
    When I use the command \listoffigures, my big captions crosses the end of page and not continues in the next line below. An only possible solution is using the \caption[]{} command?
    Thanks

    • Hi Frederico,

      There is no need to apologize, I’m happy to help. Generally, LaTeX automatically breaks lines in the list of figures. However, there might be packages (e.g. hyperref) that interfere. In order for me to help, please provide a minimal example that illustrates the problem with as few lines of code as possible. I can then reproduce the issue and suggest a solution…

      Best, Tom.

  162. Anna

    Hi Tom, great info. I have a problem with the list of figure of my thesis document, my captions are a little too long so that when they appear in the list there is a lot of text. How can I do in order to have just a ‘title’ of the figure in the list instead all the caption?

    Thanks in advance

  163. Frederico

    Uau! Without my code, you found the problem. When I use the hyperref package, the problem appears. If I don’t use it, this problem disappears, but another problem is created. Without the hyperref package, the references in captions don’t work and the question mark (“?”) appears in its place. I didn’t send my code yet because I am using a brazilian macro for master thesis named “abntex”. This macro is used for make master thesis in accord with University’s rules. I didn’t ask this question to them because they are a open-code project that don’t have support.
    Anyway, thank’s a lot.
    Regards

    • Hey Frederico!

      Almost always you are not the first to encounter a certain problem and many people, like you, write about it, luckily. A quick google search revealed this. I’m not sure if it solves your problem, but you may want to give it a try…

      Good luck,
      Tom.

  164. dung nguyen

    This is a great blog.
    I have a question about my TOC, LOT and LOF.
    My TOC is something like
    List of Table……………..i
    List of Figure…………….ii
    Abstract
    Chapter
    1. Something……….
    1.1. Something…..
    2. Something….
    2.1. Something….

    How can I remove the word “Chapter” in the TOC?

    My LOT and LOF is something like
    1.1.Something…………………….
    1.2.Something………………………..

    2.1. Something…………………………
    2.2.Something………………………….

    How can I remove the double space between 1.2 and 2.2 ?

    In addition, there is no page number in my LOT and LOF page even I am using

    \addtocontents{toc}{\protect\thispagestyle{fancy}}

    I also would like to have the identical vertical space from the top of the page to the heading of Table of Content, List of Table, List of Figure, Abstract, Chapter 1, etc and indentical vertical space from these headings to the text body.

    Could anyone please help me with that.

    • Hi there!

      Please provide a minimal example that illustrates the issues. It’s makes things much easier than with just the output.

      Usually, people place the abstract before the tableofcontents, so it generally doesn’t appear in the list. Do you use:

      \begin{abstract}...\end{abstract}

      in your code? That may also solve the issue with the word chapter.

      Which page number are you referring to, the page number of the figures or the page number of the list-of-figures?

      To remove the white space between chapters in the list-of-figures/tables, try the following code. It redefines the chapter and adds a negative vertical space, removing 10pts added to lof/lot after every chapter (see here)

      \makeatletter%
      \newcommand{\saved@chapter}{}
      \let\saved@chapter\chapter
      \renewcommand{\chapter}{%
      \@ifstar {\saved@chapter*}{\@dblarg\my@chapter}%
      }
      \newcommand*{\my@chapter}[2][]{%
      \saved@chapter[#1]{#2}%
      \addtocontents{lot}{\vspace*{-10pt}}
      \addtocontents{lof}{\vspace*{-10pt}}
      }
      \makeatother%

      Concerning the spacing, here is a nice Q&A that explains how to change space before and after chapters. For the toc/lof/lot, I suggest the tocloft package.

      Best,
      Tom.

      • dung nguyen

        Hi Tom,

        Thanks very much for your reply.

        Regearding the page number: Right now, on LOT and LOF pages, the page numbers are blank. I want them to show up.

        Regarding the TOC: I want the word “Chapter” in TOC to be removed.

        Please see blow for my minimal example.

        Thanks

        D

        [...]Code removed by Tom.[...]

      • Hmmm, that was more a maximal example if anything like that even exists. Please remove all non-standard packages (e.g. sw20utah) and any code/text that is not required to illustrate the issue. It shouldn’t be more than the bare minimum, usually only a few lines of code which I can run in my editor.

        Thanks, Tom.

  165. Neil

    Hi Tom,

    I have few questions if you could please answer them with your expertise.
    a. The chapter heading in the toc is touching the page number in the right hand side of the page. How can I make the heading in two lines when it is long enough to touch the page number in the right?

    b. I am able to manage the double spacing between the chapter heading, section heading and subsection heading but unfortunately, not able to make a double spacing between a sub-sub-section in the toc. How can I get a double spacing for all in toc?

    c. The captions of the figures are italics in my document. The captions also has a citation for example: Figure 2.1 Figure Caption [2] (but all of these are italic). I want the entire caption to be italic except the citation. How can I get the citation a normal text with caption italic?

    Thank you for wonderful support the latex learners like me.

    Neil

    • Hi Neil,

      1. There are two possible reasons this could happen. Either you have long words that TeX has problems splitting (hyphenation). Or, you use teh hyperref package, which is the more likely cause. Use the following option to fix it:
        \usepackage[breaklinks=true]{hyperref}
      2. When I use the report document class, I only get white spaces between chapter entries. Can you please provide a minimal example that illustrates white spaces for section, etc.
      3. By default, my captions are normal text, not italic, so I assume that you set them to italic, e.g.:
        \usepackage[labelfont=it,textfont=it]{caption}

        To change the caption back to normal text use:

        \caption{This is a caption, see \textnormal{\cite{citation2012}}}

      Best,
      Tom.

  166. Nam

    Hello,

    I’m having an issue where for the “List of Figures”, the entries over-run the bottom of the page, spilling into the bottom page number and out of the established “text area”. Is there a reason for this? Should I “renewcommand” the text area for this page in particular?

    Any help would be greatly appreciated.

    Sincerely,
    N.

    • Hey Nam,

      I need to see what packages/documentclass and other commands you use. In general, LateX will break the list-of-figures automatically. You could manually add a page break, but I’m sure there is a cleaner way to do it.

      \addtocontents{lof}{\clearpage}

      So please provide a minimal example. Thanks!

      Best, Tom.

  167. Nam Nguyen

    Much thanks for the prompt response!

    Attached is the relevant code that produces the same issue.

    (Minimal example shortened by Tom.)

    \documentclass [letter, 10pt]{article}
    \usepackage{graphicx}
    
    \makeatletter
    \let\l@figureOLD \l@figure
    \renewcommand{\l@figure}{\vspace*{\baselineskip}\l@figureOLD}
    \makeatother
    
    \begin{document}
    \listoffigures
    \clearpage
    \section{dummy section}
    
    \begin{figure}\centering\rule{4cm}{3cm}\caption{default}\end{figure}\clearpage
    \begin{figure}\centering\rule{4cm}{3cm}\caption{default}\end{figure}\clearpage
    \begin{figure}\centering\rule{4cm}{3cm}\caption{default}\end{figure}\clearpage
    \begin{figure}\centering\rule{4cm}{3cm}\caption{default}\end{figure}\clearpage
    \begin{figure}\centering\rule{4cm}{3cm}\caption{default}\end{figure}\clearpage
    \begin{figure}\centering\rule{4cm}{3cm}\caption{default}\end{figure}\clearpage
    \begin{figure}\centering\rule{4cm}{3cm}\caption{default}\end{figure}\clearpage
    \begin{figure}\centering\rule{4cm}{3cm}\caption{default}\end{figure}\clearpage
    
    ...
    
    \end{document}

    ————————————————–

    I had thought that this section:

    \makeatletter
    \let\l@figureOLD \l@figure
    \renewcommand{\l@figure}{\vspace*{\baselineskip}\l@figureOLD}
    \makeatother

    Had caused the problem. I want to double-space the LOF entries and so I tried commenting it out and simply putting \begin{doublespace}. While it did add the spacing, the entries still ran off the page.

    Any help would be great. I really appreciate all that you’re doing to help myself and others.

    N.

    • Hi Nam,

      You were right, this is indeed the part that causes the problem. I suspect that you didn’t see the difference after commenting it out because you only compiled the document once. Is that possible? For lists, you always have to typeset them twice, first all entries are collected and then updated. There is no way for TeX to know about changes at the beginning of the document during the first run.

      So briefly, just replace the code you already identified by:

      \usepackage{tocloft}
      ...
      \setlength\cftbeforefigskip{\baselineskip}
      \setlength\cftbeforetabskip{\baselineskip}

      That should do the trick. See the tocloft package documentation for further details.

      Another minor thing, the right documentclass option is letterpaper. Check the log-file, there should be a warning.

      Best, Tom.

  168. Nam Nguyen

    Hi Tom,

    I have tried previously tried using the tocloft package before, and it repeatedly gave errors of:

    “! LaTeX Error: Command \c@lofdepth already defined.”

    Hence why I went with the solution I had before. It appears I already have the tocloft package in the Texworks, I am reviewing the tocloft literature, but no solution appears.

    N.

    • Hey Nam,

      I can’t remember if you are loading the subfigure or subfig package. If so, please try loading the tocloft package with the following option:

      \usepackage[subfigure]{tocloft}

      Let me know if that helped.

      Best, Tom.

  169. Allan

    Hi Tom,

    I am writing an article and need to submit an appendix online (separate from the main manuscript). Figures have to be labelled Fig. A1, Fig. A2 and so forth, but when I run the script I get these labels: Fig A1, Fig. B2. Here is my script:

    \documentclass[12pt]{article}
    
    % here are the packages I use
    \usepackage{amssymb,amsmath,gensymb, supertabular, booktabs, subfigure, caption, everysel, keyval, ragged2e, setspace}
    
    % new counter to control the numbering in the figure
    \newcounter{subf}
    % making sure that the first numbering is alphabetical and the second is arabic numbering
    \renewcommand{\thefigure}{\Alph{figure}\arabic{subf}}
    
    \begin{document}
    
    % starting the counter for the first figure
    \setcounter{figure}{1}
    \setcounter{subf}{1}
    \begin{figure}
    \end{figure}
    
    % starting the second figure
    % keeping the alphabetical label constant (e.g. A)
    \addtocounter{figure}{-1}
    % adding one to the numerical subf counter
    \addtocounter{subf}{1}
    \begin{figure}
    \end{figure}
    
    \end{document}

    Any ideas of why the numerical counter is constant (when it should not be), and the alphabetical counter isn’t constant (when it should be)?

    Thanks
    Allan

    • Hi Allan,

      Would it be an option to just add an “A” and forget about the counters:

      \renewcommand{\thefigure}{A\arabic{figure}}

      Let me know if you have several appendices (section A, B, etc.) and I will help you with that.

      Best, Tom.

  170. Allan

    Hi Tom,

    Yes, that is certainly a good idea. Have no idea why that option slipped my mind…

    As always, thanks.

    Allan

    • Hi Dominic,

      Thanks for your comment. I created a minimal example and you seem to be right, I had the same problem with the cap option of the ctable package. I’ll contact the author. In the meantime, you may want to use the caption package as a quick-fix:

      \documentclass[11pt]{article}
      \usepackage{ctable, caption}
      \begin{document}
      \listoftables
      \ctable[
      	caption = Caption,
      	mincapwidth = 50mm
      ]{c}{}{\FL Table’s first row\LL}
      \captionsetup{list=no}
      \ctable[
      	cap=,
      	caption = Caption,
      	mincapwidth = 50mm,
      	continued
      ]{c}{}{\FL Table’s first row\LL}
      \captionsetup{list=yes}
      \end{document}

      Best, Tom.

  171. Ilknur

    I have a question about list of figures. In the dissertation style description, it says “List of figures: If an entry takes up more than one line, break up the entry about three-fourths of the way across the page and place the rest of it on a second line, single spacing the two lines. Double-space between entries. ” How can I do that for list of figures. I don`t have to change the captions under the figures. I have to change the captions in the list of figures. Thanks

    • Hey,

      Jeffrey J. Harden provides a template that solves the single-space problem. You can copy the relevant part of the sty-file into your preamble if you don’t want to use the template. However, I’m not sure how to change the length of the first line for multiline entries.

      Best, Tom.

  172. Daniel Meyer

    Hello Tom,
    great blog. You seem to know a lot about LaTeX. I have the following problem, which is driving me crazy. Any help would be very much appreciated.
    In the list of figures (generated by \listoffigures) there doesn’t seem to be enough space for the figure-numbers allocated. This means the figure-numbers partially overwrite the captions. The document class that I’m using is “surv-l”. This is provided by the AMS (for their “Surveys and Monograph” series), which is a modified “amsbook” documentclass. The problem is that this seems to be incompatible with “tocloft”. Just including \usepackage{tocloft} (without any actual usage of the package) results in an error

    ERROR: Missing } inserted.

    — TeX said —

    }
    l.33 \tableofcontents

    As I said before: I would be extremely grateful for any help. Best,

    Daniel.

  173. Kaur

    Hi,
    basically i am to submit my report table of contents page in the format shown below.Plz guide

    INDEX
    Chapter Page No.
    1. Introduction
    1.1 : Introduction to your domain
    1.2 : Problem statement
    1.3 : Project objective
    1.4 : System requirement.
    2. Literature survey
    2.1:
    2.1:
    2.3:
    ….

    i also need to display list of figures and list of tables title in center line in bold and uppercase format.

    Another prblm i am facing is i dont knw how to make list of abbreviation.
    Plz guide.
    Thanks.

    • Hi Kaur,

      I’m not sure I understand the details of your question.

      To change the title for the lists, use:

      \renewcommand*\contentsname{new name}
      \renewcommand*\listfigurename{new name}
      \renewcommand*\listtablename{new name}

      To add the word Page No., see this post.

      This post will help you to define a list of abbreviations. Or, use the nomencl package as shown here.

      Hope it helps. Let me know if you have any other question.

      Best, Tom.

  174. Neil

    Hi Tom,

    I am using a \documentclass[12pt]{report} for my thesis along with \listoftables and \listoffigures to generate the LOT and LOF.

    The output is like:

    FIGURE 1.1: This is the first figure in my thesis with heading more
    than two lines. 3

    FIGURE 1.2: This is the second figure in my thesis with heading more
    than two lines. 5

    But I want this to look like:
    FIGURE 1.1: This is the first figure in my thesis with heading more 3
    than two lines.

    FIGURE 1.2: This is the second figure in my thesis with heading more 5
    than two lines.

    Note: Where 3 and 5 are the page numbers.
    The thesis guideline is that the page numbers has to be on the right end of the first line of the figure headings and table headings.

    Could you please help me to get this?

    Thank you in advance.

    Neil.

    • Hi Neil,

      Try the following code. It redefines the list of figure entry style using a tabular. Not very elegant, but it works.

      \documentclass[11pt]{report}
      \usepackage{blindtext}
      \usepackage{titletoc, setspace}
      \titlecontents{figure}[0pt]
      {\normalfont\mdseries\singlespace}
      {\contentspush{FIGURE \makebox[4em][l]{\thecontentslabel:}}\begin{tabular}[t]{@{}p{8cm}@{}}}
      {\hspace{-2em}\begin{tabular}[t]{p{11cm}}}
      {\end{tabular}\hfill\contentspage}
      \begin{document}
      \listoffigures
      \chapter{First chapter}
      \section{First section}
      \begin{figure}[ht]
      \centering
      \rule{4cm}{3cm}
      \caption{\blindtext}
      \label{fig:dummy}
      \end{figure}
      \end{document}

      I found the code here.

      Best, Tom.

      • Neil

        Hi Tom,

        Your reply solved the part of the problem. The LOF now has a single space through out. But I would like to have a double spaced between the entries.

        FIGURE 1.1: The first figure 3

        FIGURE 2.1: This is the first figure of chapter 5
        two with a double line heading.

        The spacing between FIGURE 1.1 and FIGURE 2.1 has to be double and the spacing within the FIGURE 2.1 has to be a single spaced.

        Could you please tell me what part of the following code need to be changed to get this?

        \titlecontents{figure}[0pt]
        {\normalfont\mdseries\singlespace}
        {\contentspush{FIGURE \makebox[4em][l]{\thecontentslabel:}}\begin{tabular}[t]{@{}p{8cm}@{}}}
        {\hspace{-2em}\begin{tabular}[t]{p{11cm}}}
        {\end{tabular}\hfill\contentspage}

        Thank you for your help. I really appreciate.

        Neil

  175. Jimena

    Hi Tom!
    I am using a {book} document class for my thesis and I have used \textmd in all my sections to remove the bold formatting on the titles. However, I don’t know how to remove the bold formatting from “List of Figures” so it doesn’t appear bold in the TOC. Can you help me?
    Thanks a lot
    Jimena

    • Hi Jimena,

      The tocloft package provides a lot of flexibility with the toc/lof/lot formatting. Use the following commands to make the chapter headings in the TOC normalfont.

      \documentclass[11pt]{book}
      \usepackage{tocloft}
      \renewcommand{\cftchapfont}{}
      \renewcommand{\cftchappagefont}{\normalfont}
      \begin{document}
      \tableofcontents
      \addcontentsline{toc}{chapter}{List of Figures}
      \listoffigures
      \chapter{First}
      \section{First}
      \begin{figure}[ht]
      \centering
      \rule{4cm}{3cm}
      \caption{default}
      \label{default}
      \end{figure}
      \end{document}

      Also, see this TeX FAQ on how to change section heading style.

      Best, Tom.

  176. Sofía J.

    Hi, I’ve inserted the same figure twice, but I don’t want the second one to be shown in the TOF.
    How do I do that?

    Thanks ;)

    • Hi!

      The caption package will do the trick.

      \documentclass[11pt]{article}
      \usepackage{caption}
      \begin{document}
      \listoffigures
      \begin{figure}[ht]
      \begin{center}
      \rule{4cm}{3cm}
      \caption{First figure with LOF entry}
      \end{center}
      \end{figure}
      \begin{figure}[ht]
      \begin{center}
      \rule{4cm}{3cm}
      \caption[]{Second figure without LOF entry}
      \end{center}
      \end{figure}
      \end{document}
      • Whotee

        Thanks Tom. It works for text mode only, though I have to use them inside maths mode. Consequently I use them like this:

        $\textbf{\straighttheta}$

        Not sure if the usage is correct?

      • I couldn’t find a package that implements straighttheta.
        Seems you need bold in addition. Try this:

        \documentclass{article}
        \usepackage[euler]{textgreek}
        \begin{document}
        % example usage
        $f(x)=\textbf{\texttheta}x^2+\textbf{\texttheta}^2x+\textbf{\texttheta}^3$
        \end{document}

        Cheers, Tom.

      • Whotee

        Thanks again.
        It seems that

        $\textbf{\straighttheta}, \textbf{\textlambda}, \textbf{\textnu}, \textbf{\textomega}$

        works, while

        $\textbf{\texttheta}$

        gives variable theta (straight and bold). I think it looks ok now.

  177. gilberto

    I have a problem with \ listoffigures when working with figures use the extension eps and the command \ listoffigures dosen’t work

    • Hi Gilberto,

      This works for me with pdflatex:

      \documentclass[11pt]{article}
      \usepackage{graphicx}
      \begin{document}
      \listoffigures
      \begin{figure}[!ht]
        \centering
        \includegraphics{path/to/figure.eps}
        \caption{Default}\label{fig:default}
      \end{figure}
      \end{document}

      Best, Tom.

  178. Emivan

    Hello, good morning.
    To put the word “Figure” before the number in the list of figures I used the command:

    \ renewcommand {\ cftfigfont} {Figure }

    But, I had problem: I would like the result to be like this:

    Figure 1 A new way to write a text
    without worrying 10
    Figure 2 New Horizon 22

    What was obtained as follows:

    Figure 1 A new way to write a text
    without worrying 10
    Figure 2 New Horizon 22

    How do I push the word “without” forward?

  179. Emivan

    To clarify the above question. I would like the word “without” has start under the letter A, ie w stand under A.

    • Hi and thanks for your question.

      I suggest using the cftfigpresnum command instead to add the word “Figure” in front of the number. The rest is nicely documented in the tocloft package documentation.

      \documentclass[11pt]{article}
      \usepackage{tocloft, blindtext}
      \renewcommand{\cftfigpresnum}{Figure }
      \newlength{\mylen}
      \settowidth{\mylen}{\bfseries\cftfigpresnum\cftfigaftersnum}
      \addtolength{\cftfignumwidth}{\mylen}
      \begin{document}
      \listoffigures
      \begin{figure}[ht]
      \centering
      \rule{4cm}{3cm}
      \caption{\blindtext}
      \label{default}
      \end{figure}
      \end{document}
  180. catherine phaneuf

    I have a problem with \minilof
    I am making a list of figure at the end of every chapters. In my list of figure the page number is wrong. Figure 1.1 is on page 43 and in the list of figure the figure page number is 45.

    How can I fix this problem. Could I manually give my figure their page number ?

    \minilof
    
    \begin{figure}\addcontentsline{toc}{section}{Figures}
    \hspace{-1cm}
          \includegraphics[width=19cm,height=18cm,angle=90]{geol.eps}
    \caption[\protect\vspace{0ex}{Simplified geological map of the Sudbury region and the surrounding area. In the lower left square is a map of Canada showing the location of the Sudbury region. See Figure 2 for details on the geology in the Sudbury area. The red star shows the location of SNOLAB.}]{Figure 1.1}
    \end{figure}
    
    \clearpage
    
    \begin{figure}
    \hspace{-1cm}
          \includegraphics[width=17cm,height=17cm]{geolzoom.eps}
    \caption[Detailed geological map of the Sudbury region.]{Figure 1.2}
    \end{figure}
    
    \clearpage

    Thank you

    • Hi Catherine,

      Thanks for your comment. The minitoc package generally gives the correct page number. I suppose the problem is elsewhere. Take a look at the minimal working example below and consider reading my post on the topic. If the problem persists, please provide a minimal example similar to the one below to illustrate you issue.

      Thanks, Tom.

      \documentclass[11pt]{report}
      \usepackage{minitoc, blindtext}
      \begin{document}
      \dominilof
      \tableofcontents
      \listoffigures
      \chapter{First}
      \Blindtext
      \chapter{Second}
      \Blindtext
      \begin{figure}\centering\rule{4cm}{3cm}\caption{Dummy figure 1}\end{figure}
      \clearpage
      \begin{figure}\centering\rule{4cm}{3cm}\caption{Dummy figure 2}\end{figure}
      \Blindtext
      \minilof
      \chapter{Third}
      \Blindtext
      \end{document}
  181. Whotee

    Dear Tom
    I have three types of names (algorithm, Protocol, Functions) for pseudocode, so I use following lines to change the default name (algorithm):

    \floatname{algorithm}{Protocol}
    \begin{algorithm}

    \end{algorithm}

    Things work well, except that there is one counter for all three, while I need separate counters for them. I guess somehow I have to define new floats for them separately. I have no idea how to do it? I hope the solution would be such as to support building their lists such as:

    List of Algorithms
    List of Protocols
    List of Functions

    Second question: do you also support questions on Tikz, or know some other forum?

    Thanks in advance, and best regards

    Whotee

  182. Daniel

    Hi Tom
    I’m using a documentclass[a4paper,12pt,oneside]{report} and I want all the pages are not numbered until chapter Introduction.

    When I generate a list of figures (listoffigures) and summary (tableofcontents), the first page is numbered and the other not. For example, the list of figures comprises three pages, the first is numbered and not the other two.

    I am using the following commands:

    \pagestyle{empty}
    \listoffigures
    \thispagestyle{empty}
    
    \pagestyle{empty}
    \tableofcontents

    Well, I thank your help.

    • Hi Daniel,

      This should work.
      Best, Tom.

      \documentclass[12pt]{report}
      \usepackage{blindtext, pgffor}
      \pagestyle{empty}
      \begin{document}
      \addtocontents{toc}{\protect\thispagestyle{empty}}
      \tableofcontents
      \addtocontents{lof}{\protect\thispagestyle{empty}}
      \listoffigures
      \clearpage
      \pagestyle{plain}
      
      \chapter{Dummy chapter}
      
      \foreach \n in {0,...,30}{
      	\begin{figure}[ht]
      		\begin{center}
      			\rule{\textwidth}{0.75\textwidth}
      			\caption{default}
      			\label{fig:\n}
      		\end{center}
      	\end{figure}
      	\Blindtext
      }
      \end{document}
  183. Jonas

    Hi,
    I’m writing my thesis using LED and the scrartcl documentclass. However, when including the \listoffigures and/or the \listoftables command I receive an error message saying

    Package etoolbox Error! Boolean ‘\ifciterequest’ undefined.

    1.1 \boolfalse {citerequest}
    \boolfalse {citetracker} \boolfalse {pagetracker}

    Does anybody have an idea about how to solve this?

    Thanks in advance!

    Regards
    Jonas

    • Hi Jonas,

      I would need to see some code to be able to help. Please provide a minimal working example.
      Do you have the latest version of etoolbox and biblatex?

      Thanks, Tom.

      • Jonas

        Hi Tom, thanks for your quick answer.
        As for my biblatex and etoolbox, I have no idea about the current version I’m using. will check that immediately
        my header and some lines of code as a minimum example.

        \documentclass[fleqn, 12pt, listof=totoc]{scrartcl}
        \usepackage{pslatex}
        
        \renewcommand{\baselinestretch}{1.5}
        \usepackage{geometry}
        \geometry{a4paper, top=30mm, left=35mm, right=25mm, bottom=25mm,
                 headsep=0mm, footskip=10mm}
        \usepackage{fancyhdr}
        \usepackage{booktabs}
        \usepackage{multirow}
        \usepackage[ngerman]{babel}
        \usepackage[ansinew]{inputenc}
        \usepackage[babel,german=quotes]{csquotes}
        \usepackage{dsfont}
        \usepackage{color}
        \usepackage{amsthm}
        \usepackage{amsmath}
        \usepackage{amsfonts}
        \usepackage{enumitem}
        \usepackage{ulem}
        \usepackage{amssymb}
        \usepackage{mdwlist}
        \usepackage{units}
        \usepackage{pxfonts}
        \usepackage[T1]{fontenc}
        \usepackage{tabularx}
        \usepackage{tocloft}
        \usepackage{graphicx}
        \begin{document}
        \listoffigures
        \newpage
        \section{s1}
        \subsection{s2}
        This is what I want to show in the next figure.
        \begin{figure}[h]
        \caption{This is what I want in my lof}
        \includegraphics{file.eps}
        \label{file}
        \end{figure}
        some text referring to figure \ref{file}
        \end{document}
      • Hi Jonas,

        I have no problems running the code. Please try updating the aforementioned packages to their latest version. Not sure which LaTeX distribution you are using, TeXLive comes with tlmgr, which is a nice tool to update packages.

        To check the version and update packages, use:

        tlmgr info etoolbox
        tlmgr info biblatex
        # check outdated packages
        tlmgr update --list
        # update packages
        tlmgr update --all

        From my system:

        Etoolbox:
        installed:   Yes
        revision:    20922
        cat-version: 2.1
        
        Biblatex:
        installed:   Yes
        revision:    28404
        cat-version: 2.4

        HTH, Tom.

  184. Whotee

    hi Tom

    I have an equation on three lines, with a single number.

    \begin{equation}
    \begin{split}
      &\pi + \pi + \pi &\\
      &\pi + \pi &\\
      &\hfill \pi &
    \end{split}
    \end{equation}

    I need to centralize the first line, while second line should align the first line on left side. This works well. The third line should align the second line on the right side. This does not work. I have tried other options like using align, but it does not work.

    Thanks in advance.
    Kind regards
    Whotee

    • Hi Whotee,

      Try the following code and let me know if that’s not what you needed. Best, Tom.

      \documentclass[10pt]{article}
      \usepackage{amsmath}
      \begin{document}
      \begin{equation}
      	\begin{split}
      		\pi + \pi& + \pi\\
      		\pi + \pi&\\
      		\pi
      	\end{split}
      \end{equation}
      \end{document}
      • Whotee

        hi Tom
        thanks. I sent some very simple code to let you know my question. In reality these lines of code are bit more complex and not all terms are of equal width. I make one more example to clarify my point, in which this does not work (lines 1,2 to be left aligned, lines 2,3 to be right aligned)

        \begin{equation}
        	\begin{split}
        		\alpha + \beta& + \frac{\gamma^2}{\delta+n+Limit}\\
        		\frac{S}{t-y^3} + i^\j \cdot k&\\
        		\pi
        	\end{split}
        \end{equation}

        I really need this solution for any characters and math symbols.

        Thanks, and best regards

      • I see. It seems that you are trying to use an alignment point for only a subset of the equations. One work-around could be the \phantom command, which inserts a blank space of the size of its argument. Try this:

        \documentclass{article}
        \usepackage{amsmath}
        \begin{document}
        \begin{align}
        	&\alpha + \beta + \frac{\gamma^2}{\delta+n+Limit}\\
        	&\frac{S}{t-y^3} + i^j \cdot k\\
        	&\phantom{\frac{S}{t-y^3} + i^j \cdot{}}\pi
        \end{align}
        \end{document}

        What do you think?

      • Whotee

        Thanks Tom.
        Please have a look at this code:

        \begin{align}
        	&\alpha + \beta + \frac{\gamma^2}{\delta+n+Limit}\\
        	&\frac{S}{t-y^3} \cdot k \cdot \frac{a}{\bp{b+c+d}^2}\\
        	&\phantom{\frac{S}{t-y^3} \cdot k \cdot \frac{a}{\bp{b+c+d}^2}}\pi
        \end{align}

        For third row, I need to go extreme right of second row MINUS the width of the third row — so that right side of second and third rows are aligned. How can we create white space of the size of difference of two phantoms?

        Thanks in advance.

      • Hi Whotee,

        I just found this on tex.SX.

        Btw., you didn’t specify what \bp{} does or which package needs to be loaded, so I removed it in the code below.

        \documentclass[11pt]{article}
        \usepackage{amsmath}
        \makeatletter
        \newcommand{\pushright}[1]{\ifmeasuring@#1\else\omit\hfill$\displaystyle#1$\fi\ignorespaces}
        \makeatother
        \begin{document}
        \begin{align}
        &\alpha + \beta + \frac{\gamma^2}{\delta+n+Limit}\\
        &\frac{S}{t-y^3} \cdot k \cdot \frac{a}{(b+c+d)^2}\\
        & \pushright{\pi}
        \end{align}
        \end{document}
  185. james

    Hi Tom

    How do I change the names of the figures appearing in the list of figures without changing their reference/caption in the actual body of text?

    Cheers
    James

  186. Cesar

    Hi Tom,

    I hope that this is not a repeated question, I’ve tried to found it here but couldn’t.

    I have two commands which are relevant:

    \tableofcontents
    \listoftables

    I do not want the table counter on. I was able to turn it of for the sections using \setcounter{secnumdepth}{0} but I am not able to disable this for the table *(using \setcounter{lotdepth}{0}. To help, what I actually have is

    S1 Geometry of hydrogen bonds and short intramolecular contacts. . . . . . . . . . . S3
    S2 Crystallographic data of complexes 2 and 4 . . . . . . . . . . . . . . . . . . . . . S4
    S3 Crystallographic data of complexes 7 and 8 . . . . . . . . . . . . . . . . . . . . . S5
    S4 Crystallographic data of complexes 9, 10 and 11 . . . . . . . . . . . . . . . . . . . S7

    and what I want is

    Geometry of hydrogen bonds and short intramolecular contacts. . . . . S3
    Crystallographic data of complexes 2 and 4 . . . . . . . . . . . . . . . . . . . . . S4
    Crystallographic data of complexes 7 and 8 . . . . . . . . . . . . . . . . . . . . . S5
    Crystallographic data of complexes 9, 10 and 11 . . . . . . . . . . . . . . . . . S7

    Is there a way of doing this?

    Thanks!!!!

    • Hi Cesar,

      Just set the table counter to “nothing” and use the tocloft package to get rid of the additional white space reserved for the number in the list-of-tables.

      \documentclass[11pt]{article}
      \usepackage{tocloft}
      \renewcommand{\thetable}{}
      \setlength\cfttabnumwidth{0pt}
      \begin{document}
      \listoftables
      \begin{table}[ht]
      \caption{default}
      \centering
      \begin{tabular}{|c|c|}
      \hline
      a&a\cr
      b&b\cr
      \hline
      \end{tabular}
      \label{tab:tab}
      \end{table}%
      \end{document}

      HTH,
      Tom

  187. Dear Tom,

    I am using \listoftables, \listoffigures and \tableofcontents to generate the LOT, LOF and TOC. I am including the various chapters in my thesis as separate \included tex files. I also have appendices. My problem is the TOC, LOF, LOC – all of them appends a “Figure” to the numbers.

    e.g. in TOC instead of Chapter 1, it shows as Figure 1, instead of Section 1.1 it is Figure 1.1, Table 1.1 becomes Figure 1.1, and the appendices show as Appendix Figure A, etc. etc.

    What am I doing wrong. Thanks for your help

    • hi pahadi!

      Thanks for your comment. Please provide a minimal working example, like the one below, to illustrate what you are describing. My example only shows numbers in TOC, LOF and LOT.

      Thanks,
      Tom

      \documentclass[11pt]{report}
      \begin{document}
      \tableofcontents
      \listoffigures
      \listoftables
      \chapter{main}
      \section{First}
      \begin{figure}[ht]\caption{figure1}\label{fig:1}\end{figure}
      \begin{table}[ht]\caption{table1}\label{tab:1}\end{table}
      \section{Second}
      \begin{figure}[ht]\caption{figure2}\label{fig:2}\end{figure}
      \begin{table}[ht]\caption{table2}\label{tab:2}\end{table}
      \end{document}
      • pahadi

        Tom,

        Thanks for your reply. I managed to fix the problem. It was arising out of multiple bib style files, one in the main file and one a few lines below it – a remnant from one of the include files.

        Talk about individualism regarding styles !

  188. Emivan

    Hello, my name is Emivan.
    I’ve got two problems to finish my thesis in latex. I use TeXnicCenter to type my texts and am using the document class ABNT.
    1 – In the abstract of the title references, appendices and indexes are not aligned with chapter titles and the library does not accept if not all aligned.
    2 – Within the text, titles of sections and subsections are different from those that were placed in the summary. In size and font. How can I solve this?
    If you can help me I appreciate it.

  189. Ahmad

    hey all, I am writting my thesis an dI have some problems in list of figures,
    the caption of figures exceed the page width like:
    3.2 Achieved sum rate for one way and two way AF and DF ….39
    3.3 The achieved sum rate of the proposed GA, the ES algorithm, and the optimal solution

    how can I make the second figure as:
    3.3 The achieved sum rate of the proposed GA, the ES
    the optimal solution …………………………………………………..40

    Thanks in Advance

  190. Whotee

    hi Tom

    I have a problem for rowcolor for multirow. As you will see, Carrots and 10 are half hidden by late arrival of rowcolor. This is part of a big table, in which I need to control rowcolor for multirow situation.

    \begin{table}[!h]
    \centering
    \begin{tabular}{c|cc}
    \hline
    Apples & 1 & 2\\
    \rowcolor[gray]{.97}
    \multirow{2}{*}{Carrots} & \multirow{2}{*}{10} & 20\\
    \rowcolor[gray]{.97}     & & 30\\
    \end{tabular}
    \end{table}

    Thanks in advance.

    Kind regards
    Whotee

    • Hi Whotee,

      Thanks for your question. The text is half hidden, because the color is added after the text. You can solve this problem by adding the text from the lower cell using a “negative multi row number”. Here is your example as a MWE:

      \documentclass[11pt]{article}
      \usepackage{xcolor, colortbl, multirow}
      \begin{document}
      \begin{table}[!h]
      \centering
      \begin{tabular}{c|cc}
      \hline
      Apples & 1 & 2\\
      \rowcolor[gray]{.97} & & 20\\
      \rowcolor[gray]{.97}\multirow{-2}{*}{Carrots}& \multirow{-2}{*}{10}& 30\\
      \end{tabular}
      \end{table}
      \end{document}
  191. Whotee

    hello Tom

    Please see this code:

    \begin{equation}\label{sm-e-be}%balance eq.
    \begin{array}{rcl}
    \pi = && \frac{1}{\alpha+\beta} + \frac{\alpha}{\alpha^2+\beta} + \frac{\alpha^2}{\alpha^3+\beta^2} + \frac{\alpha^3}{\alpha^4+\beta^3} + \frac{\alpha^4}{\alpha^5+\beta^4}\\
          &+& \frac{\sum_{1 < i < j} x_i + \prod_{z \in Z} \Delta^z}{\zeta - \Theta} - \omega \cdot \kappa \\
          && 0 \LE j \LE J, 0 \LE Z \LE W_j.
    \end{array}
    \end{equation}

    It has two problems:
    1. There is extra space after =. I want + of line 2 to appear after = of line 1, but without extra space. The equations after = and + should be left aligned, as they are now.
    2. I want line 3 to right align with line 2.

    Overall, all eqs are central.
    Earlier I posted about it, but still I am looking for solutions to these issues.

    Thanks in advance.
    regards
    whotee

    • Hi Whotee,

      Below is a simplified version of your equation. You just have to replace the dummy content with your code.

      1. You just have to put the ‘&’ in the right places
      2. I define \mylength and set it to the width of line 2. Then I define a box of that width and right-align the equation of line 3 in that box.

      Hope it works!

      \documentclass[11pt]{article}
      \usepackage{amsmath}
      
      \newlength\mylength
      \settowidth{\mylength}{$+c$}
      
      \begin{document}
      \begin{equation}\label{sm-e-be}%balance eq.
      \begin{array}{rcl}
      a & = & b\\
      && + c\\
      &&\makebox[\mylength][r]{$d$}\\
      \end{array}
      \end{equation}
      \end{document}
      • Whotee

        Thanks Tom. The technology works. In my case, I have to calculate width of $\textgamma$ like symbols, for which

        \newlength\mylen\pgfmathsetlength{\mylen}{\widthof{$...$}}}

        is giving error. Without much knowing, I tried

        \newlength{\mylen}
        \getWidth{\mylen}{$...$}

        which luckily works. Maybe you can enlighten.

        Thanks a lot.
        Whotee

      • Hi Whotee,

        If this works it means you are loading a package that implements \getWidth{}{} which does exactly what you need. I wasn’t able to figure out which package though. If you are interested, you can create a minimal working example and add packages until you don’t get the error “Undefined control sequence \getWidth”.

        Your code is very similar to what I published on my blog (changed it a few times after I submitted the original reply you saw). Instead of \getWidth{}{}, I use \settowidth{}{}, a command provided by TeX/LaTeX. I suspect the error you get when using the original command is due to the back and forth between math and non-math ($\textgamma$ produces a non-math gamma character). The calc package might not like that. But that’s just a guess.

        Hope this helps,
        Tom

  192. Emivan

    Please, I need to reference an article conference and would like the document compiled after she got well:

    BERTOLDI, O.; CICORA, R. The loden program: a linear methodology for the automatic selection of long-term-expansion alternatives, with security constraint, is a power transmission systems. In: POWER SYSTEM COMPUTER CONFERENCE, 8., 1984 Helsiski. Proceedings … Helsiski: [s.n.] 1984.

      • Robin Ahmed

        Tom
        I am using report class to make my own style file. I used \listoftables and \listoffigures command. They appear in first two lines of my TOC with page numbers. But according to my thesis requirement, these two lines should be removed from TOC (they I need lof and lot to just after my TOC). Can you pls help me?

  193. Hi Tom,

    I’m using a report class for my final year thesis.
    The problem is, the Nomenclature, Unnumbered Chapter “Introduction” and Abstract are being shown as subsections in the List of Tables, like:

    List of Figures
    List of Tables
    – List of Tables
    – Nomenclature
    – Abstract
    – Introduction

    This happens when I compile as PDF, and open with any PDF reader. In the sections pane on the left, Nomenclature, Abstract, Introduction and List of Tables are being shown as SUBSECTIONS to a section named List of Tables.

    How do I make Nomenclature, Abstract, Inroduction appear as separate topics in the section tree on a PDF reader?

    Thanks.

    • Hi Sriram,

      I tried, but couldn’t reproduce the problem (see code below). Please send a minimal working example that I can compile and look at in Adobe Reader.

      Thanks, Tom

      \documentclass{report}
      \usepackage[nottoc]{tocbibind}
      \usepackage{blindtext}
      \usepackage{hyperref}
      
      \begin{document}
      
      \chapter*{Abstract}
      \addcontentsline{toc}{chapter}{Abstract}%
      \blindtext
      
      \tableofcontents
      \listoffigures
      \listoftables
      \chapter*{Un-numbered}
      \addcontentsline{toc}{chapter}{Un-numbered}
      \section*{Test section}
      \addcontentsline{toc}{section}{Test section}
      \chapter{Numbered}
      \section{Test section}
      
      \end{document}
  194. hanen

    Hi Tom,
    thanks for your quick answer.
    I had a problem with the \listoffigures and \listoftables comand. They not appear (they are empty), what can I do? Thank you very much for any help you can give me.

    Here are some lines of my code :

    %code removed by Tom.
    ...
    \begin{figure}[!h] %dans cet emplacement
    \begin{center}
    \includegraphics{images/vide.pdf}
    \end{center}
    \end{figure}
    ...
    • Hi Hanen,

      I removed most code, since it was really long. Just kept the part where the problem lies. You are missing captions in your figure environment. Captions produce the list entries. Below is a stub showing how to include figures (similar for tables). The label is optional if you don’t reference the figure.

      \begin{figure}[ht]
      \begin{center}
      \includegraphics{figure-file}
      \caption{Figure caption}
      \label{fig:myfig}
      \end{center}
      \end{figure}

      Another thing, you load several package multiple times (color, hyperref). Try cleaning up your preamble.

      HTH, Tom

      • hanen

        Hi Tom,
        Yes, i integrates the figures with this structure in the chapter,

        \begin{figure}[!h]
        \begin{center}
        \includegraphics[width=260,height=285]{images/twitFace.png}
        \end{center}
        \caption{Le trafic...}
        \label{twitFace}
        \end{figure}

        but in the main page (The code that I have already sent), when I made ​​\listoffigures, it appears empty.

        Can you please help me?
        Thanks in advance.

      • Hi!

        Just a few question/suggestions that might help to locate and fix your problem:

        - Do the figures show in the document?
        - Did you compile the document twice to get list-of-figures/tables?
        - Take a look at the log file. What warnings does it show?
        - If these things don’t help, I suggest you start with a very simple tex-document, remove all packages, add a single figure and keep adding stuff until the list-of-figure entries disappear. Always typeset twice. When I ran your original code, after removing a few packages (algorithm related) that I didn’t have, the list-of-figures was produced normally.
        - Finally, I’d place caption and label within center-environment. There is extra whitespace between figure and caption the way you did it.

        HTH, Tom

  195. hanen

    Hi Tom,
    Thanks for your advice, i succeed to find the solution
    it’s just scheduling of \usepackage in the main page.
    Thanks a lot.

  196. Xin Jin

    Hi Tom,
    I am trying to creat a report with content table, list of figures and list of tables. The first two works fine. But I couldn’t get a list of tables (there’s space created for it but it’s a blank page). Other parts of the report work fine.

    I tried created a seperate file of only tables to see if my table codes are OK and they are. I used the same packages in preamble, copied and pasted the table contents to a different .tex file, and used xeLatex to compile, and it worked.

    It’s only when the table codes are in the report that xeLatex cannot generate a list of tables. I checked the .aux file and see:

    “\@writefile{lot}{\contentsline {table}{\numberline {1.1}{\ignorespaces \bfseries Overview of Crude Oil Prices Persistence\relax }}{23}{table.1.1}}
    \providecommand*\caption@xref[2]{\@setref\relax\@undefined{#1}}
    \newlabel{tab:adftest}{{1.1}{23}{\bfseries Overview of Crude Oil Prices Persistence\relax \relax }{table.1.1}{}}”

    but the lot file is actually empty.

    Any suggestions? Thanks in advance.

    • Hi!

      Not sure why your table of contents isn’t produced in the document.
      Please send a minimal working example and I will take a look.

      Cheers, Tom.

  197. clemens

    Hi,

    I am trying to use the LoF/LoT short name as part of the caption label.

    So the following:

    \caption[Short name]{Long version of the caption.}

    should result in:

    Figure 1.1: Short name. Long version of the caption.

    I’ve scrolled through the comments and haven’t found anything applicable yet. Any advice would be appreciated.

    Cheers, Clemens.

    • Hi Clemens,

      You could redefine the way captions are typeset (see code below). In case you are using \caption* of the caption package, things will get more complicated, at least with this solution.

      Best, Tom

      \documentclass[11pt]{article}
      \usepackage{ifthen}
      \let\savedCaption=\caption
      \renewcommand*{\caption}[2][]{%
      	\ifthenelse{\equal{#1}{}}{\savedCaption[#2]{#2}}{\savedCaption[#1]{#1 #2}}
      }
      
      \begin{document}
      
      \tableofcontents
      \listoffigures
      \section{First section}
      \begin{figure}[ht]\centering\rule{\textwidth}{0.5\textwidth}\caption{First figure.}\label{fig:1}\end{figure}
      \begin{figure}[ht]\centering\rule{\textwidth}{0.5\textwidth}\caption[Short caption.]{Second figure.}\label{fig:2}\end{figure}
      
      \end{document}
      • clemens

        Thanks for the advice. Based on your code, the following does exactly what I wanted (caption short title in bold):

        \documentclass[11pt]{article}
        
        \usepackage{ifthen}
        \let\savedCaption=\caption
        \renewcommand*{\caption}[2][]{%
            \ifthenelse{\equal{#1}{}}{\savedCaption[#2]{#2}}{\savedCaption[#1]{\textbf{#1.} #2}}
        }
        
        \begin{document}
        
        \tableofcontents
        \listoffigures
        \section{First section}
        \begin{figure}[ht]\centering\rule{\textwidth}{0.5\textwidth}\caption{First figure.}\label{fig:1}\end{figure}
        \begin{figure}[ht]\centering\rule{\textwidth}{0.5\textwidth}\caption[Short caption]{Second figure.}\label{fig:2}\end{figure}
        
        \end{document}

        Thank you Tom and cheers, Clemens.

  198. djurikom

    Hi Tom,

    I am trying to make my Abstract, Contents, LoF and LoT titles centered and uppercase. Now, I managed to do it for Contents with

    \renewcommand{\contentsname}{\uppercase{\centering Table of Contents}}

    However I can not do it for the rest for some reason. The best I could do was make it uppercase, as here:

    \renewcommand*\listfigurename{LIST OF FIGURES}
    \renewcommand*\listtablename{LIST OF TABLES}
    \renewcommand*\abstractname{ABSTRACT}

    Is there a way to do it for the remaining titles as well? Thanks!

    • Hi there!

      In case you have the latest version of the tocloft package, you can use \hfil as shown below to center the titles.

      \documentclass{article}
      \usepackage{tocloft, blindtext}
      \renewcommand*\cfttoctitlefont{\hfil\bfseries}
      \renewcommand*\cftloftitlefont{\hfil\bfseries}
      \renewcommand*\cftlottitlefont{\hfil\bfseries}
      \renewcommand*\contentsname{\uppercase{table of contents}}
      \renewcommand*\listfigurename{\uppercase{list of figures}}
      \renewcommand*\listtablename{\uppercase{list of tables}}
      \renewcommand*\abstractname{\uppercase{abstract}}
      \begin{document}
      \tableofcontents
      \listoffigures
      \listoftables
      \begin{abstract}
      \blindtext
      \end{abstract}
      \section{Some section}
      \subsection{Some subsection}
      \end{document}
      \end{document}
  199. Vicente

    Hi Tom.

    I want to include twice a list of a new float, after the table of contents of the book and after the cover of a part of the book. If I type \listof{…} in these places, it appears only the first time, and not the second. How do I fix it?

    Thank you.

    Vicente

    • Hi Vincente,

      Thanks for your question. If I understand correctly, your aim is to have a list of figures and tables for each part of your book. I can think of two possible ways to do this. You could either define a new float type for the second part of the book (caption package), or use the minitoc package and specifically \partlof and \partlot.

      If you need help with either of these, please provide a minimal working example and I’ll be happy to look into it.

      Cheers, Tom

  200. Christian

    Almost done putting the finishing touches to my thesis, now there is only one formatting issue left:
    I have three different lists, that need to come at the end of my document. Using the report class, each of these should be a section within one chapter “Lists”: list of tables and bibliography (which are generated automatically) and another list that I did manually.
    I having trouble removing the title of my list of tables. I’m supposed to have a structure like this:

    5. Lists
    5.1 List of tables
    5.2. Other list
    5.3 Bibliography

    I managed to get rid of the “Bibliography” title but my structure (in the text itself) still looks like this:

    5. Lists
    5.1 List of tables
    List of tables
    5.2 Other list
    5.3 Bibliography

    The numbered entries I created myself with \section, the second “List of tables” entry however LaTeX creates automatically. I found a workaround to remove the title itself, by defining it as empty, but this still leaves me with a lot of white space and makes the whole thing look pretty silly.

    Any help would be really appreciated. Thanks!

    • Hi Christian,

      Thanks for your question. Please provide a minimal working example to illustrate the issue and I’ll be happy to take a look. You can post the code here.

      Thanks, Tom

      • Christian

        Tom, thanks for getting back to me so quickly.

        This is my MWE (first time I’m doing this, I hope it’s minimal enough :))

        \documentclass[12pt]{report}
        \usepackage{booktabs}
        
        \begin{document}
        
        \chapter{Some Chapter}
        \begin{table}[h]
        \begin{tabular}{@{}llrlrlrlr@{}}
        \toprule
        Item  & 1 & 2 & 3  & 4
        \\ \bottomrule
        \end{tabular}
        \caption{Some sample table}
        \end{table}
        
        \chapter{Other Chapter}
        
        \chapter{Lists}
        
        \section{List of tables}
        
        \listoftables
        \end{document}

        See how the unnumbered “List of tables” chapter title is added? Also the list itself should of course not start on an extra page but right below 3.1. Thanks again for your help!

      • Hi Christian,

        Thanks for your MWE! I think what you want to do is redefine the toc, lof, and lot commands. Take a look at my code and let me know if you have further questions.

        Tom.

        \documentclass[12pt]{report}
        \usepackage{booktabs}
        
        \makeatletter
        \renewcommand\tableofcontents{%
        	\section{\contentsname}%
        	\@mkboth{\MakeUppercase\contentsname}%
        		{\MakeUppercase\contentsname}%
        	\@starttoc{toc}%
        }
        \renewcommand\listoftables{%
        	\section{\listtablename}%
        	\@mkboth{\MakeUppercase\listtablename}%
        		{\MakeUppercase\listtablename}%
        	\@starttoc{lot}%
        }
        \renewcommand\listoffigures{%
        	\section{\listfigurename}%
        	\@mkboth{\MakeUppercase\listfigurename}%
        		{\MakeUppercase\listfigurename}%
        	\@starttoc{lof}%
        }
        \makeatother
        
        \begin{document}
        \chapter{Some Chapter}
        \begin{table}[h]\caption{Some table}\end{table}
        
        \chapter{Other Chapter}
        \begin{figure}[ht]
        \centering\rule{6cm}{4cm}\caption{Some figure}\end{figure}
        
        \chapter{Lists}
        \tableofcontents
        \listoffigures
        \listoftables
        \end{document}
      • Christian

        Tom, this is amazing! From your MWE this seems to be exactly what I was looking for. Will need to test it in my actual document, but this could very well be the solution. I’ll let you know! Christian

  201. Flaces

    hi Tom

    Please help on keeping capitalization of Title string in references. I have too many references to edit each one using {} to keep Title text as it is. I have tried two ways:

    1.

    \bibliographystyle{abbrv} % also plain style
    \bibliography{references}

    Title capitalization is not preserved.

    2.

    \usepackage{biblatex}
    \addbibresource{references.bib}
    \printbibliography

    Title capitalization is preserved but many of my references are broken, and I get many error messages.

    Originally I am using the first way. Is there some option or style that I can use to keep title capitalization as it is, without having to edit my hundreds of references for the thesis?

    Thanks in advance.

    Kind regards
    Flaces

    • tom

      Hi there,

      You could use regex to enclose capital letters in curly brackets. However, I’d recommend moving to biblatex. Please provide a minimal working example and I’ll be happy to help you sort out the error messages.

      Best, Tom

      • Flaces

        Hi Tom

        thanks for a quick reply. I have a project in WinEdit for a book. I am sending the setting which is creating this error and the error message. If this is not enough then I create some mwe. Perhaps, due the error, or otherwise, there are no references in pdf.

        Thanks in advance.

        kind regards
        Flaces

        ——–

        \documentclass[b5paper,9pt,twoside,openright]{book}
        \usepackage{biblatex}
        \addbibresource{references.bib}
        
        \begin{document}
        ...
        \printbibliography
        \end{document}

        The error message is:

        This is BibTeX, Version 0.99dThe top-level auxiliary file: main.aux
        A level-1 auxiliary file: ch1_intro/introduction.aux
        A level-1 auxiliary file: ch2_conceptualmodel/conceptualmodel.aux
        A level-1 auxiliary file: ch3_systemtraceanalysis/systemtraceanalysis.aux
        A level-1 auxiliary file: ch4_stochasticmodel/stochasticmodel.aux
        A level-1 auxiliary file: ch5_channelutilimprovement/channelutilimprovement.aux
        A level-1 auxiliary file: ch6_autonomicopt/autonomicopt.aux
        A level-1 auxiliary file: ch7_conclusions/conclusions.aux
        A level-1 auxiliary file: postch/postch.aux
        I found no \citation commands—while reading file main.aux
        I found no \bibdata command—while reading file main.aux
        I found no \bibstyle command—while reading file main.aux
        (There were 3 error messages)

        ——-
        Instead of the above setting, when I use these commands, I have NO errors and references are added to the pdf. But the Title capitalisation is not preserved, which is what I need.

        \documentclass[b5paper,9pt,twoside,openright]{book}
        
        \begin{document}
        ...
        \bibliographystyle{abbrv} % also plain 
        style\bibliography{references}
        \end{document}
      • tom

        Again, I recommend using the biblatex package. You can find a good MWE here. Make sure you set backend=bibtex and delete all aux-files before you switch to biblatex. That should fix the errors you see.

        HTH, Tom.

      • Flaces

        hi Tom

        Thanks, and here is a mwe, sent in two files as follows:

        %mwe.tex
        \documentclass{article}
        \usepackage[backend=bibtex]{biblatex}
        \bibliography{refer.bib} % or
        % \addbibresource{.}
        \begin{document}
        \cite{Cisco-2012-2017}
        \cite{Cisco-2013}
        \cite{ITU-T-qos-2008}
        \printbibliography
        \end{document} 
        
        %refer.bib
        @INBOOK{Cisco-2012-2017,
          AUTHOR =       {Cisco},
          TITLE =        {{Cisco Visual Networking Index: Global Mobile Data Traffic Forecast Update, 2012–2017}},
          PUBLISHER =    {Cisco},
          address =      {Americas Headquarters, Cisco Systems, Inc., 170 West Tasman Drive, San Jose, CA 95134-1706, USA},
          howpublished = "\url{http://www.cisco.com}",
          note = "[Online; accessed 18-December-2013],"
        }
        
        @INBOOK{Cisco-2013,
          AUTHOR =       {Cisco},
          TITLE =        {{Enterprise Mobility 4.1 Design Guide, Cisco Validated Design I}},
          CHAPTER =      {Cisco Unified Wireless QoS},
          PUBLISHER =    {Cisco},
          YEAR =         {2008},
          address =      {Americas Headquarters, Cisco Systems, Inc., 170 West Tasman Drive, San Jose, CA 95134-1706, USA},
          month =        {December 9},
          howpublished = "\url{http://www.cisco.com}",
          note = "[Online; accessed 29-October-2013]"
        }
        
        @article{ITU-T-qos-2008,
        title = {{Definitions of terms related to quality of service}},
        journal ={Recommendation ITU-T E.800},
        year = {2008},
        month = {9},
        howpublished = "\url{http://handle.itu.int/11.1002/1000/9524}",
        note = "[Online; accessed 29-October-2013]",
        publisher = {Telecommunication Standardization Sector (ITU-T)},
        address = {International Telecommunication Union (ITU), Place des Nations, 1211 Geneva 20, Switzerland}
        }
        %%%%%%%%%%%

        Here is whats happening:

        pdflatex: I see cited reference points, but no reference list and no errors
        bibtex: I get 9 errors, each with a message: Too many commas in name of “…”
        pdflatex: I see cited reference points, reference list and no errors

        If I do bibtex again, I get back my 9 errors (same message).

        So whenever I do pdflatex, seems it is ok, but whenever I do bibtex, I get those 9 errors.

        Thanks in advance.

        Kind regards
        Flaces

      • tom

        Since you have the biblatex package installed, you might as well use biber instead of bibtex. The only change required is the keyword address has been renamed to location. The minimal example below works using pdflatex, biber, pdflatex.

        Cheers, Tom.

        \documentclass{article}
        
        \usepackage{filecontents}
        
        \begin{filecontents*}{refer.bib}
        @INBOOK{Cisco-2012-2017,
          AUTHOR =       {Cisco},
          TITLE =        {{Cisco Visual Networking Index: Global Mobile Data Traffic Forecast Update, 2012?2017}},
          PUBLISHER =    {Cisco},
          location =      {Americas Headquarters, Cisco Systems, Inc., 170 West Tasman Drive, San Jose, CA 95134-1706, USA},
          howpublished = "\url{http://www.cisco.com}",
          note = "[Online; accessed 18-December-2013],"
        }
        @INBOOK{Cisco-2013,
          AUTHOR =       {Cisco},
          TITLE =        {{Enterprise Mobility 4.1 Design Guide, Cisco Validated Design I}},
          CHAPTER =      {Cisco Unified Wireless QoS},
          PUBLISHER =    {Cisco},
          YEAR =         {2008},
          location =      {Americas Headquarters, Cisco Systems, Inc., 170 West Tasman Drive, San Jose, CA 95134-1706, USA},
          month =        {December 9},
          howpublished = "\url{http://www.cisco.com}",
          note = "[Online; accessed 29-October-2013]"
        }
        @article{ITU-T-qos-2008,
        title = {{Definitions of terms related to quality of service}},
        journal ={Recommendation ITU-T E.800},
        year = {2008},
        month = {9},
        howpublished = "\url{http://handle.itu.int/11.1002/1000/9524}",
        note = "[Online; accessed 29-October-2013]",
        publisher = {Telecommunication Standardization Sector (ITU-T)},
        location = {International Telecommunication Union (ITU), Place des Nations, 1211 Geneva 20, Switzerland}
        }
        \end{filecontents*}
        \usepackage{url}
        \usepackage[backend=biber]{biblatex}
        \bibliography{refer.bib} % or
        % \addbibresource{.}
        \begin{document}
        \cite{Cisco-2012-2017}
        \cite{Cisco-2013}
        \cite{ITU-T-qos-2008}
        \printbibliography
        \end{document}
      • Flaces

        hi Tom

        Thanks for your constant support.

        1. I guess by pdflatex, biber, pdflatex, you mean this sequence of commands. I am using winedit 8 and I see only bibtex button only. Cant figure out where is bibex button?

        2. I have many address = … entries in my reference.bib file, but only get the errors that I reported earlier. Does it mean to change all ‘address’ to ‘location’?

        kind regards
        waqar

      • tom

        Hi there,

        1. That’s an easy fix, see here for how to change the engine from bibtex to biber in WinEdt (you’ll have to scroll down a bit).

        2. That’s right, use find and replace (all). You might want to save a copy of the original bib-file first. See the biblatex documentation (page 19) for an explanation.

        Best, Tom

      • Flaces

        hi Tom

        Thanks for your reply.
        I tried to make the easy fix on the link (putting bibex.exe instead), but it produced many strange errors. Perhaps it could not find bibex.exe. So I restored to previous state.

        As I told you, I have many references with address= field, but only three were giving errors. Today I looked deeply into what makes these errors. So what I found is that more than two commas are not allowed in any address field. I changed the three references (removed some commas), as

        %address = {Americas Headquarters, Cisco Systems, Inc., 170 West Tasman Drive, San Jose, CA 95134-1706, USA},

        address = {Americas Headquarters Cisco Systems Inc., 170 West Tasman Drive San Jose CA 95134-1706, USA},}

        I did not change address field name to location of any reference in my big file.

        So things are working now.

        Please give your feedback on this hit-n-trial correction. thanks

        kind regards
        Flaces

      • tom

        Heya!

        Yeah, as long as you are happy with the result…

        Just a few comments on your reply:
        The biblatex engine is called biber, so you’d have to replace bibtex.exe with biber.exe, not bibex.exe. When I used the address field, too many commas were converted into “X et al.”, probably not what you want. Did you try running the minimal example I created? You can always go the the commandline, navigate to your project directory and type: bibtex.exe tex-filename to run biber.

        Best, Tom.

      • Flaces

        Dear Tom

        Sorry it was a typo. When I use biber.exe, I get this error:

        Command Line: biber.exe “main”
        Startup Folder: C:\Users\flaces\Desktop\Thesis

        Error Launching Console Application BibTeX …
        Command Line: biber.exe “main”
        Startup Folder: C:\Users\flaces\Desktop\Thesis

        The system cannot find the file specified.

        When I try to run the mwe you sent, I get an error (unluckily I am not able to get it to the clipboard this time), but it is like:

        The ‘backend’ option is load-time only and can not be set after package loading

        biblatex2.sty file is opened and highlighted at
        % Process preamble options

        \blx@processoptions

        I have closed winedit and reopened but the error persists.

        In my case, I have a project defined, which is not the case in your mwe.

        So I am not sure why this error is appearing.

        thanks and kind regards
        flaces

      • tom

        If you move from bibtex to biber or back, you’ll have to delete all meta-files from the project directory. Just keep input files (tex, bib, figures, etc.). Otherwise, the engine will complain.

        Tom

      • Flaces

        Yes, I do delete all other files except the input files. Just to confirm if this is correct:

        \usepackage[backend=biber]{biblatex}

        The error does not go.

        thanks

      • tom

        Yes, that’s seems correct. I’m not sure how to help you, really. It seems to be a system-specific problem. If you like, you can post a minimal example (like mine) to reproduce the error and I will try to run it on my computer. Also, you might want to update to the latest LaTeX version.

        Tom

      • Flaces

        Dear Tom

        I have one more question on cover page of a phd thesis. This includes a cover page, a spline and back cover. Normally people do it in Adobe Illustrator or in page etc, but I wish to do it in latex. I guess it will be less effort, as I do not have time to learn these graphics programs. Any examples and how the covers look like, would be great.

        Thanks in advance.

        Kind regards
        Flaces

      • Flaces

        Thanks Tom.
        Normally printers like a single pdf, which contains front, spine and back. On the spine, the text direction is left to right, as you would already know. I also want to put ISBN no at the back side. On the edges, there are bleed marks (corners) that serve as a cut marks. I could not find something like this or perhaps I could not get to such templates in latex. Please help in this context. A simple template with these specs would do, as a quick start.

        I appreciate your quick response, as I am running out of time.
        Thanks in advance.

        kind regards
        Flaces

      • tom

        Hello!

        As I have never written an entire book myself, I have little experience with cover design. However, you might find this a useful read.

        Cheers, Tom

      • Flaces

        Dear Tom

        Thanks many for your replies and help.

        Meanwhile I have two more questions:

        1. I generate little headings using

        \paragraph{Heading}~\\
        
        \noindent text text...

        Sometimes I see that Heading and text are split on two pages. How to avoid it? There are some solutions for avoiding this situation in section headings. I have tried samepage package but it keeps on asking the samepage.sty file.

        2. I have certain size of pages. My text contains quite some maths as well as figures/tables. How can I check automatically if some elements are flowing out of my page text area. Manually it will be hard for a thesis.

        Thanks in advance.

        Flaces

      • tom

        Heya,

        1. You can find a solution to your first question here. You mentioned the samepage package. It is not part of the standard LaTeX distribution (e.g. TeXLive) and I couldn’t find anything on the internet. If you can get the style file (i.e. samepage.sty), just place it in your project directory.

        2. To check if content reaches into the page margins, take a look at the log file and look for Overfull hbox. Also, I like to use the document class option draft, which indicates any overfull hbox in the output PDF as black rectangle. See here for more details.

        Best, Tom

      • Flaces

        Thanks Tom.

        The suggestions for question 1 did not work, so I insert manually \newpage to avoid only \paragraph headings at end of page. The suggestion for question 2 worked very well. I wonder why latex do not calculate the space left on the line before placing maths elements? Any smarter way to avoid maths overflowing the lines?

        Kind regards
        Flaces

      • tom

        You could try the breqn package. Here is an example taken from the package:

        \documentclass[12pt]{article}
        \usepackage{breqn}
        \begin{document}
        From {\itshape Knuth, SNA p74}
        
        Replace $j$ by $h-j$ and by $k-j$ in these sums to get [cf.~(26)]
        \begin{dmath}[label={sna74}]
        \frac{1}{6} \left(\sigma(k,h,0) +\frac{3(h-1)}{h}\right)
        +\frac{1}{6} \left(\sigma(h,k,0) +\frac{3(k-1)}{k}\right)
        =\frac{1}{6} \left(\frac{h}{k} +\frac{k}{h} +\frac{1}{hk}\right)
        +\frac{1}{2} -\frac{1}{2h} -\frac{1}{2k},
        \end{dmath}
        which is equivalent to the desired result.
        \end{document}
      • Flaces

        Dear Tom

        Sorry, but I have yet another question:

        I have a bibliography.I also want a separate list of my publications. Please help.

        Thanks in advance.

        Kind regards
        Flaces

      • Flaces

        hi Tom

        When run as it is, this produce three errors on Bibtex:
        I found no \citation commands…
        I found no \bibdata commands…
        I found no \bibstyle commands…

        But I can see the document with citation in it. There is no bibliography produced.

        With the code I sent, I have tried defernumbers=true. All is ok but no change to the issue I reported about continuity of list numbers in the Author’s contribution and Article. Perhaps you can repair my code.

        Thanks in advance.

        kind regards
        Flaces

      • tom

        The example only works with biber. Therefore, I changed the biblatex option from backend=bibtex to backend=biber. Is there any reason you use bibtex and not biber?

        Cheers, Tom.

      • Flaces

        hi Tom

        I tried to use Biber, but I could not find a file biber.exe in my system.

        regards
        Flaces

      • tom

        If you don’t have biber, your LaTeX version is fairly old and you should consider upgrading. Tom.

  202. Ali

    Hi Tom,

    Thanks for all the good information. I just have a quick question. I set a title and a caption for each figure and table. The title is in boldface. How do I have Latex present the list of figures and tables in normal text (not bold)? Thanks.

    Best,
    Ali

    • tom

      Hi Ali,

      You could use the optional argument to caption:

      \caption[Caption title: caption text]{{\bf Caption title:} Caption text}

      Obviously, this leads to double typing effort. Alternatively, you could redefine the caption command (or define a new command) and do it automatically as shown in the MWE below. If this is not what you were looking for, please provide a MWE as the one below.

      Best, Tom

      \documentclass[11pt]{article}
      \let\oldcaption\caption
      \renewcommand\caption[2]{\oldcaption[#1: #2]{{\bf #1:} #2}}
      \begin{document}
      \listoffigures
      \section{Figure with title example}
      \begin{figure}[ht]
      \centering
      \rule{0.75\textwidth}{0.3\textwidth}
      \caption{Caption title}{Caption text}
      \label{fig:example}
      \end{figure}
      \end{document}
      • Thanks tom. Can I apply some commands to the page in which the list of figures is placed to make it all in normal text, like I do for the single spacing?

        Here is a MWE:

        \documentclass[12pt,letterpaper]{report}
        
        \usepackage{caption, setspace}
        \renewcommand{\baselinestretch}{1.5} 	
         
        \begin{document}
        
        \begin{singlespacing}
        
        \tableofcontents
        \listoffigures
        
        \end{singlespacing}
        
        \chapter{Ch1}
        \section{S1}
        
        Some text here.
        (Actually, I include text files in which there are several tables and figures inserted using the input command)
        
        \begin{figure}[htbp]
        \centering	
        \caption{\bf The Title of the Figure in Bold Text} \label{lable1}
        \rule{0.75\textwidth}{0.3\textwidth}
        \caption*{\footnotesize{The caption of the figure}}
        \end{figure}
        
        
        \begin{figure}[htbp]
        \centering	
        \caption{The Title of the Figure in Regular Text} \label{lable2}
        \rule{0.75\textwidth}{0.1\textwidth}
        \caption*{\footnotesize{The caption of the figure}}
        \end{figure}
        
        \end{document}
        

        Thanks again for your time.

        Ali

      • tom

        Thanks for the nice MWE. I would think you can do that, but it might depend on the command you intend to apply to the list pages. For example, it is common practise to have a different page number style or even header and footer for these pages.

        Let me know if you need help with a specific command and I’ll look into it.

        Best, Tom

  203. Using the following command you can change the title of the list to normal text.

    \usepackage{tocloft}
    \renewcommand{\cftloftitlefont}{\textnormal}

    I’m looking for a command like that which applies to the entries as opposed to the title, but I haven’t been able to find the right name for the middle part. Please let me know if you have any thoughts.

    Cheers,
    Ali

    • tom

      The example below shows how to change the font size for chapter, section and subsection entries in your ToC.

      \documentclass{report}
      
      \usepackage{tocloft}
      \renewcommand{\cftchapfont}{\small\bfseries}
      \renewcommand{\cftsecfont}{\small}
      \renewcommand{\cftsubsecfont}{\small}
      
      \begin{document}
      
      \tableofcontents
      
      \chapter{Dummy chapter}
      \section{Dummy section}
      \subsection{Dummy subsection}
      
      \end{document}
      • Flaces

        hi Tom

        In context of my previous problem to obtain multiple bibliographies, I have tried this code:

        \usepackage[backend=bibtex]{biblatex}
        \addbibresource{references.bib}
        
        \begin{document}
        
        \printbibliography[heading=bibintoc,title={Bibliography}]
        
        \begin{refsection}
        \nocite{ref1}
        \printbibliography[heading=bibintoc,title={Author's Contributions}]
        \end{refsection}
        
        \begin{refsection}
        \nocite{ref2}
        \printbibliography[resetnumbers=false,heading=subbibliography,title={Articles}]
        \end{refsection}
        
        \end{document}

        All goes well, except that the subbibliography restarts numbering, which needs to be continued.

        Thanks in advance.

        Kind regards
        Flaces

      • tom

        I suggest using a keyword to print specific bibliograhies. Also, the defernumbers=true option is required. Here is an example:

        \documentclass{article}
        
        \usepackage{filecontents}
        \begin{filecontents}{ref2.bib}
        @ARTICLE{R2013,
          author = {A. R},
          title = {B paper},
          year = {2013},
          journal = C,
          keywords = {contrib}
        }
        
        @ARTICLE{R2012,
          author = {A. R},
          title = {L paper},
          year = {2012},
          journal = I,
          keywords = {contrib}
        }
        
        @ARTICLE{R2012c,
          author = {A. R},
          title = {C paper},
          year = {2012},
          month = sep,
          journal = I,
          keywords = {article}
        }
        
        @ARTICLE{S2009,
          author = {C. S},
          title = {F paper},
          year = {2009},
          journal = {I}
        }
        \end{filecontents}
        
        \usepackage[defernumbers=true, backend=biber, sorting=none]{biblatex}
        
        \bibliography{ref2}
        
        \begin{document}
        Some citation: \cite{S2009}
        \printbibliography[heading=bibintoc,title={Bibliography}]
        \newrefsection
        \nocite{*}
        \printbibliography[keyword=contrib, heading=bibintoc,title={Author's Contributions}]
        \newrefsection
        \nocite{*}
        \printbibliography[keyword=article, heading=subbibliography,title={Articles}]
        
        \end{document}
  204. rudolf

    Hello, in my list of figures i have something like this:

    1.1 Picture 1 18
    1.2 Another picture 22

    I would need something like this:

    1.1 Picture 1 …………… 18
    1.2 Another picture ….. 22

    There are no dot’s when i use only \listoffigures.

    Could you help me?

    Thanks

    • tom

      Hi Rudolf,

      You would have to let me know which document class you use or provide a minimal working example. The standard document class report produces dots in my example below:

      \documentclass[11pt]{report}
      \begin{document}
      \tableofcontents
      \listoffigures
      \chapter{First}
      \begin{figure}[ht]\centering
      \rule{0.6\linewidth}{0.4\linewidth}
      \caption{default}\label{fig:def}
      \end{figure}
      \end{document}

      Best regards,
      Tom

  205. Tor

    Hi,

    I’m reproducing an old-style technical document (from the seventies), and back then it was common to use
    1-1
    1-2
    2-1
    2-2
    ..
    instead of
    1.1
    1.2
    2.1
    2.2
    in table of contents and in chapter titles. I have the document itself sorted out, but can’t find a way to change the number style in the toc (I use tocloft to massage the toc, this is the only part I can’t figure out). Is there a way to change the style to 1-1?

    Thanks in advance

    • tom

      Hi Tor,
      Thanks for this question. You won’t need the tocloft package here, since you change the way the section counter is printed rather than the ToC entry. Hence, all you have to do is redefine \thesection:

      \documentclass[11pt]{report}
      \renewcommand\thesection{\arabic{chapter}-\arabic{section}}
      \begin{document}
      \tableofcontents
      \chapter{Dummy chapter}
      \section{Dummy section}
      \subsection{Dummy subsection}
      \end{document}

      You can redefine subsection and subsubsection accordingly.

      Cheers, Tom

      • Tor

        Thanks Tom, that worked great! I wasn’t fully aware of how \arabic (or the other variants) could be used this way. Simple when demonstrated.. :)
        .-Tor

  206. wouter

    I qot a question,

    I’m playing around with the list of figures, I want it to look like this:

    1 Balblabla ………. 5
    2 dfgsdgfdg …….. 6

    etc,

    But whenever I’m using a figure in a NEW chapter, it starts over at 1 again.

    In order to get 1, 2 etc i used:

    \renewcommand{\thefigure}{\arabic{figure}}  // (after begin{document})

    How do I fix this?

    • tom

      Hi there,

      Your approach will not work, because the figure counter is still reset at every new chapter. For continuous figure numbering, use the chngcntr package. Below is an minimal working example.

      Cheers,
      Tom

      \documentclass[11pt]{report}
      
      \usepackage{chngcntr}
      \counterwithout{figure}{chapter}
      
      \begin{document}
      \listoffigures
      \chapter{First}
      \begin{figure}[ht]\centering\rule{0.45\linewidth}{0.45\linewidth}\caption{default}\label{fig1}\end{figure}
      \chapter{Second}
      \begin{figure}[ht]\centering\rule{0.45\linewidth}{0.45\linewidth}\caption{default}\label{fig3}\end{figure}
      
      \end{document}
      • wouter

        Thanks, that helps!
        Any idea how to get rid of the blank lines between figures of different chapters in the LOF?

      • tom

        Redefine the macro which adds the line space between entries using:

        \newcommand*{\noaddvspace}{\renewcommand*{\addvspace}[1]{}}
        \addtocontents{lof}{\protect\noaddvspace}
  207. Xin Wen

    I would like to create a list of tables for my report but the command doesn’t work. I researched at some websites and one of it says that if I used tabular, latex is unable to print the list out. Do you have any solutions? Here’s my code:

    \centerline{TABLE I}
    \centerline{SIMULATION PARAMETERS SETTING}
    \begin{table}[h]
    \centering
    \begin{tabular}{ | c | c | }
      \hline
      Parameters & Value (unit) \\ \hline
      M & 0.2 kg \\
      r & 0.02 m\\
      J & 4 x $10^{-5}$ kg m$^{2}$\\
    \end{tabular}
    \end{table}
    • tom

      Hi Xin Wen,

      Thanks for getting in touch. Your table looks fine. Just replace the manual caption with the macro provided by LaTeX, \caption{}. With that, the table will automatically appear in the list of tables. I used the caption package to format the caption according to the style in your example. Let me know if you have any more questions.

      \documentclass[11pt]{article}
      \usepackage[tablename=TABLE]{caption}
      \captionsetup[table]{labelsep=newline, format = upper, listformat=simple}
      \DeclareCaptionFormat{upper}{#1#2\uppercase{#3}\par}
      \renewcommand*\thetable{\Roman{table}}
      
      \begin{document}
      \listoftables
      \section{Section with table}
      \begin{table}[ht]
      \begin{center}
      \caption{Simulation parameters setting}
      \label{tab:sim-par}
      \begin{tabular}{ c c }
        \hline
        Parameters & Value (unit) \\ \hline
        M & 0.2 kg \\
        r & 0.02 m\\
        J & 4 x $10^{-5}$ kg m$^{2}$\\
        \hline
      \end{tabular}
      \end{center}
      \end{table}
      \end{document}

Leave a Reply