I put together this list of 10 ways to customize the Table of Contents, List of Figures and List of Tables. Some of them are pretty common, some may be new to you. Hope you enjoy the list…
Some pieces of code below require the tocloft package which provides extensive customization functionality for table of contents, list of figures and list of tables. It will be indicated wherever the tocloft or any other package needs to be loaded in the preamble.
Note: I will use the abbreviations toc for table-of-contents, lof for list-of-figures and lot for list-of-tables in the article below.
1. Change the lists headings
Change the heading can be done without loading any specific package. Obviously, the name has to be changed before creating the list.
\renewcommand\contentsname{} \tableofcontents \renewcommand\listfigurename{} \listoffigures \renewcommand\listtablename{} \listoftables
2. Add “Page” above page numbers
Several people asked me how to place the word “Page” on top of the page numbers in toc/lof/lot. Here is how you do it:
\tableofcontents \addtocontents{toc}{~\hfill\textbf{Page}\par} \chapter{...}
It works the same way with lof and lot. The code was taken from here.
3. Change depth of entries
You can change the depth, i.e. how many levels shall be printed using the respective counter:
\setcounter{tocdepth}{1} \tableofcontents
0: chapter (not available for \documentclass{article
),
1: section,
2: subsection, etc.
The default depth is 3, subsubsection.
Similarly, including subfigures and subtables can be achieved using:
\setcounter{lofdepth}{2} \setcounter{lotdepth}{2}
4. Roman page numbers for toc/lof/lot
To get a different page number style for toc/lof/lot, use:
\pagenumbering{}
and change it back to arabic
before the first chapter starts.
Available styles are arabic
, roman
, Roman
, alph
and Alph
.
Complete code example:
... \pagenumbering{roman} \tableofcontents \listoffigures \listoftables \clearpage \pagenumbering{arabic} \chapter{...} ...
5. Hyperlinks to content
Loading the hyperref
package will let you navigate from toc/lof/lot entries directly to the respective content:
\usepackage{hyperref}
If you only want the page number to be clickable, you’ll need to load the package with the following option:
\usepackage[linktocpage=true]{hyperref}
6. Adding the lists to toc
Adding entries to toc/lof/lot can be done manually with a single command. Usually, to be sure the page number is correct, it’s advisable to add entries directly before or after the actual content to list. And here is how:
\addcontentsline{}{}{}
The file line(s) shall be added (toc
, lof
or lot
), the type of the entry (chapter
, figure
, etc.) and the entry text itself.
To add the three lists to the toc use:
\tableofcontents \addcontentsline{toc}{chapter}{Contents} \listoffigures \addcontentsline{toc}{chapter}{List of Figures} \listoftables \addcontentsline{toc}{chapter}{List of Tables}
7. Changing the font of entries
To change the way the actual entries look, you can make use of a command provided by the tocloft
package. The command will affect the number as well as the text. However, it will not change the page number and the separator (if there are any). The nice thing here is that since it’s placed just in front of the sequence number, you can also use it to add words such as “Chapter 1: Biology … Here are a few examples for illustration:
\usepackage{tocloft} \renewcommand{\cftchapfont}{\scshape} \renewcommand{\cftsecfont}{\bfseries} \renewcommand{\cftfigfont}{Figure } \renewcommand{\cfttabfont}{Table }
Try it and make sure you don’t forget the space behind Figure_
and Table_
, otherwise it will be glued to the number.
8. Creating you own list of …
Again, the tocloft
package has to be loaded. First, define a new list environment as well as the item which are later being listed. In this case, we are defining lemmas, but it could also be proofs, equations, a special list of figures, footnotes, anything. The last line of the lemma command defines how lemmas should be numbered, here “chapter.lemma”.
\usepackage{tocloft} ... \newcommand{\listlemmaname}{List of Lemmas} \newlistof{lemma}{lem}{\listlemmaname} \newcommand{\lemma}[1]{% \refstepcounter{lemma} \par\noindent\textbf{Lemma \thelemma. #1} \addcontentsline{lem}{lemma} {\protect\numberline{\thechapter.\thelemma}#1}\par } ... \listoflemma ... \lemma{My first lemma} \label{lem:lemma1}
You can find a complete code example here.
9. Alternative text in toc/lof/lot for headings and captions
In case your caption is too long for the lof/lot, you can give it an alternative text. Similarly, the headings can be given an alternative name in the toc:
\caption[]{} \chapter[]{}
10. Chapter specific tocs with minitoc
Finally, minitoc
produces beautiful tocs at the beginning of every chapter (or any other heading) and therefore, I will dedicate this 10th and last entry to that package:
\usepackage{minitoc} ... \dominitoc \tableofcontents ... \chapter{...} \minitoc
Here is an earlier post I wrote about the package as well as the complete documentation.
Wow, that’s the longest post I ever wrote. Hope you’ve enjoyed my list, have fun customizing :-).
ofer
Thanks, you have been very helpful to me!
Jo
Do you have an idea how can customize the font size etc. of the list headings? I’ve been googling this for quite some time now without finding a solution…
tom
Hi Jo,
Try the
tocloft
package. Here is an example, even though an ugly one:You can find the documentation here.
Tom.
David
Concerning the solution for adding “Page” above the page numbers, it doesn’t work if you have a section (an abstract, for example) that appears before your toc that is numberless but included in your toc by way of:
What happens is it shows up in your toc above the word “Page” because we are tricking LaTeX into doing what we want, but really it thinks that “Page” is a section. I know there’s probably another work around for my scenario, but I thought I might bring it up. Hopefully there is a cleaner solution for formatting the toc in this way.
By the way, I used an article document class, in case that matters.
tom
Hi David,
Thanks for sharing this. I wouldn’t necessarily add the abstract to the table of contents. However, that’s a personal decision.
Best, Tom.
Anthony
Hi Tom, thanks for all your answer … this is the only thing I need and the only question you didn’t really answered to 😀
Do you have any clue on how to do it?
Thanks
tom
You are right, I never answered that question. The solution would be to move the command that adds the word “Page” further up so that it appears before “Abstract”. Here is the code:
hugoleo75
Dear tom, I need some help. In Brazil, in the list of tables we use the word “tabela” before the number and the title of the table. That is I need to customize the way the list of table appears. Normally, Latex just show, for example:
List of Table
1.1 Fisrt example of table
1.2 Second table on the first chapter
******
I need to show exactly as shown in caption:
List of table
Table 1.1 Fisrt example of table
Table 1.2 Second table on the first chapter
Thanks,
Hugo Ribeiro
tom
Hello Hugo,
To change the title, you can either load the
babel
package with the optionportuguese
or set the name manually to anything you like:To add the word tabela before the number, use the
tocloft
package as shown below:Hope that helps. Let me know if you have any other question.
Cheers, Tom.
hugoleo75
Hi Tom,
that was exactly what I was looking for:
And then I did for the figure “lof”:
They did work as I wanted.
Thanks a lot.
Hugo
tom
Great! Happy to help. Best, Tom.
Naeem
Hi Tom,
Thanks a lot for your post, its really informative.
I have a quick question. While finalising my thesis, I came across a problem of representing a range of pages for a single entry in table of contents. For instance, If I want to use a page range 1~10 for “Preliminary Pages”. I couldn’t get any useful help from the blogs.
Can you please help me to do that.
Best,
Naeem
PS: I am using LaTeX report for my thesis.
tom
Hi Naeem,
Try the following code. Everything you need to add to your document is highlighted. It adds the line manually and suppresses the standard chapter entry.
Hope it works!
Best, Tom.
Naeem
Thanks a lot genius. Your code worked with a bit of changes in my thesis… Thanks again 🙂
tom
Thanks Naeem. I’m happy it worked out! Cheers, Tom.
Krishna
Hi Tom,
I have been searching for a quick tip how to use a “tab” space in table of contents (between the content names). To be more precise, for instance, i have a section 1, subsection1 and a subsubsection (1, 1.1, 1.1.1). How can I get all of them displayed (at the moment I cannot see subsubsection in the TOC!!) in TOC by having an offset infront of them (like stairs)..as in your 2nd tip (add “page” above number). Thanks for your help in advance.
BR
Krishna
tom
Hi Krishna,
The indentation you see in my example is the normal behavior of TOC. The example below shows how to change the depth of what is included in the TOC.
Hope it helps,
Tom.
Krishna
Hi Tom,
thanks for your quick reply. Today one of my clleague was help me to get TOC as i wanted. But the way you showed in your example is very simple. I will use it tomorrow in my document :).. Thanks once again.
tom
Happy to help. Cheers, Tom.
Krishna
Hi Tom,
set counter was set to 2 in my document and now i changed it to 3 as you suggested. it worked. But what I meant for offset is “horizontal space” between contents.. and another point is, in my case somehow toc indentation was not default (as you mentioned).. donno why.. but following code solved my problem..just wanted to share.. thanks anyway
here it is,
I used 2pt to define the “vertical space b/w the contents”..it is only working for sub and subsub sections..not for sections..anytip to get vertical space b/w sections in toc ?
thanks in advance
BR
Krishna
tom
Hi Krishna,
I tried to run your code, but
tocline
was not defined. What package or documentclass do you use? Please give a minimal working example that I can copy-paste and then typeset.Just by just looking at your code, what you can try is to add one more line for
section
, identical to the definitions forsubsection
andsubsubsection
you already have.Cheers, Tom.
rozita
hi
I am going to submit final edit of my thesis. Just 1 problem i am having, plz if possible help me. I have list of figures, tables, algorithms and Abbreviations. I made successfully the list of each one those. But in table of contents i am having only the list of Tables and Figures. I am not able to show in Table of contents , the page which is included the list of Algorithms as well as page for the list of Abbreviations.
please tell me how should be do it?
i tried with both 8. Creating you own list of … commands but i could make properly my requirements . plz help me.
the other problem is sorting references by alphabet, if possible give me some help for this also.
Thanks alot in advace.
tom
Hi Rozita,
You can manually add these lists to the table of contents. Use the following code right before producing the actual list to get the page number right.
It seems you defined you own list of algorithms. I wrote a post on that topic, which has more details concerning how to add it to the table of contents.
In order to help you with your second question, I would need a little more details. What package do you use, biblatex, natbib, …? Please provide a minimal working example.
Best, Tom.
rozita
Thanks alot tom.
i will be try now for applying your solution.
Best Regards
tom
Hope it works! Cheers, Tom.
tabassum
hi Tom,
i have inserted a table as a figure. i changed the name by
\renewcommand{\figurename}{table}
but how can i now change the table of content and list of figures.
tom
I guess you want to remove the table from list of figures and add it to list of tables.
First, suppressing a figure from appearing in the list of figures is done using the caption package and a starred caption:
Now you can manually add the table to the list of tables:
You may also have to manually increase the table counter.
HTH, Tom.
Alain Raymond
Hey Tom, I’ve created some custom lists and I’m able to display them with no issues. The problem is, however, that I need them to be 2-level lists. The first level would be the chapters and the second would be the elements of my list. So instead of having something of this sort:
Lemma1……..9
Lemma2……..10
It should be like this:
Chapter1…………………………………..9
Lemma1………………………………..9
Chapter2………………………………….10
Lemma2……………………………….10
Have you any idea of how I could accomplish that? Thanks in advance!
tom
Hi Alain,
I did not test this, but something along the lines of the code below should do the trick.
It’s not a clean approach, this will not use the optional argument nor the starred version of chapter.
I remember there is a better way though. I forgot the name and couldn’t find it just now, but if I remember correctly, there is a package which allows you to extend existing commands by adding code before or after. Maybe you have more luck finding it…
Deming
Hey Tom, i am now preparing my PhD thesis, i have several problems, I use book class.
1. I use “algorithm2e” generate my “List of Algorithms”, and “thmtools” generate “List of Theorems”, question is how to add “Page” above page numbers for them
2. As what you did in 8, for “List of Algorithms” and “List of Theorems”, how can we add ‘Algorithms’ and ‘Theorems’ in front of the sequence number, respectively.
Thanks in advance!
Deming
Deming
I have solved all these problems, but have a new one, that in “List of Theorems” using “themtools” package, the space between different chapters is not the same as the space in “List of Tables”. To make it clearly, take the space between the last one of Chapter1 and the first one of Chapter2 for example, it is very closed. Any idea to change this kind of space/
tom
Great! Would you mind posting your solution here?
I figured out your first question, but the second seems more tricky.
Could it be that the difference in space has something to do with the fix of your previous problem? I created a minimal working example (see below) and the spacing seems to be the same.
Cheers, Tom.
sodeju
Is there a way to increase the column offset of the section in the table of contents? The toc now looks like:
5.20Topic Title
Without a space between the number and the title.
tom
Hi! The tocloft package does the trick. The documentation is really helpful!
sodeju
Hi! This just worked fine. 🙂
I also found \cftsubsecnumwidth for subsections.
tom
Great, thanks for the feedback! Tom.
Ding Yuan
Hi Tom,
Thanks for your post. But I cannot find what I need.
I used the following command to generate list of figures and tables.
However I found that the figure and table captions extend beyond the A4 page space. Is there anyway to strictly control the long captions, say like a paragraph with margins and indentations? Multiple line is acceptable for me.
Cheers
tom
Hi!
I would need to see a minimal working example showing that captions reach into the list-of-figure margins. In the simple example below, line-breaks are correctly added to long captions. In case you are using the hyperref package, see here for more information on how to fix the problem.
Mauro
Hello Tom, I have a question and I hope you can help me. So the thing is that I add a list of acronyms using the nomencl package. Later I add it manually to the table of contents as your example says. However the problem is that when I modify my Acronym list (Nomenclature) in order to have it in 2 columns, then it doesn’t appear correctly in the toc (i.e. instead of having page number “ix” it appears after my chapter 1 with page number 1).
And where I have defined the Acronyms:
Is it clear what my problem is? Thank you Tom. Best regards!
Mauro
This is exactly what I get as an output
Contents…………………………………iv
List of Figures……………………….. vii
List of Tables………………………… viii
1 Introduction…………………………. 1
1.1 Motivation…………………………. 1
1.2 Objectives…………………………. 1
1.3 Methodology ………………………1
Acronyms……………………………….. 1
While in the actual documents the Acronyms sections is in page ix
tom
Hi Mauro,
I tried to reproduce your issue with the code you provided. Try adding
\clearpage
before you change the page-numbering to arabic (in case that’s how you do it). See the minimal example below:Mauro
Ok Tom, it seems to work like that. But only if I add the \clearpage after the \listoftables and before the nomenclature. Thanks a lot!
best regards!
tom
Great, glad you were able to fix it. Best, Tom.
Elad
Hi Tom,
I have a simple question though I couldn’t find an answer through google and all the tex forums. I am writing an article and am using a list of figures, as the figures page numbers will change upon publication (hopefully) I need to remove the page numbering. Up to here there is no problem if I use the tocloft package. The problem arises because I am also using the subcaption package and the two packages seem to conflict. More precisely, when I use the tocloft package the subcaptions (captions for subfigures) don’t appear in the list. I would appreciate your help in either removing the page numbering without tocloft or in having the subcaptions appear with tocloft.
many thanks
Elad
Elad
o.k. I managed to get around the problem by moving to the subfig package instead of subcaption. thanks a lot anyhow.
tom
Thanks for the update. Glad you found a solution. Tom
raouf
thx for this post very helpful
Ganesh Sharma
Dear Tom,
How we can put the page numbering in TOC like
1. Chapter’s heading 1-7
2. Chapter’s heading 9-10
3. Chapter’s heading 11-15
kindly help me.
Thank you in anticipation.
tom
Hi!
I remember a similar question I got a few weeks ago. I will try to think of a way to do this and let you know…
Ganesh Sharma
Dear Tom, Is any solution found.
tom
How about you ask this question in a forum such as tex.SX or latex-community. You might get an answer quicker. Good luck! Tom.
Barbara
Hi Tom,
A new standard for the Table of Contents has been set in my University in which the titles must be aligned. For example:
CONTENTS
1 INTRODUCTION
2 OTHER CHAPTER NAME
2.1 SECTION
2.1.1 Subsection
2.1.1.1 Subsubsection
REFERENCES
I don’t know where to put these spaces to set this weird configuration!
Do you have anything in mind?
Thanks in advance!
tom
Hi Barbara,
Use the tocloft package to set these values as follows:
Barbara
Hi Tom,
Thanks for the answer! I think the spaces I tryed to show in the comment are missing but you were able to get the idea! That’s what I was looking for! I’ll test this tocloft package!
Thanks again! And best regards!
tom
Hi Barbara,
Glad to help.
Unfortunately, the formatting doesn’t work that well in comments unless you use HTML tags. But I saw the spaces you added which helped :-).
Markus Bremer
Hello,
I implemented your example for program code,
but it does not INDENT the entries from the left. All my other entries in lot and lof ARE indented…what can I do? I figured it may have to do with chapter/section in \thechapter? Tried to put \indent almost everywhere and deleted \noindent in the example but it didnt work! Please help 🙂
tom
Hi Markus,
Thanks for your comment.
I assume you were trying the code for “new list of…”. There was an error in my code which is fixed now. The indentation of entries can be changed the same way as for chapters/sections in table of contents, using
tocloft
. Assuming the code from above:HTH, Tom.
Markus Bremer
Thank you very much! 🙂
Actually what I needed was
tom
cool, thanks for posting the solution that worked for you. cheers.
Montadar
Hi Tom, really I fell very sad, I can not debug the problem, I have to customize the TOC but I can not, when I use the command
\renewcommand{\cfttoctitlefont}{\hfill\normalsize\bfseries}
i face error but when i used it with a new class document it works properlytom
Hard to say without seeing more of your code. My guess would be that one of the packages you load creates a conflict with
tocloft
. Do you loadsubfigure
in your document? Try:Otherwise, I recommend to start from your “new class document” and add one package at the time to find which causes the error.
Nick
Hi Tom,
Thank you for these blog posts, they are awesome. That said, I’ve been trying to get the tocloft package to play nice in order to implement one of the solutions proposed in the comments- to customize the lof as such:
1 Figure 1
2 Figure 2
to
Figure 1. Figure 1
Figure 2. Figure 2
(and same for table)
but either some class or package is interfering with. Are there any way to manually customize the lof?
These are my packages:
tom
Hi Nick,
I don’t see a problem with these packages, but I would have to see the entire code. See below for an example. Cheers, Tom.
Travis
Hello Tom,
I’m having a spacing issue with the Table of Contents in my thesis that I can’t find a solution to elsewhere. Specifically, I want to have a single blank space between each chapter. There is no problem if the chapter has sections, but some chapters don’t have sections and in this case I’m getting two spaces between the chapter headings. As an example, the ToC might look like:
1 INTRODUCTION
1.1 Subsection 1
1.2 Subsection 2
2 BACKGROUND
3 MAIN BODY
3.1 Subsection 1
3.2 Subsection 2
4 CONCLUSION
(I would like for there to be a single space between Chapters 2 and 3.)
I apologize for not including a minimal working example – the class file was written by someone else years ago and I don’t know what’s essential. I could be wrong, but I believe the problem occurs in the following string:
Thanks in advance for any help you may be able to provide.
tom
Hi Travis,
I wasn’t able to run the code using
report
. The code addsdoublespace
(setspace package) for TOC chapter entries plus some space before a new chapter which makes it look like two spaces for chapters without sections/subsections. I found this similar question (and answer) on tex.SX which you might find helpful.HTH, Tom
Travis
Tom,
I was able to work it out (following the link you provided) by inserting the following on line 7 of the code I sent previously:
It’s a little ad hoc, but any port in a storm. Thank you so much for your prompt reply, for pointing me in the right direction, and for your patience with my ignorance.
-Travis
tom
Hi Travis,
Glad you found a solution that works. Thanks for posting it here!
Btw. I wrote a short article last night, using some of the ideas I came across while looking for answers to your question :-). Glad you asked, thanks!
Cheers, Tom
Carrie
Tom, I have been searching for a simple solution to a what I think is a common problem. For my thesis, the only numbering allowed on TOC is roman numerals for Chapter levels only. However, I needed to manage the indentions since roman numerals after VI overlap with the chapter heading. I was able to do this simply using:
However, now every “addcontentsline” I used for other chapters have shortened dot fill space and dont actually reach the page number in the TOC.
example of addcontentslines:
Do you have any idea why the \dotfill is affected by the tocloft change or what I can do to fix it?
Thanks
tom
Hi Carrie,
Thanks for your question.
You can automatically add LOF and LOT to the table of contents using the tocbibind package. If you do it manually, I suggest to rename the titles (like you do for TOC) and then use the name-macro in the document.
See this post for more details.
If you like to have dots between the title and the page number for chapters in TOC, use:
In general, I recommend to make all global changes in the preamble.
Let me know if you have further questions.
HTH, Tom
Mary Hudachek-Buswell
Hey Tom,
I have been searching all over ctan, ctex and stack exchange trying to find a solution to my thesis format issue. You were the first to directly and simply address one issue I FINALLY fixed after searching for a while.
Here is my preamble
I have another issue I need help with in the formatting of the TOC. Currently the chapter entries look like this
CHAPTER 1 INTRODUCTION : : : : : : : : : : : : 1
1.1 Background and Motivation . . . . . . . . . . . . . . . . . . . . . . . 1
CHAPTER 4 NESTED PRODUCT DECOMPOSITION OF A RANK
STRUCTURED MATRIX : : : : : : : : : : : : 71
I need them to look like this
CHAPTER 1 INTRODUCTION : : : : : : : : : : : 1
CHAPTER 4 NESTED PRODUCT DECOMPOSITION OF A RANK
STRUCTURED MATRIX : : : : : : : : : : : : 71
Additionally it appears that the font in the TOC for Chapters is slightly larger. I need to decrease the size.
I am appreciate any and all assistance
Mary Hudachek-Buswell
Well it looked fine when I typed it in, the spacing appeared correct. In the second example there was to be more space (tab) between the 1 and INTRODUCTION. Likewise with the 4 and NESTED.
tom
I can see the extra space. The tocloft package has commands to change how entires are typeset.
Use
\cftchapnumwidth
for extra space between the chapter number and the chapter name. You might have to try what’s the right value:HTH,
Tom
Evan Langlois
Hi All,
I’m trying get my TOC “just right” and I’m almost there. I used LOTS of help from this forum, but I have 1 last issue. I have Appendix A and Appendix B and they show as Chapter A/B for obvious reasons (see code below). How do I change the static “Chapter” to something that changes from Chapter to Appendix as necessary? Or hack it to work like it does?
I’m using LyX, so all this is in my preamble and the document itself is dynamically generated, but I should be able to hack stuff in where ever necessary. While I’m here, what would I replace \small with to make “Page” a bit smaller? \smaller fails and \tiny is too small!
… and there is the issue !
tom
Thanks for this question. Using
\chaptername
instead of ‘Chapter’ has the advantage that it can be redefined to ‘Appendix’ as shown in the example below. Font sizes between\small
and\tiny
would be either\footnotesize
or\scriptsize
.Evan Langlois
That worked perfectly! I’m using LyX, so I wasn’t sure how the \addtocontents would work (was hoping it wouldn’t add 2 of them because LyX already added the Appendix), but it worked great! Luckily the software was smart enough to do things right! Thank You!
tom
Great to hear! Thanks, Tom.
Monia Nielsen
Hey Tom
I have a problem in my ToC (using the book class) which I hope you can help me with.
My ToC look something like this:
Resume i
List of Figures ii
List of Tables iii
Abbreviations iv
Chapter 1 Introduction 1
1.1 Section………………………………………. 2
1.2 Section………………………………………. 2
Chapter 2 Theory 3
2.1 Section………………………………………. 4
2.2 Section………………………………………. 4
Chapter 3
etc.
I would like to decrease the spacing between my “front matter” so it becomes:
Resume i
List of Figures ii
List of Tables iii
Abbreviations iv
Chapter 1 Introduction 1
1.1 Section………………………………………. 2
1.2 Section………………………………………. 2
Chapter 2 Theory 3
2.1 Section………………………………………. 4
2.2 Section………………………………………. 4
Chapter 3
etc.
I don’t know if it makes a different, but the front matter have all been made with the
\chapter*{} argument and the ToC, LoF and LoT have been added to the ToC by the \addcontentsline{toc}{chapter}{Chapter} format.
-Monia
tom
Easiest would be to manually remove the extra space for the first few chapters. I’m using tocbibind to add toc/lof/lot, etc. to the table of contents (toc).
Monia Nielsen
That works perfectly! – Thanks Tom.
tom
Great, thanks for the feedback!
Manickam
Hey Tom
I used commands line given below
\tableofcontents
\include{Abs}
\include{T0}
\include{T1}
\include{T2}
But, I have two pages of abstract, next page top left comer, i need only abstract inserted of Contents.
For that propose i used command line in Abs file give below
\chapter*{Abstract}
\addcontentsline{toc}{chapter}{Abstract}
My Pdf look something like this:
Contents
Abstract 1
List of Symbols and Abbreviations 3
1 Introduction 4
2 Figure 15
Then something like this
______________________________________
Abstract of first page.
Next page top left comer i get like this
Contents 2
______________________________________
Something matter
Thank You
Manickam
tom
I’m not sure I understand what the problem is here, sorry. Please send a minimal working example and maybe describe what you would like to be different. With that, I’ll be happy to take a look and help if I can.
Thanks, Tom
Albert
Hi Tom. thanks very much for your great post(s) !
I’m just wondering, if (or how) tocloft can be used also for the “List of Algorithms”.
I e.g., want to add the word “Algorithm” to the list, as for instance done for LOF/LOT.
Unfortunately, simple using “\renewcommand{\cftloafont}{Algorithm }” won’t do it…
Any idea?
Best and thanks for your support,
Albert
p.s.: I’m simply adding the LOA with the standard “input-function” in LyX
tom
Hi Albert,
Yes, tocloft would be the right choice. See here for an example on how to create a list of algorithms. I’m not greatly familiar with LyX. You might have to manually add some stuff to the (LaTeX) code.
Chudy Bikola
Please, I am using the lof to show list of figures. The problem is that I want the listed figures to be left justified, starting at the same position as the heading “List of Tables”. Please, how do I do it?
tom
Hi Chudy,
How is this different from what you get by default? Please, send a minimal working example to illustrate the problem.
Thanks, Tom
trinitrocainda
Hi tom,
Thank you for the explanation above. But I have had troubles in removing the hanging indent in the second line after the number of the lof. I mean, I want this:
” Fig 23 Esta es la mayor recopilación de datos hecho por la humanidad desde
que se aprendió a recolectar…………………………………………………………. 106″
to look like this:
” Fig 23 Esta es la mayor recopilación de datos hecho por la humanidad desde
que se aprendió a recolectar…………………………………………………………. 106″
Please, I hope you could help me.
Thank you
tom
Hi there,
I understand your issue. However, it is difficult for me to reproduce it without seeing your code. Please post a minimal working example and I’ll be happy to suggest a solution.
Regards, Tom
Rajesh
Hello,
My report contains long CHAPTER headings, FIGURE and TABLE captions.
I am using the following commands:
The long headings and captions going out of the page (towards the right side of the page), instead of entering the next line.
Is there is any technique to sort out this issue? I don’t wish to use the shortened headings or captions in the table of contents page…
I don’t wish to use the following command:
Thank you,
Regards,
Rajesh
tom
Hi Rajesh,
Thanks for getting in touch. I’ve seen this question several times. Normally, headings and captions are automatically broken. Would you mind to post a minimal working example here to illustrate the problem. If I can reproduce it, I might be able to help.
Best,
Tom
Rajesh
Hello Tom,
Thank you very much for the quick response.
I do get the correct display of headings and captions (in list of contents, list of figures/Tables page), when I use PDFLaTeX + View PDF.
But, whenever I use LaTeX + Dvi->PS + PS->PDF, the long chapter headings and figure/table captions goes out of the page (towards the right margin of the page).
Thank you.
Have a nice day.
Rajesh
The problem is solved just by just removing the following package from the preamble:
tom
Hi Rajesh,
Thanks for posting your solution!
Cheers, Tom
NAJAR Tarek
Hello Tom:
Can you please give me information how to insert a header for each chapter containing the chapter name with a line below
tom
Use the fancyhdr package to change the header and footer. Here is a post that explains the basics. Let me know if you can’t get it to work, ideally provide a minimal working example.
Thanks, Tom
Alex Mwaniki Wambua
Hi, Tom,
Am writing my thesis but have issues with TOC. I need Chapters reflected has Chapter 1:Introduction within the text and Chapter 1 in the TOC. How do i go about this?
tom
Hi Alex,
Thanks for the question. It would have be easier for me if you provided a minimal working example, showing what you have tried so far. I came up with something following your description above. Please give it a try.
Cheers, Tom
Alex Mwaniki Wambua
Dear Tom;
Thanks for the reply.
Am actually compiling PhD thesis and it has worked very well.
The only issue is the space between the chapter and the chapter name;
Chapter 1 Introduction
???
Back Ground
tom
Hi Alex,
To reduce space between chapter and chapter name in the contents, reduce the length. E.g.:
To remove some white space between chapter title and text, use
\vspace{-30pt}
:Hope this helps,
Tom
Alex Mwaniki Wambua
Dear Tom;
Thanks for your continued solutions. It has actually worked!!
tom
Great to hear. Cheers!
Alex Mwaniki Wambua
Dear Tom;
Am importing figure (.epn) into text BUT they are all uncolored. How can i make them colored.
Regards
Alex
tom
I’m afraid, I’ve never heard of the
.epn
figure file format. If you meant.eps
, it should be sufficient to load the graphcix package. Otherwise, try loading the epstopdf package in addition (see below).Best wishes, Tom
Alex Mwaniki Wambua
Thanks Tom, the format is .eps. i will try it and revert back shortly.
Gaurav Singh
Hi Tom!
Is it possible to decide the margin between the list of figures and top of the page? I see huge space from list of figures to top of the page as well as the first entry of the list.
tom
Hi Gaurav,
You can remove white space in the list of figures (see code below). However, I wouldn’t recommend to do that, as it adds an inconsistency with other lists (toc, lot) and chapters in general.
One way to remove white space before lof heading is to patch command
\listoffigures
, which is an unnumbered chapter, using etoolbox. I copied the code from here. To remove white space after the lof heading, simply add a negative\vspace
as a list entry.Hope this helps!
Cheers, Tom
Alaa Bahamran
I tried this code with the List of Figure and it worked great. However, when I use it with the Bibliography the word “Bibliography” appears on the last page, and it doesn’t remove the space after the heading. Any idea of a better way to do that?
tom
Hi there,
My suggestion is a similar patch as I mentioned in the comment using the etoolbox package.
Place the following code right before the bibliography chapter:
See the package documentation and this thread here for more details.
Best, Tom
Brian Wyvill
Hi Tom – very useful article! This question concerns using tocloft and subfig. I am formatting a report for a musician friend and he has a number of lists such as movie, example, diagram. How do I make submovie etc? (sorry don’t have WordPress available right now to beautify this MWE). The log file shows a lot of errors such as: LaTeX Error: No counter ‘submovie’ defined. Clearly the necessary is defined in subfig for the figure environment.
thanks – Brian
tom
Hi Brian,
That’s an interesting question. It turns out, subcaption works better with newfloat than subfig. You can find a minimal example below.
Best,
Tom
Nirbhow Jap Singh
dear sir,
you have presented a wonderful article to help the user for issues related to latex. a number of suggestions i’ve already successfully used from your article, for my work. but i have two problem related to list of figures, tables, symbols.
First problem is that for my work i want that list of figure should appear as:
List of Figures
____________________________________
S.no. Figure name Page no.
_____________________________________
second problems: My list of figures, tables are long and i want that following pages should also contain
_____________________________________
S.no. Figure name Page no.
_____________________________________
tom
Hi there,
Thanks for your question.
You can add them manually on every page, similar to the response here. Or you can add it as a header which is shown here. Please give it a try and let me know if you get stuck. I’m happy to help if you provide a minimal working example.
Cheers, Tom
Colt F.
Hi Tom,
When I create a table of contents, the spacing between the paragraph number and paragraph title changes once the paragraph numbers have an additional digit. For example:
3.8 Title
3.9 Title
3.10 Title
Is there a way to fix this so that all paragraph titles line up?
tom
Hi Colt,
You can increase the
numwidth
through the tocloft package. This is documented here.Hope this helps,
Tom
rizqiya putra
nice sharing really helpful … keep it up,
Frankline Tireito
Hi, working on my thesis and wish to change chapter numbering in TOC be in words
Chapter ONE: Introduction etc
instead of Chapter 1…using report document class
tom
Hi Frankline,
Thanks for your question. I wrote a short article on this topic. Let me know if you encounter any problem.
Best,
Tom
shinichi1988
hello …
I need help with TOC…
I did add this :
to my document and it work nicely, but I want to reduce the space between them… is it possible?
I tried \vspace{1 cm}, but it didn’t work… thanks
tom
Hi there,
You can use the tocloft package to add a negative
vspace
after every chapter toc entry:Obviously, this creates issues when a
chapter
is followed by asection
, as there the whitespace is smaller. See this Q&A for a more complex solution that fixes this issue.Best,
Tom
Mahmood Qureshi
Hi I want to insert the straight horizontal line after the “LIST OF FIGURES”. I also want to capatilze it
tom
Hi Mahmood,
Please see the code below. It uses the tocloft package to add a line after the LOF heading and redefines the title.
Best, Tom
Llorón De Icamole
Hi i have a problem with the number 6, when i make the
\addcontentsline{toc}{chapter}{Contents}
which is in a specific number pf page, the contents appear in other numeration of page:
the page in wich the contents page appear is in Xiii but the table of contents says is in Xii, any toughs?
tom
Hi there,
Try using
\clearpage
after each list. For example:If that does not fix the problem, please provide a complete minimal working example so I can reproduce it.
Best, Tom
ezequiel
thanks for the help!!! and time!! excellent post!!!
Harsh Ahluwalia
I am using tocloft to add word chapter before chapter name in TOC. The alignment of subsequent sections is not as per the requirement.
Chapter 1 Introduction 1
1.1 Section. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.1 Subsection. . . . . . . . . . . . . . . . . . . . . . . . 3
I wish to get 1.1 under I of Introduction.
tom
Hi Harash,
Thanks for you question. You can use the
\cftsetindents
macro to change the indent of headings. Please see the tocloft package documentation for more details. I added a minimal example below.Best, Tom
Konstantinos
Hi Tom, sorry for my english, is not so good, but i hope you undersand my question. In the table of contents i try to make the number of pages clickable, so i use the command
\usepackage[linktocpage=true]{hyperref}. The problem is that in sectionς that are unnumberd, as abstact, or the bibliography dont work. I added these sections in toc with the command \addcontentsline{toc}{section}{the bibliography}. Can you help me;
tom
Hi Konstantinos,
Thanks for your comment. I created a minimal example to reproduce your problem. In the example, I can click the page number of the “Unnumbered” section, by loading the hyperref package the way you did. Therefore, I am not sure what is going wrong in your case. Please provide a similar minimal working example to illustrate the problem.
Thanks, Tom
maxmax2016
Hi Tom,
I have a question that doesn’t seem to have been covered yet.
I have few separated files to be assembled to produce a book.
The book must have a general index that contains the word ‘Page’ before the page number, but only for the first entry; then, starting from the second entry and for all remainings, I need the hash in place of ‘Page’. Something like this:
First — Some title ….. Page 3
Second — Some title .. # 10
Third — Some title …… # 16
and so on.
I use this in a style file (I just write here the part of code related):
And this in any of the text file:
It works fine, but I got the ‘Page’ output for all entries, of course.
How can I change it with ‘#’ for subsequent entries?
Any idea? Thanks a lot!
tom
Hi there,
My first intention would be to do
\renewcommand{\cftpartleader}
and set it to “\#” after the first part. If that doesn’t solve your problem, please provide a minimal working example.Best, Tom
maxmax2016
Hi Tom,
I understand what you mean, but in this way I only got only one OR the other, while I need ‘Page’ just for first one AND # for all the remaining entries.
To better explain,
1) I compile a container file which has a list of tex files to be assembled, in the order I need, to get a book:
\usepackage{mystylefile}
\begin{document}
\tableofcontents
\include{file-1}
\include{file-2}
\end{document}
2) I use a style file for all the tex documents, which defines the index instructions routine (size, margins, spaces etc) to output it, among which the one I posted in my previous message to output ‘Page’, which is the one to be tricked:
\renewcommand{\cftpartleader}{\cftdotfill{\cftdotsep}\text{Page}}
3) Each tex jobs contain the \addcontentsline{toc}{part}{Something — Some title}, to trigger toc, in order to have one entry in index for each job. Simplifying, my toc has an entry for every file, containing the page number related to the whole book after appended.
Now, I wonder how and where define that, starting from second file, I should use this:
\renewcommand{\cftpartleader}{\cftdotfill{\cftdotsep}\#}.
I’m thinking about a counter, but really still a nightmare.
Thanks!
tom
Hello again,
Below is a minimal working example that illustrates a possible solution. It defines a command that prints “Part”, which is redefined to “#” and saved to the toc file after the first part.
Best,
Tom
maxmax2016
Thanks Tom.
It works, but it’s a fully manual procedure.
Is it possible to handle it in my stile file, as I told you I’m actually using, with a kinda of counter, triggered inside style itself or inside text jobs?
Thanks
tom
I see. You can extend the part command with a conditional on the part counter. This code can be moved to the style file. The minimal example only covers numbered parts. If you have unnumbered parts, google for “custom chapter latex” and implement it accordingly.
HTH, Tom
Carla
Hello, currently I have the code below and I would like to increase the space between the number and the text in the list of figures, any idea how to do this?
tom
Hi Carla,
Thanks for your comment. You can increase the space between the number and the text through the tocloft package. See the package documentation for more details.
Best, Tom
Rasoul
Hi Tom,
May I ask you please to let me know how to equalize the spaces between figure\table headings of different chapters in the list?
It, by default, adds a space before and after headings of new chapters.
Your feedback would be a great help to me.
Thanks
tom
Hi Rasoul,
Thanks for your comment. Could you provide a minimal working example? This will help me to suggest a possible solution.
Best, Tom
Brolin
Hi Tom,
I am new to latex. I managed to make my page numbers look in the format {section number}-{page number}.
Example: If I have section going from page 1 to page 3. It will be numbered as 1-1, 1-2, 1-3.
I did this by using “\setcounter{page}{1}” command. But the same page number does not appear in the TOC. TOC looks like the following
Section 1 ……………………………. 1
subsection…………………………. 2
Section 2 ……………………………… 1
subsection………………………….. 2
subsection……………………………3
My Question is, how do I format the page number in TOC?
tom
Hi Brolin,
What you did is change the actual counter value. What you actually want is to change the way the counter value is printed. LaTeX uses the macro \thecounter to do that. See the minimal example below.
Best, Tom
Cario1818
Hi Tom,
I would love your thoughts on the following problem.
I wanted to remove any bold-facing from the table of contents page. So that all headings and sub-headings appear in regular font. To do so, I used the following:
However, I want the actual title of the page that reads “Contents” to be bold like the rest of chapters.
Is there a solution for this?
Any thoughts would be appreciated.
tom
Hi there,
Please take a look at the tocloft package. It offers a lot of flexibility when it comes to formatting of the contents lists.
Best, Tom
Yuliet
Hi Tom,
Something strange is happening with my code and is that the lof and lot show in the contents without me adding them and I just want to remove them. Do you know any way to do this? I am also trying to add one line to the content but it does not show where I add it, it shows after a whole chapter. It would be great if you could help me with this. Thanks in advance! Here is my code:
tom
Hi Yuliet,
I can’t really reproduce this. Try using the following package with the options to remove them from the table of contents.
\usepackage{notlof,notlot]{tocbibind}
Also, in my minimal example the added contents line appears before the chapter. Perhaps you are loading a package that interferes. Try creating a minimal example and add the packages one by one. If you need further help, please provide a minimal working example like the one below.
Hope this helps.
Best,
Tom