# List of figures and list of tables (\listoffigures & \listoftables)

In a thesis, report or book one can often find a list of figures and a list of tables. Latex provides a simple command for both of them which will collect all your figures and/or tables and automatically generate a list.

This is another great example which nicely shows how powerful LaTex is compared to some proprietary products available on the market. The two commands \listoffigures (lof) and \listoftables (lot) are used in the same way as \tableofcontents to generate lists with all your figures and tables.
The command \listoffigures will collect all the captions of your figures and include them in the list. Now it may happen that your captions are long which would results in an even longer list of figures, spanning over several pages. Therefore, the caption command provides the option to define a shorter entry displayed in the list of figures only whereas the text of the required argument will be displayed together with the figure. This applies for the list of table in the same way as it does for the list of figures.

\caption[short caption for lof/lot]{long figure/table caption}

#### 406 responses to “List of figures and list of tables (\listoffigures & \listoftables)”

• 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

• tom

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 ﬁguras”, but uses Spanish hyphenation, etc.

• carlosgalvezp

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

Thanks

• tom

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
\listoffigures
\chapter{First}
\begin{figure}[ht]
\centering
\rule{4cm}{3cm}
\caption{Figure placeholder.}
\end{figure}
\end{document}

Best, Tom.

• carlosgalvezp

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
\listoffigures
\listoftables

• tom

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.

• Garoth

Oh, sweet. Thanks man, that was very helpful. Glad to see that there are other people doing some LaTeX stuff these days

• 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!

• tom

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}}

Cheers,
Tom

• 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?

Axel.

• tom

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}

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!

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!

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

• tom

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.

• Lydia

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

• tom

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

• 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}
• 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

• tom

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

• 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?

• tom

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

• 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

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

• tom

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

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

• tom

Hi Andreu,

You have to redefine the table counter (\thetable) as follows:

\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

• kobby

Hello,
I am using Latex and I have a question.

I used the following code.

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

\pagenumbering{arabic}

can this be done.
Thanks

• tom

Hi Kobby,

There is already a comment on this topic (see comment by iliana above):

Cheers,
Tom

• 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?

• tom

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

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

• 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?

• 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
Thx

• 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}

• tom

Hi Susan,

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

• 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

• tom

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

• Susan

ok, liststotoc did the job (not listtotoc as I have been trying before) ..

cheers
susan

• 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[text]{} is “Figure 1.1:” I’d like to get rid of the colon waiting for text…

• tom

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

• 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

• tom

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}

• Roxanna

Hi!

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!

• tom

Hi Roxanna,

You were right, just use \caption[Your list of figure text]{Your long caption text}

Tom

• 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

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

• 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}

• tom

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

• Ken

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

• tom

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

• 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

• Ken

Hi, Tom,

\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

• Another Ken

Hi Ken !!

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

• Another Ken

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 !

• 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

• tom

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.

Tom

• 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
\listoffigures
• tom

Hi Simo,

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

to

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

Cheers,
Tom

• 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

• tom

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]{
\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

• 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

Chapter List of Figures
Chapter 1: Introduction.

Also, two quick questions:
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).

• tom

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}{}

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

• Gaby

Hi Tom,
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

• 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}}

\addcontentsline{toc}{chapter}{Bibliography}
• 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.

Tom

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

• tom

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

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

• tom

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?

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

Hope this works out,
Tom

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

• 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

• tom

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

• 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

• tom

Hi Philipp,

Simply insert a page break before your lof/lot:

\tableofcontents
\newpage
\listoffigures
\newpage
\listoftables
\newpage

Cheers,
Tom

• 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

• tom

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

• tom

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{lot}{~\hfill\textbf{Page}\par}

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

Tom.

• 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????

Robert.

• tom

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}%
\begin{table}[ht]
\centering
\caption[]{Continued}
\begin{tabular}{|c|c|}
\hline
a&b\\
\hline
c&d\\
\hline
\end{tabular}
\label{tab:b}
\end{table}%
• 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}{\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}{}}

• tom

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

• 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{
citecolor=black,%
filecolor=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:
\else
%%Normal LaTeX - no special packages for fonts required
\fi

%% Language %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\usepackage[francais]{babel}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
%% Packages for Graphics &amp; 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}
\pagenumbering{roman}
%% The List of Figures
\clearpage
\listoffigures
%% The List of Tables
\clearpage
\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}
• 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??

• tom

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

• yan

Tom, is this the link for the new package??http://www.tug.org/protext/
protext is the same thing as miktex?

• tom

http://www.miktex.org/

Cheers,
Tom

• 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

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

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

• Shane

\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!

• yan

i dont know why i have dash instead of bullet?? when i use itemize
it seems like its the default parameter.

• tom

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

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

• 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.?

• yan

even with the last update of babel package , same thing.

• yan

the german package for babel works perfect for itemize
what the hell with these french complicated

• tom

Hi Yan,

You can use

\StandardLayout

Tom.

• yan

