By default, the table of contents (TOC), list of figures (LOF) and list of tables (LOT) are typeset as chapters when using the report document class. However, the level of the heading can be changed. In this post, I will show how to decrease the level of the TOC, LOF, and LOT to section
. Similarly, the level can be changed for other LaTeX document classes.
Essentially, we change the heading level, but not the content of the three lists:
\tableofcontents \listoffigures \listoftables
To do that, we redefine these commands using renewcommand
. For example, to change the TOC heading level to section
, we use to following code in the preamble:
\makeatletter \renewcommand\tableofcontents{% \section{\contentsname}% \@mkboth{\MakeUppercase\contentsname}% {\MakeUppercase\contentsname}% \@starttoc{toc}% } \makeatother
Similarly, the heading level of LOF and LOT can be changed to section
(see the complete code below).
\documentclass[12pt]{report} \makeatletter \renewcommand\tableofcontents{% \section{\contentsname}% \@mkboth{\MakeUppercase\contentsname}% {\MakeUppercase\contentsname}% \@starttoc{toc}% } \renewcommand\listoftables{% \section{\listtablename}% \@mkboth{\MakeUppercase\listtablename}% {\MakeUppercase\listtablename}% \@starttoc{lot}% } \renewcommand\listoffigures{% \section{\listfigurename}% \@mkboth{\MakeUppercase\listfigurename}% {\MakeUppercase\listfigurename}% \@starttoc{lof}% } \makeatother \begin{document} \chapter{Some Chapter} \begin{table}[h]\caption{Some table}\end{table} \chapter{Other Chapter} \begin{figure}[ht] \centering\rule{6cm}{4cm}\caption{Some figure}\end{figure} \chapter{Lists} \tableofcontents \listoffigures \listoftables \end{document}
This post was inspired by a reader’s question. Do you have a question? Please get in touch through the comment form below.
Fernando
Hello! I hope you are all ok.
I am doing a work where I am using a lot of tables and figures. In both cases besides the caption I need to provide the source of the data and also to give some explanation right above or below the figure/table. However, in the “List of figures” and “List of Tables” I only want the name of the figure/table that I introduce with caption. For example, if I want to put a figure about copper consumption where data is from Bloomberg:
How can I do this avoiding to put the other coments (in this case “Source: Bloomberg”) inside {} so that they do not appear in the list of figures/tables and only above or below the figure/table which I refer?
This blog is great it is a great help.
Best regards!
tom
Hi Fernando,
The
\caption
command takes an optional argument, for the text to be produced in the list of figures/tables.Therefore, this is what you can do:
Polat
how can I leave some space between figurenumber and name in this example which I have added a picture
The link is:
https://hizliresim.com/EqkOr8
the coding of listoffigures in my ct file is below:
Sorry I don’t know any coding for latex. I am only user not programmer of latex.
What do I need to add and where in the code snippet. I am using \listoffigures command in my real document and it show figures automatically so I believe I need to change something here on the code I posted.
I would be grateful if you can help
Thanks
tom
Hi Polat,
I suggest to use the tocloft package to add extra space between the figure number and the caption. Hope this helps.
Best Tom.
Minimal working example:
Fernando
Hello Tom I hope you are doing fine.
I was wondering if you can help me with an idea of how can I insert a text inside a box in my document. I tried using \usepackage[framemethod=TikZ]{mdframed} (I followed the tips from http://tex.stackexchange.com/questions/36524/how-to-put-a-framed-box-around-text-math-enviroment)
However with this procedure the box breaks between pages.
Do you have a better idea of doing this?
Sorry my questions but I believe this is the best forum to get different latex insights.
Best Regards.
tom
Hi Fernando,
Please provide a minimal working example in order for me to better understand what you are trying to do.
In the meantime, you may find this site helpful: Boxes on LaTeX Wikibooks.
Also, please try to find an article that is related to your question if possible, using the search field on the right.
Best wishes, Tom
Fernando
Thank you very much Tom. Yes I was searching on different websites and one of them was wikibooks.
I solved one part of my question. I made a box in my document that I placed inside a figure environment (to be able to place the box on top of the page).
My only question is that if there is a way to reference the box as you can do it with figures and tables using \ref.
Here is a minima example of my question (first is defined the box properties and then the box is created on the document):
I would like to know if there is a simple way to reference the box (since I do not want to use the caption option for the figure as it would need to be referenced as a box).
Thank you very much for all the help.
Regards!
tom
Hi Fernando,
Here is a possible solution that you might change according to your needs. It creates a new environment
mybox
together with a counter. Currently, the counter prints the section followed by its number and is reset at every section. But that can be changed. The examples below show how to use and reference the environment. I also wrapped the environment in aminipage
environment to place it on top of the page whenever possible.Hope this is what you were looking for.
Best, Tom
Fernando
Thank you very much Tom!
I will try it.
Regards.
Fernando
Hello Tom that worked great! Now I am ok with that part that was giving me many problems.
One more question if anyone is able to help me with this please.
Now I am trying to align different boxes in one page where the boxes have different size (the text is different inside them). I am trying to use the boxes inside a figure environment so they can be aligned, but does not work properly. I would like to give you an idea but I can not attach a picture here of what I am trying to do.
Anyway here is a minimal working example (each box consist of a list of elements for different countries and the countries are the titles of each box):
…….
….
Thank you for all the incredible help.
Best Regards!
tom
Hi Fernando,
Try the
minipage
environment instead of subfigure from the subcaption package. Below is a possible solution. Alternatively, you could just make all the boxes the same size by adding extra empty lines.Cheers, Tom.
Fernando
Thank you-thank you-thank you!
Awesome man!
Regards!
Fernando
Hi there. I am sorry if this question should not be added here but is similar to table of figures.
I was wondering if someone knows how to “tell” LaTeX to print an Index of Boxes (“Recuadros” for me), in a similar way to the regular Index of Tables. In the last case there is an extra space between tables from different sections, something I have been unable to to in the case of boxes.
The way I am doing the boxes is first to define the style and then the numbering for the boxes (using mdframed):
However I can not get the vertical space as in the list of figures and tables that Latex put by default. I thought by modifying
\@chapter
slightly to add automatically vertical spacing to the .lob file after each\chapter
starts would fix it, but it is not the case (I am using\documentclass[twoside]{book}
).Thank you for your help.
Regards.
tom
Hi Fernando,
Thanks for your question. I ran your code and the list of boxes looks exactly like the list of tables in my minimal example below, with some extra space to separate entries from different chapters. Also, above you say the space should be between sections and below you say between chapters. Could you clarify please.
Thanks,
Tom
Fernando
Thank you ver much Tom, I am sorry for the confusion. I meant the space between the names of tables and figures when you print the index of tables and figures.
They have an extra space between chapters, something that I have not been able to reproduce when I print the list of boxes, which I tried by using
\addtocontents{lob}{\protect\addvspace{10\p@}}
.Best Regards.
tom
If I run you code, the command patch works and I do get the extra vertical space between entries from different chapters. Please check if you have a recent version of LaTeX installed and update if necessary. If that’s not the issue, please post a complete minimal example.
Best, Tom
Fernando
Thank you Tom. I have MikTeX 2.9 and Texmaker 4.4.1
Regards!
Fernando
I did not want to put the complete code but as you requested I put it here.
Maybe in some of the lines something makes the problem that happens in \addcontentsline{toc}{chapter}{ÍNDICE DE RECUADROS} at the very end:
[…]Code removed by Tom[…]
tom
I didn’t request your complete code. I asked for a minimal example, which illustrates your problem in a few lines of code. Please try to provide that and I’ll be happy to take a look.
Thanks, Tom
Shaival Nagarsheth
Hello Sir,
I am using Tex Maker
Now the problem is list of figures and list of tables.
In it the many of the names of the figures and tables are very long, so the names are going out of the pages instead of coming in the line below it. I suppose the problem lies in the width of the column in the list of figures and list of tables.
I know how to change the width of a normal table inside. But I dont know how to deal with this problem of long names going out of the page for this.
Please urgent help is required.
tom
Hi Shaival,
Thanks for your question. I’ve heard this a couple of times. Normally, line-breaks are automatically added in the LOF/LOT. Therefore, I can’t replicate the problem. Please provide a minimal working example to illustrate the issue. In general, I prefer to have a short version of the caption (e.g. first sentence) to be reproduced in the list of figures/tables. You can do this through the optional argument to caption.
HTH,
Tom