i just find it on the \frenchbsetup, exact, you’re right TOM
thanks

• 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

• tom

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.

• 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

• tom

Hi Yan,

Check out the minitoc documentation available in both, English and French.

Tom

• 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

• tom

Hi Ed,

I gave a solution to your questions above. I can understand that reading all these comments is annoying so just go here .

Cheers,
Tom

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

• tom

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.

• 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

• tom

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.

• Oguzhan

Hi Tom,

i tried all but still no entry in toc.

any more idea?

thnx
oguzhan

• joker

Hi,

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

• tom

Hi Joker,

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

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

See the tocloft documentation.

Cheers,
Tom.

• Fatima

Hi!

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

Thanks

• tom

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}}

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.

• 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

• yan

i mean Tom sorry

• yan

i got it, just use multicol package .

• 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,

• 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??

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

• tom

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.

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

• tom

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.

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


great blog!

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

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

• 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

• Kay

Hi,

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

• 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?

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

• 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

• 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…

• tom

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.

• 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}{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

• tom

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

• 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

• 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

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

• tom

Hi Mary,

\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

• Jaime

Tom, you rule with LaTeX.

Greetings.

• 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

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

Greetings

• 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

chris

• tom

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.

• 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!

• tom

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!

*

• 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

• 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!

• 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?

• tom

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.

• 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

• tom

Hi Amani,

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

• 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}

• tom

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.

• 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…

• tom

Hi Yallen,

Here is how you can solve your problem:

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

Tom.

• 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{}
\renewcommand{\footrulewidth}{0pt}
\fancyfoot[R]{\sffamily\bfseries  \thepage/\pageref{fancy:frontend} } %%\fancyfoot[RO,LE]
}
\fancypagestyle{fancytext}{%
\fancyfoot{} % clear all footer fields
\fancyfoot[R]{\sffamily\bfseries\thepage/\pageref{fancy:mainend}} %%t[LE,RO]
\renewcommand{\footrulewidth}{0pt}
}
\fancypagestyle{fancychapter}{% the page with chapters in main
\fancyhf{}
\renewcommand{\footrulewidth}{0pt}
\fancyfoot[R]{\sffamily\bfseries  \thepage/\pageref{fancy:mainend} }
\markboth{}{}
}
\renewcommand{\chaptername}{Chapter}

\vspace*{50\p@}%
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth &gt;\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 &gt;\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}

• arnab

like:
list of figures………I
List of table ………II
1. Introduction……….1

• tom

Hi Arnab,

You have to add them manually by using

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

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

\cleardoublepage
\listoffigures

Tom

• 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

Best regards

• tom

Hi Hrvoje,

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.

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

• tom

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.

• 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

• tom

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,

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

• isharp2

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”
any advice on how to do this?

• tom

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\tableofcontents{
\clearpage
(Continued) \hfil}}}
\pagestyle{continued}
\table@of@cont
\newpage}
% Define tableofcontents
\def\table@of@cont{%
\thispagestyle{plain}
\@starttoc{toc}}
• 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.

best regards
Flaces

• tom

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.

• 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?

regards
Flaces

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

• 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

• tom

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?

• tom

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.

• 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

• tom

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.

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

\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…

• tom

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.

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

regards
Flaces
——

\documentclass[conference]{IEEEtran}
\usepackage{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}
• tom

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.

• 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

• 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

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

• tom

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

• christi

so helpful! you can’t imagine for how long i was looking for it! a grand thank you!

• Fred Durao

Hi Tom,

I guess you can help me with this post:

http://tex.stackexchange.com/questions/28512/how-to-align-the-captions-in-the-list-of-figures

Fred Durao

• tom

There you go:

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

Found here

Cheers, Tom.

• Fred Durao

Many Thanks Tom,

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

Have a nice day.

Fred

• 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

• 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

• tom

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.

• 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

• tom

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.

• 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

• tom

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

• 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

• tom

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.

• 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{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

• tom

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.

• Didi

Hi Tom!

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?

• tom

Hi Didi!

Use the optional parameter of caption.

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

Best, Tom.

• 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 ?

• tom

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.

• Natasha

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

• raquel

I didn’t make any questions but I’d like to thank tou Tom! Your tips helped me a lot!!

• 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

• tom

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}
• 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…

• tom

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 !!

• 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
\fi
\iftablespage
\listoftables
\fi

}
\cleardoublepage
\pagenumbering{arabic}
}

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?

Mike

• tom

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.

• 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}]%
\subfigure[{a2.pdf}\label{A1}]%
\subfigure[{a3.pdf}\label{A1}]%
\subfigure[{a4.pdf}\label{A1}]%
\caption{a1.}
\end{figure}

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

Thanks a lot!

Dijana

• tom

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.

• Mike

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

\listnomenclature
\fi
\iffigurespage \newpage
\listoffigures
\fi
\iftablespage \newpage
\listoftables
\fi

Thank you!

Cheers
Mike

• 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

• tom

Hi Vagner,

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

\fancypagestyle{plain}{%
\fancyhf{}
\fancyfoot[R]{\thepage}
}

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

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

• tom

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.

• 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 :).

• 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

• tom

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.

• 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?

• 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?

• tom

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.

• 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{\cftsecleader}{\cftdotfill{\cftdotsep} Page}
• tom

Hi there,

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

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

Best, Tom.

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

• tom

Hi Esdras,

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

\caption{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.

• 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

• tom

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

• tom

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}
\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.

• 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

• tom

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

• tom

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}
}

Best, Tom

• 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}}
• 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.

• Frederico

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

• tom

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.

• 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?

• 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

• tom

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.

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

• tom

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}%
}
\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,

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.[...]

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

• Neil

Hi Tom,

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

• tom

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.

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

• tom

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.

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

• tom

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.

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

• tom

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.

• 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)
% adding one to the numerical subf counter
\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

• tom

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.

• Allan

Hi Tom,

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

As always, thanks.

Allan

• Dominic

Hi Tom,

I’m using ctable package to generate tables, and I have a few “continued” table As mentionned in ctable document (http://ftp.ktug.or.kr/tex-archive/macros/latex/contrib/ctable/ctable.pdf) in order for the table not to be rementionned in the LoT i have to put an empty field in the mention “cap” but it does a dotted line in the list of table and the page number. Is there a way to go around this?

• tom

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.

• 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 dont have to change the captions under the figures. I have to change the captions in the list of figures. Thanks

• tom

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.

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

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

• tom

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.

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

Neil.

• tom

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

• tom

Hi Neil,

Best, Tom.

• Neil

Hi Tom,
Thank you. Problem solved.
Neil

• 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

• tom

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

• 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

• tom

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

Dear Tom

I need upright (non-italic) and bold \theta, \lamba, \nu, \omega such that I can still have normal variants of these greek letters. I have tried solutions given at, but they does not work for small greek letters:
http://tex.stackexchange.com/questions/30550/force-upright-greek-letters-with-isomath

• tom

Hi! I suggest you give the textgreek package a try. See my post for more details.

Cheers, Tom.

• 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?

• tom

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.

• tom

Ohh, I see, straighttheta, along with a few others, is implemented in the textgreek package.

For normal text in math mode use:

\textrm{}

For bold use:

\textbf{}
• Whotee

Thanks Tom. It works fine now.

• gilberto

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

• tom

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.

• 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?

• Emivan

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

• tom

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}
\begin{document}
\listoffigures
\begin{figure}[ht]
\centering
\rule{4cm}{3cm}
\caption{\blindtext}
\label{default}
\end{figure}
\end{document}
• 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

\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

• tom

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}
• Emivan

Hello tom thank you for your valuable help.
You are fantastic.

• Emivan

Tom, in the previous example how do I decrease the space between the word and the list of figures Figure?

• 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

• 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

• tom

Hi Daniel,

This should work.
Best, Tom.

\documentclass[12pt]{report}
\usepackage{blindtext, pgffor}
\pagestyle{empty}
\begin{document}
\tableofcontents
\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}
• 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?

Regards
Jonas

• tom

Hi Jonas,

I would need to see some code to be able to help. Please provide a minimal working example.

Thanks, Tom.

• Jonas

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,
\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}
• tom

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.

• Whotee

hi Tom

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

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

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.

Kind regards
Whotee

• tom

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{split} \pi + \pi& + \pi\\ \pi + \pi&\\ \pi \end{split}$$
\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{split} \alpha + \beta& + \frac{\gamma^2}{\delta+n+Limit}\\ \frac{S}{t-y^3} + i^\j \cdot k&\\ \pi \end{split}$$

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

Thanks, and best regards

• tom

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?

• tom

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}
• 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

• 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!!!!

• tom

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

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

Only the list of Figures appears correctly – as Figure 1.1, Figure A.1 etc .etc.

• tom

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}

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 !

• tom

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

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

• 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}

Kind regards
Whotee

• tom

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}
• Whotee

Thanks Tom! it works.

• Whotee

hello Tom

$$\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}$$

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.

regards
whotee

• tom

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}
$$\label{sm-e-be}%balance eq. \begin{array}{rcl} a & = & b\\ && + c\\ &&\makebox[\mylength][r]{d}\\ \end{array}$$
\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

• tom

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

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

• Sriram

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.

• tom

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}
\blindtext

\tableofcontents
\listoffigures
\listoftables
\chapter*{Un-numbered}
\section*{Test section}
\chapter{Numbered}
\section{Test section}

\end{document}
• hanen

Hi Tom,
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}
...
• tom

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.

• tom

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

• hanen

Hi Tom,
it’s just scheduling of \usepackage in the main page.
Thanks a lot.

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

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

• tom

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.

• tom

Hi Clemens,

Many thanks for posting the exact solution here. Appreciate it! Tom.

• 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!

• tom

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*\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}
• 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

• tom

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