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}
March 21st, 2008 at 12:43 am
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
March 21st, 2008 at 9:35 am
Hi there,
You can change the title as follows:
\renewcommand\listfigurename{Lista de Figuras} \listoffiguresSimilarly, you can change “Table of Contents” (
\contentsname) and “List of Tables” (\listtablename).You might also want to consider changing you whole document language to Spanish:
\usepackage[spanish]{babel}Which not only renames “List of Figures” to “Indice de figuras”, but uses Spanish hyphenation, etc.
April 9th, 2012 at 5:27 pm
Hi,
I tried that and it does change the title of the section “List of Figures” to “Lista de figuras”, but the entry in the Table of Contents is still “List of figures”.
How can I change the name of the entry inside the Table of Contents?
Thanks
April 10th, 2012 at 6:40 am
Hi!
You have to manually add it to the table of contents. By the way, loading the babel package with the option spanish automatically changes the names. Have a look at the minimal working example below:
\documentclass[12pt]{report} \usepackage[spanish]{babel} \begin{document} \tableofcontents \addcontentsline{toc}{chapter}{\listfigurename} \listoffigures \chapter{First} \begin{figure}[ht] \centering \rule{4cm}{3cm} \caption{Figure placeholder.} \end{figure} \end{document}Best, Tom.
April 10th, 2012 at 7:32 am
Hi!
I tried that but it just creates another entry in the Table of Contents, which doesn’t point to any page (you click on it an nothing happens). Also, another “List of figures” entry appears, so I have that entry twice: one in spanish and the other in english. I already used the babel package and still doesn’t work. My code is the following:
\lhead{\emph{Índice general}} \tableofcontents \addcontentsline{toc}{chapter}{\listfigurename} \listoffigures \lhead{\emph{List of Tables}} \listoftablesThanks for your help!
April 10th, 2012 at 7:52 am
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
hyperrefpackage after loading all the other packages in your preamble.Cheers, Tom.
April 1st, 2008 at 3:36 am
Oh, sweet. Thanks man, that was very helpful. Glad to see that there are other people doing some LaTeX stuff these days
April 18th, 2008 at 6:12 pm
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!
April 18th, 2008 at 9:32 pm
Hi Andrey,
Good question indeed. The answer is astonishingly easy. You just need to change the list-of-figure depth to 2 before generating the list:
\setcounter{lofdepth}{2}By the way, if you want numbers instead of (a), (b) and (c), you would need to change \thesubfigure command. E.g.:
\renewcommand{\thesubfigure}{\thefigure.\arabic{subfigure}}Does this answer your question?
Cheers,
Tom
April 27th, 2008 at 10:14 am
Hi,
I’m preparing a book and have more than 9 chapters and more than 9 figures in those chapters. Hence, the figure numbers look like XX.XX and they are so wide that they touch the titles in the list of figures. How can I increase the width for the numbers allocated in the list of figures?
Many thanks in advance,
Axel.
May 4th, 2008 at 7:41 am
Salut Axel,
Here is how you can increase the space between the number and the caption in your \listoffigures. Add the following two lines before your \begin{document}:
\usepackage{tocloft} \setlength{\cftfignumwidth}{3em}With the tocloft-package you can control the design of table of contents, figures and tables.
Cheers,
Tom
April 21st, 2011 at 2:52 am
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!
April 21st, 2011 at 11:27 am
Hey Kathleen,
.
I’m happy, I could help. I wish you all the best with your thesis
Tom.
April 22nd, 2011 at 10:59 pm
Ditto Kathleen– I’m just finishing my thesis and this was one of the last things I had to fix. Thanks for the help!
February 17th, 2012 at 5:51 pm
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!
February 17th, 2012 at 6:00 pm
Well my solution for now was to insert some hard spaces “\ \ ” into the caption for the diagrams.
February 18th, 2012 at 5:23 am
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 withsection, 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.
May 20th, 2008 at 12:31 am
Great website, your tips are very helpful.
I have a random question — is there a way to suppress page numbering on your List of Tables? I want the page numbers for the actual tables in the list, I just need to start my whole document’s page numbers after the table of contents, etc. I was able to suppress page numbering for the Table of Contents and List of Figures using the fancyhdr package and this code:
\fancypagestyle{plain}{ \fancyhf[]{} } \renewcommand{\headrulewidth}{0pt}but that doesn’t seem to work for the tables.
Thanks!
Lydia
May 28th, 2008 at 6:27 pm
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
May 29th, 2008 at 1:02 am
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?
October 24th, 2012 at 3:22 pm
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}June 3rd, 2008 at 2:50 pm
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
February 17th, 2012 at 6:02 pm
Peto, use
\caption[short caption]{long caption}when you write your captions.
July 3rd, 2008 at 11:07 am
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
July 6th, 2008 at 11:35 am
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?
July 12th, 2008 at 10:01 pm
Hi Kate,
Thanks for your comment. The solution to your problem is easy, but not really obvious. What you do is insert a
\newpageafter your last page having roman numbering. E.g.:\pagenumbering{roman} \tableofcontents \listoffigures \newpage \pagenumbering{arabic}Hope it works now,
Tom
July 19th, 2008 at 11:39 pm
I need the word chapter (e.g., ‘Chapter 1: … )’ to appear in my table of contents. However, my thesis file only produces a list of numbers such as
1 Introduction
1.1 Motivation
1.2 Previous work
2 Algorithm
Instead I need
Chapter 1: Introduction and so on…
The usual chapters are all fine and produce a ‘Chapter x’ heading but just the table of contents does not have the word Chapter x :
Would appreciate suggestions..
Thanks
July 20th, 2008 at 9:40 pm
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
July 21st, 2008 at 9:03 am
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.
July 24th, 2008 at 9:17 pm
Hi Andreu,
You have to redefine the table counter (\thetable) as follows:
Define your own counter.
\newcounter{mytable}Tell Latex to replace the existing table counter with your new counter “mytable” and increase it everytime you use it.
\renewcommand{\thetable}{\addtocounter{mytable}{1}\themytable}To answer your second question, you can set the page counter to any value:
\setcounter{page}{1}Cheers,
Tom
July 25th, 2008 at 10:34 pm
Hello,
I am using Latex and I have a question.
I would like the Table of contents to appear as Table of Contents but not only Contents.
I used the following code.
\pagenumbering{roman} Acknowledgement, abstract \tableofcontents \listoffigures \newpage \pagenumbering{arabic}can this be done.
Thanks
July 28th, 2008 at 9:06 pm
Hi Kobby,
There is already a comment on this topic (see comment by iliana above):
What you would have to add before your TOC:
\renewcommand\contentsname{Table of Contents}
Cheers,
Tom
July 29th, 2008 at 9:30 am
Hi,
First of all, I would like to thank you for your piece of advice. But I still have problems with the tables. I defined my own counter, and I succeed in numbering my TOC with integer numbers, but now the captions of the tables don’t match with them. Do you know if it’s possible to solve it?
Thanks again for your time.
July 29th, 2008 at 9:37 pm
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
July 30th, 2008 at 1:11 pm
Hi Tom,
I’m sorry, you were right, I was referring to the list of tables.
My problem is that using your proposed command, I get, in the list of tables and the table labels, integers values continuous over all the chapters but they don’t match with the table captions, which are set randomly. I’ve tried to typeset more than twice, but it doesn’t work yet.
Perhaps, the problem is that I’m not using your command in a properly way.
Thanks again in advance.
August 7th, 2008 at 9:42 am
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?
August 7th, 2008 at 12:30 pm
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
August 11th, 2008 at 10:53 pm
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}
August 12th, 2008 at 9:39 am
Hi Susan,
Usually, if you want to add something to the table of contents (TOC), you can use “addcontentsline”, e.g.
\listoffigures\addcontentsline{toc}{section}{List of figures}The first command produces the list of figures and the rest adds it to the TOC.
Now if your list of figures spans more than one page, Latex will automatically use the last page number in the TOC, which is usually not wanted. There is another package which I would suggest you to use called
tocbibind.
Hope this works out.
Good luck with your thesis!
Tom
May 11th, 2011 at 2:36 pm
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.
August 12th, 2008 at 3:29 pm
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
August 13th, 2008 at 9:47 pm
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
August 15th, 2008 at 12:09 pm
ok, liststotoc did the job (not listtotoc as I have been trying before) ..
cheers
susan
August 15th, 2008 at 4:04 pm
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…
August 15th, 2008 at 5:14 pm
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
August 24th, 2008 at 6:08 am
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
August 24th, 2008 at 7:00 am
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
September 16th, 2009 at 3:00 pm
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}August 27th, 2008 at 1:14 pm
Hi!
Great blog! Very helpful!
I have a question about making the captions shorter in the list of figures. Do I just add \caption[]{} where I have all the other information in the text about the figures, or do I have to add something else?
Thanks!
August 27th, 2008 at 8:41 pm
Hi Roxanna,
You were right, just use
\caption[Your list of figure text]{Your long caption text}Tom
September 3rd, 2008 at 12:47 pm
Hi,
I need the word table and figure (e.g., ‘Table 1. … Figure 1.)’ to appear in my list of tables and figures. However, my thesis file only produces a list of numbers such as
LIST OF TABLES
1 XXXXXX ……… 5
2 YYYYY ………… 8
LIST OF FIGURES
1 TTTTTTTTT…….12
2 ZZZZZZZZ…….30
Instead I need
Table 1. XXXXXXX………5
and
Figure 1. TTTTTTTTTTTT………12
The usual tables and figures are all fine and produce a ‘Table x’ and ‘Figure t’ heading but just the list of tables and figures does not have the word Table x. and Figure t.
Would appreciate suggestions..
Thanks
September 8th, 2008 at 12:35 pm
Hi. thank you for your useful and easy-to-follow info. I just wonder if I want to put “Table” and “Figure” these words into my lists of figures and lists of tables, what should I do? I’ve tried \isucaption, but it gives me an error message. by the way, I defined mine like this…
\usepackage[isu,small,bf,up]{caption2}Many Thanks in Advance.
September 8th, 2008 at 12:40 pm
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
September 11th, 2008 at 7:27 am
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} \listoffiguresto 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
September 11th, 2008 at 12:37 pm
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
September 12th, 2008 at 12:38 am
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
September 12th, 2008 at 7:11 am
Hi, Tom,
Thanks for your answer. When I insert
\usepackage{tocloft} \renewcommand{\cftfigfont}{fig.} \newcounter{myfigure} \renewcommand{\thefigure}{\addtocounter{myfigure}{1}\themyfigurebefore
\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
June 25th, 2009 at 5:43 am
Hi Ken !!
Please, I need help !
What did you do to fix the that wrong figure numbering ?
I use the code:
\usepackage{tocloft} \renewcommand{\cftfigfont}{fig.} \newcounter{myfigure} \renewcommand{\thefigure}{\addtocounter{myfigure}{1}\themyfigureAnd, in fact, every figure number is crazy, I mean: By now Figure 1 is Figure 38, Figure 2 is Figure 42, Figure 3 is Figure 47 and so on. I don’t know what to do.
Please, let me know what did you do..
Thank you in advance….
June 25th, 2009 at 5:51 am
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}\themyfigureJust delet it, and everything is gonna be OK.
Enjoy !
September 13th, 2008 at 4:59 am
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
September 13th, 2008 at 9:18 am
Hi Jag,
It might be that your class file defines the header to show “Appendix Figure” for figures which are part of the appendix. You might want to check your class file and see if there is something similar to this totorial explaining exactly what you want to omit.
Sorry, I cannot tell you more than that without seing your Latex document/class file.
Good luck with your thesis,
Tom
September 13th, 2008 at 12:04 pm
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} \listoffiguresand because i need the list of figures and also the list of tables ,i would be very happy to find a solution ,thks
here is the code
\begin{document} \ifpdf \DeclareGraphicsExtensions{.pdf,.jpg,.png} \else \DeclareGraphicsExtensions{.eps} \fi \pagestyle{empty} %No headings for the first pages. \include{title} \dominitoc \pagestyle{plain} \pagenumbering{roman} \tableofcontents \clearpage \addcontentsline{toc}{chapter}{Liste Des Figures} \listoffiguresSeptember 13th, 2008 at 1:47 pm
Hi Simo,
You can only add the list of figures to your table of contents after creating it. So simply change the order of the following two commands:
\addcontentsline{toc}{chapter}{Liste Des Figures} \listoffiguresto
\listoffigures \addcontentsline{toc}{chapter}{Liste Des Figures}Cheers,
Tom
September 14th, 2008 at 7:05 am
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
September 14th, 2008 at 5:50 pm
Hi Gaby,
I suggest you try the following piece of Latex code. You will have to customize it to your needs, but as a first approach it should solve your problem.
\newcounter{mybatchcounter} \newcommand{\batch}[1]{ \addtocounter{mybatchcounter}{1} \section{Batch \themybatchcounter} \begin{figure}[ht] \centering \includegraphics[width=\textwidth]{#1/Test1.jpg} \caption{} \includegraphics[width=\textwidth]{#1/Test2.jpg} \caption{} \includegraphics[width=\textwidth]{#1/Test3.jpg} \caption{} \end{figure} \newpage} \batch{batch1_dir} \batch{batch2_dir}Let me know if this is not what you were looking for.
Cheers,
Tom
September 15th, 2008 at 7:19 pm
Hi, great blog. Anyway, in my table of contents I need the word ‘Chapter’ before my chapters, but if I add the code:
\usepackage{tocloft} \renewcommand{\cftchapfont}{Chapter }then I get the word Chapter before my chapters but also before my List of Figures and List of Tables. Is there a way for my Table of Contents to just say
List of Figures…
Chapter 1: Introduction
instead of
Chapter List of Figures
Chapter 1: Introduction.
Also, two quick questions:
1) Is there an easy way to center the heading for the Table of Contents
2) Is there an easy way t o add dots to every line in the Table of Contents (right now I only have dots to my sections).
September 15th, 2008 at 8:40 pm
Hi Jon,
I am not sure if I completely understand all of your problems, but I can certainly give you some hints.
If you want “Chapter” in the TOC entries, but not in the LOF/LOT, simply use the command:
\renewcommand{\cftchapfont}{}after generating your TOC.
However, I don’t understand why you get “Chapter” in front of your list titles, this seems a bit weird to me. I tried your code and I only got “Chapter” in front of my TOC entries.
1) You can use
\centering{\cfttoctitlefont}to centre your TOC title, it worked for me.
Similarly, you can centre LOF and LOT titles.
2) Adding dots between chapters can be done as follows:
\renewcommand{\cftchapleader}{\cftdotfill{\cftsecdotsep}}Cheers,
Tom
September 16th, 2008 at 7:55 am
Hi Tom,
Thanks for the reply,
I looked at my original post, and realized that I was not clear about what I was trying to do. I hope this time i’ll be more precise:
I have figures in different sections that get the same name (the figures), and when I generate the list of figures there is no possibility to know to which section the figure belongs to.
What commands do I need to add so that the LOF will look like:
Section 1.4 Superman vs. Spiderman with Kripton
1. Test1 ….
2. Test2 ….
3. Test3 ….
Section 1.5 Superman vs. Spiderman without Kripton
4. Test1 ….
5. Test2 ….
6. Test3 ….
and not like:
1. Test1 ….
2. Test2 ….
3. Test3 ….
4. Test1 ….
5. Test2 ….
6. Test3 ….
I managed to do that by manualy changing the LOF file, but those changs apply only for the next compilation, since they are overwritten with the newly generated LOF file.
Thanks
Gaby
September 17th, 2008 at 7:58 pm
Tom, thanks for the help. I ended up resolving my ‘Chapter’ problem with the following code (just adding it in case anybody else has a similar problem):
\usepackage{tocloft} \renewcommand{\cftchappresnum}{Chapter } \renewcommand{\cftchapaftersnum}{:} \renewcommand{\cftchapnumwidth}{6em} \renewcommand{\cftchapleader}{\cftdotfill{\cftsecdotsep}}and then adding my bibliography or list or whatever to the Table of Contents where needed via:
\addcontentsline{toc}{chapter}{Bibliography}September 18th, 2008 at 5:27 am
Thanks Tom! I finally figured it out after some head-scratching..
—————————————–
Hi Jag,
It might be that your class file defines the header to show “Appendix Figure” for figures which are part of the appendix. You might want to check your class file and see if there is something similar to this totorial explaining exactly what you want to omit.
Sorry, I cannot tell you more than that without seing your Latex document/class file.
Good luck with your thesis,
Tom
September 22nd, 2008 at 4:51 pm
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.
September 22nd, 2008 at 6:29 pm
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
September 23rd, 2008 at 8:28 am
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.
September 23rd, 2008 at 10:05 am
Hi Neil,
I am not sure if the actual problem is the tocloft package. Does the header/footer appear on the TOC/LOF/LOT pages when you are not using the tocloft package?
Anyway, you can “force” the header to appear, e.g. for the table of contents:
\addtocontents{toc}{\protect\thispagestyle{fancy}} \tableofcontentsHope this works out,
Tom
September 23rd, 2008 at 11:34 am
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.
September 28th, 2008 at 10:59 pm
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
September 29th, 2008 at 7:28 pm
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
September 30th, 2008 at 5:39 pm
Hi Tom,
sorry, I didn’t express this properly. I’m definitely going to use a separate
\listoffiguresand\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\addcontentslinebefore\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
October 5th, 2008 at 5:54 pm
Hi Philipp,
Simply insert a page break before your lof/lot:
\tableofcontents \newpage \addcontentsline{toc}{figure}{List of Figures} \listoffigures \newpage \addcontentsline{toc{table}{List of Tables} \listoftables \newpageCheers,
Tom
October 11th, 2008 at 2:44 pm
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
October 12th, 2008 at 7:05 pm
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
April 15th, 2011 at 5:22 pm
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
April 18th, 2011 at 11:09 am
Hi Gizmo,
Thanks for pointing this out. I had a look at the problem and you are right, the code I posted is not working very well. However, I found this, which seems to work smoothly:
\addtocontents{toc}{~\hfill\textbf{Page}\par} \addtocontents{lof}{~\hfill\textbf{Page}\par} \addtocontents{lot}{~\hfill\textbf{Page}\par}Add the lines just after you produce the toc/lof/lot.
Tom.
October 13th, 2008 at 12:12 pm
Hi Tom,
I have a large table with multiple rows. I have taken care to split the table into two which results in two similar table environments and produces the table segmented into two over two pages as i wanted (for some reason longtable never worked for me). In addition, i was able to paste the table notes below the second table, and there were a lot of these (there seems to be no sound table package which allows continuation over multiple pages and takes care to include the table notes appearing below the bottom margin of the table). The only problem with my table now is that even if i append Continued atop the second part of the original unsegmented table, this word along with an increased table numbering gets included in the listoftables. I know about the \captionsetup[figure]{list=no} command mentioned above. In all honesty, i have no idea whereabouts in the table environment this gets included but i would like this second table to remain unnumbered and in addition would like to be able to have Table 4.1, say, appear on top of the second segment along with the word -Continued……any ideas????
Thanks in advance,
Robert.
October 13th, 2008 at 9:56 pm
Hi Robert,
I hope I correctly understood your issue. Have a look at the following very short example and let me know what you think?
Btw. Explicitly using the caption-package, Latex will not add a list of table entry if you leave the optional brackets empty:
\caption[]{Your caption text}Cheers,
Tom
\usepackage{caption} ... \begin{table}[ht] \centering \begin{tabular}{|c|c|} \hline a&b\\ \hline c&d\\ \hline \end{tabular} \caption{First part} \label{tab:a} \end{table}% \addtocounter{table}{-1} \begin{table}[ht] \centering \caption[]{Continued} \begin{tabular}{|c|c|} \hline a&b\\ \hline c&d\\ \hline \end{tabular} \label{tab:b} \end{table}%October 14th, 2008 at 4:01 pm
hi every one
i have a problem with the caption of figure , after compiling , the same title repeat twice i dont know why?? and i have errors
\begin{figure}[h] \includegraphics{K4MAFJ01__2} \caption{agents that maintain state}\label{fig:fig2} %this one \end{figure}the result is like this : the figure right here after these two titles
agents that maintain state
Fig1.1 agents that maintain state %in italic just after
Fig1.1 agents that maintain state
the errors are :Missing \endcsname inserted
1.53 …{references\relax}{figure.1.1}{}}
Latex Error: Missing \begin{document}
the source of the prob here:
\@writefile{toc}{\contentsline {chapter}{\numberline {1}Some small hints}{1}{chapter.1}}
\@writefile{lof}{\addvspace {10\p@ }}
\@writefile{lot}{\addvspace {10\p@ }}
\@writefile{lof}{\contentsline {xchapter}{Some small hints}{1}{chapter.1}}
\@writefile{lot}{\contentsline {xchapter}{Some small hints}{1}{chapter.1}}
\newlabel{hints}{{1}{1}{Some small hints\relax }{chapter.1}{}}
\@writefile{toc}{\contentsline {section}{\numberline {1.1}References}{1}{section.1.1}}
\newlabel{references}{{1.1}{1}{References\relax }{section.1.1}{}}
\@writefile{toc}{\contentsline {section}{\numberline {1.2}Dividing large Documents}{1}{section.1.2}}
\newlabel{dividing}{{1.2}{1}{Dividing large Documents\relax }{section.1.2}{}}
\@writefile{toc}{\vspace *{\baselineskip }}
\@writefile{toc}{\contentsline {starchapter}{Bibliographie}{1}{section.1.2}}
\@writefile{lof}{\contentsline {figure}{\numberline {1.1}{\ignorespaces agents that maintain state}}{2}{figure.1.1}}
\newlabel{fig\@DP fig2}{{1.1}{2}{References\relax }{figure.1.1}{}}
thank you for your responses
October 14th, 2008 at 9:05 pm
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
October 14th, 2008 at 10:42 pm
thank you Tom, here is all the code
\documentclass[a4paper,oneside,11pt]{report} \usepackage[left=1in,right=1in,top=1.1in,bottom=1.1in]{geometry} \usepackage[french]{babel} \usepackage[pdftex]{hyperref} \hypersetup{ colorlinks,% citecolor=black,% filecolor=black,% linkcolor=black,% urlcolor=black} \newif\ifpdf \ifx\pdfoutput\undefined \pdffalse %%normal LaTeX is executed \else \pdfoutput=1 \pdftrue %%pdfLaTeX is executed \fi \ifpdf %\usepackage{ae} %%Use only just one of these packages: %\usepackage{zefonts} %%depends on your installation. \else %%Normal LaTeX - no special packages for fonts required \fi %% Language %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\usepackage[francais]{babel} \usepackage[T1]{fontenc} \usepackage[latin1]{inputenc} %% Packages for Graphics & Figures %%%%%%%%%%%%%%%%%%%%%%%%%% \ifpdf %%Inclusion of graphics via \includegraphics{file} \usepackage[pdftex]{graphicx} %%graphics in pdfLaTeX \else \usepackage[dvips]{graphicx} %%graphics and normal LaTeX \fi %\usepackage[hang,tight,raggedright]{subfigure} %%Subfigures inside a figure %\usepackage{pst-all} %%PSTricks - not useable with pdfLaTeX %% Math Packages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage{amsmath} \usepackage{amsthm} \usepackage{amsfonts} \usepackage{xtab} \usepackage{array} \usepackage {graphicx} \newcommand{\HRule}{\rule{\linewidth}{0.5mm}} \begin{document} \ifpdf \DeclareGraphicsExtensions{.pdf,.jpg,.png} \else \DeclareGraphicsExtensions{.eps} \fi \pagestyle{empty} %No headings for the first pages. \include{title} %% Title Page %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% ==> Write your text here or include other files. \pagestyle{plain} \addcontentsline{toc}{chapter}{Contents} \tableofcontents %Table of contents \pagenumbering{roman} %% The List of Figures \clearpage \addcontentsline{toc}{chapter}{List of Figures} \listoffigures %% The List of Tables \clearpage \addcontentsline{toc}{chapter}{List of Tables} \listoftables \clearpage \pagenumbering{arabic} \chapter{Some small hints} \section{References} \begin{figure}[h] \centering \includegraphics[scale=0.5,angle=270]{xxs} \caption{agents that maintain state} \end{figure} \section{Dividing large Documents} \end{document}October 15th, 2008 at 9:29 am
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??
October 15th, 2008 at 11:20 am
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
October 15th, 2008 at 12:47 pm
Tom, is this the link for the new package??http://www.tug.org/protext/
protext is the same thing as miktex?
October 15th, 2008 at 2:08 pm
You can get the latest version of MikTex from here:
http://www.miktex.org/
Cheers,
Tom
October 15th, 2008 at 9:04 pm
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
October 15th, 2008 at 10:45 pm
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.
October 16th, 2008 at 10:35 am
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.
October 16th, 2008 at 2:12 pm
Thanks! Your answer to Axel mostly fixed my problem.
However, I had to use
\usepackage[subfigure]{tocloft} \setlength{\cftfignumwidth}{3em}or else I got a “Command
\c@lofdepthalready 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\clearpagecommand before\listoffigures.Thanks again; this saved me some hair-pulling!
October 16th, 2008 at 3:56 pm
i dont know why i have dash instead of bullet?? when i use itemize
it seems like its the default parameter.
October 16th, 2008 at 7:10 pm
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
October 16th, 2008 at 8:52 pm
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.
October 16th, 2008 at 9:26 pm
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.?
October 16th, 2008 at 11:00 pm
even with the last update of babel package , same thing.
October 16th, 2008 at 11:06 pm
the german package for babel works perfect for itemize
complicated
what the hell with these french
please Tom help
October 17th, 2008 at 6:44 am
Hi Yan,
You can use
in the preamble after loading the babel package.
Tom.
October 17th, 2008 at 9:24 am
i just find it on the
\frenchbsetup, exact, you’re right TOMthanks
October 20th, 2008 at 2:08 am
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 \newpageThe 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
October 20th, 2008 at 9:19 pm
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.
October 22nd, 2008 at 11:39 pm
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
October 22nd, 2008 at 11:40 pm
Hi Yan,
Check out the minitoc documentation available in both, English and French.
Tom
October 23rd, 2008 at 10:03 pm
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
October 23rd, 2008 at 10:58 pm
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
October 24th, 2008 at 12:32 am
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.
October 28th, 2008 at 8:09 pm
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.
October 30th, 2008 at 8:32 pm
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
October 30th, 2008 at 9:18 pm
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.
October 31st, 2008 at 3:33 pm
Hi Tom,
appreciate for your help.
i tried all but still no entry in toc.
any more idea?
thnx
oguzhan
November 1st, 2008 at 6:26 am
Hi,
In my table of contents I need the word ‘page’ before my page number,
and I would like that appear the number of page of list of figure in my table of contents, like this:
List of figures ……………… page 1
Chapter 1 ………………….. page 5
Chapter 2 ………………….. page 7
Is there any one can help me?
regards
joker
November 2nd, 2008 at 12:38 pm
Hi Joker,
Adding the word page before the page number can be achieved using the tocloft package:
\usepackage{tocloft} \renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep} \bfseries Page} \renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep} Page}See the tocloft documentation.
Concering your second question, please refer to my previous comments on this article, e.g. here.
Cheers,
Tom.
November 12th, 2008 at 8:03 pm
Hi!
How can you reduce the space before and after the title “Content” of the table of contents, i.e., the space between “Content” and the first line of contents in the table of contents?
How can you do the same for “List of Figures” and “List of Tables”
?
Thanks
November 12th, 2008 at 10:22 pm
Hi Fatima,
Here is a little trick how you can increase or decrease in your case the space between the title and your first entry:
\addtocontents{toc}{\vspace{-0.5in}}Use this command before your first entry, but after your \tableofcontents command. It manually adds an additional entry, which is space instead of text.
By using “lof”/”lot” instead of “toc”, you can add/remove space to the list-of-figures / list-of-tables.
Reference: tocloft-documentation
Cheers,
Tom.
November 23rd, 2008 at 7:48 pm
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
November 23rd, 2008 at 8:04 pm
i mean Tom
sorry
November 23rd, 2008 at 8:23 pm
i got it, just use multicol package .
November 24th, 2008 at 12:58 pm
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,
November 24th, 2008 at 7:30 pm
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??
December 3rd, 2008 at 5:09 pm
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.
December 4th, 2008 at 10:39 pm
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.
December 15th, 2008 at 5:31 am
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.
December 16th, 2008 at 9:59 pm
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.
December 17th, 2008 at 11:22 am
thanks tom.
i still cant get rid of the numbers though, i still got
Fig. 1 XXXXXX 5
Fig. 2 YYYYY 8
i want:
Fig. 1 XXXXXX
Fig. 2 YYYYY
i tried to read the fine tocloft manual a bit in the meantime.
\renewcommand{\cftdot}{} would also get rid of the dots… cant figure out a way to make the numbers disappear. may need to renewcommand listoffigures. will check back from time to time.
great blog!
January 2nd, 2009 at 11:47 pm
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.
March 6th, 2009 at 11:57 am
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.
June 20th, 2009 at 9:03 am
Hey Tom,
is there a way to reduce the vertical space between entries in the list of figures / list of tables?
Thank you!
Susann
May 2nd, 2010 at 3:58 pm
Hi Susann,
The tocloft package should solve your problem. Check out the documentation here.
Cheers,
Tom
October 7th, 2009 at 5:22 am
Hi,
I have a couple of figures in my appendix. How do I get rid of appendix figures listed in ‘List of Figures’.
May 2nd, 2010 at 3:40 pm
Please see my post on that topic:
http://texblog.wordpress.com/2010/05/02/excluding-items-from-list-of-figures-list-of-tables/
Cheers,
Tom
November 3rd, 2009 at 6:04 am
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?
May 2nd, 2010 at 3:38 pm
See my answer to Carlos question below.
Thanks,
Tom
March 30th, 2010 at 7:29 pm
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.
May 8th, 2010 at 8:22 pm
Try the minitoc package (26MB documentation!), which I wrote about some time ago:
https://texblog.wordpress.com/2008/09/15/create-small-tocslofslots-using-minitoc/
Best,
Tom.
April 16th, 2010 at 6:36 pm
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
May 2nd, 2010 at 2:38 pm
Please see my post on that topic:
Excluding items from list-of-figures / list-of-tables
Cheers,
Tom
April 20th, 2010 at 10:30 pm
Hi everyone!
How do I get my list of Figures to show a list like:
Figure 1. Blah Blah
Figure 2. Blah Blah
etc…
Please help me out here, it’s for my thesis.
May 2nd, 2010 at 2:08 pm
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.
November 24th, 2010 at 1:04 pm
Thanks Tom for your great site, I was looking everywhere for an answer to this. You are the hero of the day! x
June 17th, 2010 at 6:55 pm
Hi Tom,
I enjoyed and benefitted from many of your postings. In a article document class, I use figures, tables, supertabular, and some of them are in tabular and tabularx environment. My huge table defined by supertabular is in landscape orientation.
Now I want to caption all of them as Exhibits, placed after all the text and I want figures, tables, etc. to be in same sequence.
I have tried this:
\begin{document} \renewcommand{\figurename}{Exhibit} \renewcommand{\tablename}{Exhibit} %-------------------------------- %\newcounter{table}[figure] %\setcounter{table}{16} %------------------------------------- %\addtocounter{table}{\value{figure}} %---------------------------------------- \addtocounter{table}{16}Now: 1) The commented out lines do not serve my purpose, and I have to type in the exact numbers of figures as 16 in \addcounter. (I have placed 16 figures, and then my tables follow)
2) Still, the first table (large one, but in table environment and portrait) is numbered as Exhibit 17, and the next table is numbered as 19, 20, 21, 22….
Where did I slip?
Thanks,
SV
June 19th, 2010 at 11:04 am
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
June 19th, 2010 at 3:57 pm
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
June 21st, 2010 at 9:08 am
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
June 24th, 2010 at 9:16 am
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
December 20th, 2010 at 3:10 pm
Hi Javier,
Check out my comment on that topic
Tom.
July 20th, 2010 at 9:42 pm
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.
July 21st, 2010 at 9:35 pm
Hi Mary,
Your first question is easily answered:
\caption[Short list of tables caption text.]{Long table caption text.}Your second question is more difficult and I probably won’t be able to answer it to your satisfaction, since it depends on how flexible you are with your document. Basically, you have several possibilities, I could think of. You could change the margin of the page and squeeze the last entry on the same page as the others. Or you might think about changing the font size or spacing between lines of the list of tables/figures. I am sure there is a way to redistribute entries, but I wouldn’t know how to do it.
Cheers,
Tom
September 19th, 2010 at 6:08 am
Tom, you rule with LaTeX.
Greetings.
November 22nd, 2010 at 5:37 pm
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
December 20th, 2010 at 2:01 pm
Hi Sandeep,
The tocloft package can fix your spacing problem. Please check out the documentation at: http://mirror.switch.ch/ftp/mirror/tex/macros/latex/contrib/tocloft/tocloft.pdf
Thanks,
Tom
February 7th, 2011 at 10:41 am
Hi Tom, I am working on my masters thesis and just wanted to thank you for this very useful information!
Greetings
February 20th, 2011 at 5:32 pm
Hey Tom, nice work!!!
However i still got a question:
the figures in my bachelor thesis are numbered as follows: 1.1, 1.2, 1.3, 2.1, etc.
i also have an introduction with two figures in it.
unlike the other figures they are numbered 1, 2.
Now how could i change that to 0.1 and 0.2
thanks in advance
chris
February 25th, 2011 at 1:54 pm
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.
February 25th, 2011 at 2:31 pm
Works absolutely perfect!
tom, you’re a genious!
March 1st, 2011 at 12:57 pm
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!
March 1st, 2011 at 1:07 pm
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.
March 1st, 2011 at 1:56 pm
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!
September 24th, 2011 at 4:10 pm
Thank you so much for the existence of the site!! I have been looking for the answer for this problem since ever!
Thank you Ray for, even solving your problem alone, posting here the solution..Thank you so much!
Thank you Tom too. I’ve used many of your advices
*
March 19th, 2011 at 3:01 pm
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
March 19th, 2011 at 4:55 pm
Ok. I got it. \usepackage{caption} does the job.
\caption[]{Caption}
April 6th, 2011 at 1:42 pm
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!
April 6th, 2011 at 2:00 pm
Please include a minimal example in order to illustrate your problem. Thanks, Tom.
April 11th, 2011 at 8:21 am
[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?
April 18th, 2011 at 4:05 am
Hi Kosala,
Please give me a minimal example that I can copy into my editor and run. It should not contain any
includecommands, 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.
April 12th, 2011 at 4:38 pm
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
April 13th, 2011 at 5:35 am
Hi Amani,
Thanks for your comment. Please post a mini-example that illustrates your problem, so we can help solving it. Thanks, Tom.
April 16th, 2011 at 8:58 am
hi Tom
honestly its wonderful blog, and well kept by all/you.
I have two questions, and I put the code for clarity.
1.
When I refer to a subfigure as: Figure~\ref{fig1}, then what I get in the output is: Figure 1a. While I need to have Figure 1(a)?
\begin{figure} \centering \subfloat[fig1] { \includegraphics[width=0.45\textwidth]{fig1.pdf} \label{fig1} } \subfloat[fig2] { \includegraphics[width=0.45\textwidth]{fig2.pdf} \label{fig2} } \caption{FigureA} \label{FigureA} \end{figure}2.
As you can see, there are three data rows within each cell; I need to color the second and third data rows with bit lighter shades of gray, such that it does not include the first common column (e.g. row1), and the color should not cover the vertical lines getting in between the cells.
Further, how can the vertical lines and horizontal lines can be changed to some other style like dashed or dotted?
\begin{table}[!ht] \centering \begin{tabular}{c|c|c|c|c|c|c|c} \hline \multirow{2}{*}{Column1} & \multicolumn{7}{c} {Column2}\\ & 1 & 2 & 3 & 4 & 5 & 6 & 7\\ \hline\hline \multirow{3}{*}{row1} & 88 & 212 & 464 & 716 & 968 & 1220 & 1472 \\ & 0.14 & 0.655 & 3.229 & 6.022 & 9.095 & 11.949 & 14.696 \\ & 8 & 16 & 27 & 34 & 38 & 40 & 41 \\ \hline \multirow{3}{*}{row2} & 232 & 548 & 1184 & 1820 & 2456 & 3092 & 3728 \\ & 1.076 & 7.223 & 34.055 & 67.003 & 95.862 & 125.097 & 154.082 \\ & 10 & 13 & 17 & 19 & 19 & 19 & 19 \\ \hline \end{tabular} \caption{text} \label{t1} \end{table}Thanks in advance.
April 18th, 2011 at 2:52 pm
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.
April 20th, 2011 at 2:48 am
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
\figuretitlenameas “FIGURE” to make it appear in each entry of lof. However, when caption is long. The whole multi-line entry is left aligned, like thisFIGURE 1: AAAAAAAAAAA
AAAAA
So my question is how to make it aligned after the colon
FIGURE 1: AAAAAAAAAAA
AAAAA
Well, I try to use short and one-line captions but some have to be long…
Thanks in advance.
April 23rd, 2011 at 4:46 am
Hi Yallen,
Here is how you can solve your problem:
\usepackage{tocloft} \renewcommand{\cftfigpresnum}{FIGURE } \renewcommand{\cftfignumwidth}{6em}Tom.
May 2nd, 2011 at 5:18 am
Hi,
I’m working on my thesis. There is a strange problem I encountered. My headers are meant to display the chapter name. When there are upto 2 sections in any chapter, this header works fine. Whenever a 3rd section is inserted the header does not display the chapter name from that page onwards for the rest of the chapter. I’m quite new to latex and unable to figure out what is causing this. Any help would be greatly appreciated. This is the part of the template I’m using
\pagestyle{fancy} \renewcommand{\chaptermark}[1]{\markboth{#1}{}} \fancypagestyle{fancyplain}{ \fancyhf{} \addtolength{\headheight}{1.8pt} \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt} \fancyfoot[R]{\sffamily\bfseries \thepage/\pageref{fancy:frontend} } %%\fancyfoot[RO,LE] } \fancypagestyle{fancytext}{% \fancyhead{} % clear all header fields \addtolength{\headheight}{1.8pt} \fancyhead[R]{\nouppercase{\rightmark}} \fancyhead[R]{\nouppercase{\leftmark}} \fancyfoot{} % clear all footer fields \fancyfoot[R]{\sffamily\bfseries\thepage/\pageref{fancy:mainend}} %%t[LE,RO] \renewcommand{\headrulewidth}{0.4pt} \renewcommand{\footrulewidth}{0pt} } \fancypagestyle{fancychapter}{% the page with chapters in main \fancyhf{} \addtolength{\headheight}{1.8pt} \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt} \fancyfoot[R]{\sffamily\bfseries \thepage/\pageref{fancy:mainend} } \markboth{}{} } \renewcommand{\chaptername}{Chapter} \def\@makechapterhead#1{% For fancy chapters \vspace*{50\p@}% {\parindent \z@ \raggedright \normalfont \ifnum \c@secnumdepth >\m@ne \if@mainmatter \large\scshape \@chapapp \space\space \Huge\upshape\thechapter \par\nobreak \vskip 20\p@ \fi \fi \interlinepenalty\@M \flushleft\parbox{\textwidth}{\raggedleft \sffamily\Huge\bfseries #1 } \par\nobreak \vskip 15pt \hrule height 0.4pt \vskip 65\p@ %length from line to text } \thispagestyle{fancychapter}} \def\@makeschapterhead#1{% For plain chapters in mainmatter to the left \vspace*{50\p@}% {\parindent \z@ \raggedright \normalfont \ifnum \c@secnumdepth >\m@ne \if@mainmatter \ifnum \thechapter =0 %Style just for preface in mainmatter \Huge\upshape \phantom{1} \par\nobreak \vskip 20\p@ \interlinepenalty\@M \flushleft\parbox{\textwidth}{\raggedleft \sffamily\Huge\bfseries #1 } \thispagestyle{fancychapter} \else \sffamily\Huge\bfseries #1 \thispagestyle{fancychapter} %Nom Bio and * \fi \else \sffamily\huge\bfseries #1 \thispagestyle{fancyplain} % outside mainmatter \fi \fi \par\nobreak \vskip 15pt \hrule height 0.4pt \vskip 65\p@ } }and for including the chapters:
\mainmatter \pagestyle{fancytext} \cleardoublepage \phantomsection \input{file/chapter2}Thanks in advance!
May 6th, 2011 at 3:17 am
Can u please help me how can I add list of figure,list of table with page number in the contents?
like:
list of figures………I
List of table ………II
1. Introduction……….1
May 6th, 2011 at 2:41 pm
Hi Arnab,
You have to add them manually by using
\addcontentsline{toc}{chapter}{\listfigurename}just after the list of figures, list of tables command respectively (toc: table of contents).
If your lists take more than a single page, the page number will be wrong, but that should do the trick:
\cleardoublepage \addcontentsline{toc}{chapter}{\listfigurename} \listoffiguresTom
May 18th, 2011 at 9:39 pm
Hi, Tom. So happy to find this blog. I have two questions.
1) in my paper, i use head/footrule, which must be included on every page but title page. when i used
\usepackage{tocloft} \renewcommand{\cftfigfont}{Figure } \renewcommand{\cfttabfont}{Table }in preamble, i lost head/footruler on first 3 odd pages, which include toc, lof and lot. on 7th page i have first section, and from there on everything is just fine.
2)my figure captions can be quite long, so it takes more than one line to write them. this is what i get in that case
figure 1.2 texttexttexttexttexttexttexttexttexttext
texttexttext………………………………n
and this is what i want
figure 1.2 texttexttexttexttexttexttexttexttexttext
texttexttext………………………..n
Thanks in advance!
Best regards
May 28th, 2011 at 8:13 am
Hi Hrvoje,
Sorry for the late response and thanks for your comment. To answer your questions:
1) You can force header and footer with fancyhdr using the
addtocontentscommand. 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.
June 4th, 2011 at 9:14 pm
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.
June 5th, 2011 at 5:27 pm
Hi Magya,
Try specifying the separator yourself using the
tocloftpackage:\usepackage{tocloft} \renewcommand{\cftofaftersnum}{:}If that doesn’t help, please send me a minimal code example that illustrates the issue.
Thanks, Tom.
June 7th, 2011 at 5:46 pm
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
June 8th, 2011 at 3:49 pm
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
tocloftpackage, but you’ll have to load it with thesubfigureoption:\usepackage[subfigure]{tocloft}It shouldn’t matter in what order you load the packages.
Good luck! Tom.
June 10th, 2011 at 4:04 am
Hi Tom,
Thanks for the reply.
The problem is because i am defining
\renewcommand{\thefigure}{\arabic{chapter}.\arabic{figure}}and this was creating an error
I did huge trial and error and modified the following line in amsbook.cls
\def\l@figure{\@tocline{0}{3pt plus2pt}{0pt}{2.5pc}{}}which was initially
\def\l@figure{\@tocline{0}{3pt plus2pt}{0pt}{1.5pc}{}}I don’t know why but it solved my problem, also i am not able to use
\usepackage[subfigure]{tocloft}It again gives me a lot of error. But i will get back to you later right now somehow its working.
I really appreciate your help. This is a very useful blog, I learned a lot.
Thanks again,
Regards,
Ankit
June 23rd, 2011 at 5:47 am
hi Tom,
You have helped so many. I am writing a thesis and the requirement for the \tableofcontents is that when the table of contents spans multiple pages (which mine does), I must find a way to put a title on each new page that says “TABLE OF CONTENTS (continued)”. By default, “TABLE OF CONTENTS” is only printed on the starting page, and I dont know how to change the name of the title on pages after the first page”
I have already done:
\renewcommand{\contentsname}{\begin{center}TABLE OF CONTENTS\end{center}}
any advice on how to do this?
July 1st, 2011 at 5:06 am
Hello!
Thanks for that question!
I attached a piece of code. Just save it to a Latex style file (e.g. toccontd.sty) and copy it into your document directory. Finally, add
\usepackage{toccontd}to your preamble. Feel free to change it according to your needs. It won’t be compatible with any other packages modifying the table of contents or at least I didn’t check.Hope it helps!
Cheers, Tom.
% Write title \def\ps@continued{ \def\@oddhead{\headmark} \let\@evenhead\@oddhead} % Define table of contents continued title \def\tableofcontents{ \clearpage \def\headmark{\vbox{ \hbox to \textwidth{\bfseries\Large\hfil TABLE OF CONTENTS (Continued) \hfil}}} \pagestyle{continued} \table@of@cont \newpage} % Define tableofcontents \def\table@of@cont{% \thispagestyle{plain} \@makeschapterhead{TABLE OF CONTENTS} \@starttoc{toc}}October 21st, 2011 at 10:33 pm
Hi Tom,
Thanks for writing this.
When I try it, I get the error:
\table@of@cont …tyle {plain} \@makeschapterhead
{TABLE OF CONTENTS} \@star…
l.104 \tableofcontents
October 26th, 2011 at 9:48 am
Hi there! Please provide a minimal example so I can reproduce the error. Thanks, Tom.
July 8th, 2011 at 8:36 am
hello Tom
I am writing a paper using
\documentclass[journal]{IEEEtran}
by default, it makes the contents inside \begin{abstract}..\end{abstract} bold, which I dont want. There is a IEEEtran.cls file which perhaps is making it bold. I tried to comment out a few lines which I thought are making the abstract as bold, but it did not work. Perhaps I need to do some more steps, before it would be visible in my document. Could you please guide how I can get rid of this bold and make it instead italic?
I am using WinEdt/Miktex/Latex.
Thanks in advance.
best regards
Flaces
July 8th, 2011 at 10:01 am
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
\bfserieson line 3711 which makes the abstract bold. Replace it with\itshape.That worked for me. Cheers, Tom.
July 11th, 2011 at 8:48 am
Thanks Tom; it works when I put the IEEEtran.cls in my document directory. I guess it would be possible to make it permanent by doing the same step in
C:\Program Files\MiKTeX 2.9\tex\latex\ieeetran\IEEEtran.cls
I tried, but it did not work; I did Refresh FNDB in MikTex, but still it does not work. Am I missing some step?
thanks in advance.
regards
Flaces
July 12th, 2011 at 5:00 am
Hi Flaces,
Unfortunately, I am not very familiar with MiKTeX and it’s directory structure. This manual might provide some help…
Cheers, Tom.
July 11th, 2011 at 3:33 pm
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.
July 25th, 2011 at 4:47 am
Hi Marianie,
Please have a look at the LaTeX / Page Layout on Wikibooks. If this does not help, you may want to send a minimal example to help me understand your problem.
Thanks, Tom.
July 21st, 2011 at 5:17 am
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
July 27th, 2011 at 8:53 am
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.
August 1st, 2011 at 8:11 am
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?
August 2nd, 2011 at 8:45 am
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}} \listoftablesCheers, Tom.
July 27th, 2011 at 9:05 am
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
July 27th, 2011 at 9:36 am
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
tabularxpackage or see this table summary document, which has nice examples.Best, Tom.
July 29th, 2011 at 6:17 pm
Hello Tom
thanks.
your code runs fine, but the providing widths manually is bit cumbersome, as I have too many tables. Even in my case, the text/maths is crowded to the top/bottom horizontal lines, and looks not ok.
Seems tabularx is a way to go, as apparent from the tables given in the link, but somehow the code gives errors in my IEEEtran document. I am interested to generate Table.14 in my doc, which hopefully will fulfill my need. So could you please sent a code of a single row with cells aligned center hori/vert. both.
thanks in advance.
July 28th, 2011 at 7:27 pm
Hi Tom,
When I try to include a list of figures, I get an error “bad math environment delimiter”.
But, there is no math environment in my captions. I already tried to rename all caption with simple numbers, but I still got the error.
The point is that everything was okay an hour before, and I really do not know what I might have changed.
I use this header:
\documentclass[titlepage,a4paper,11pt,headsepline,footsepline]{article} \usepackage[utf8x]{inputenc} \usepackage{scrpage2} \usepackage{graphicx} \usepackage{booktabs} \usepackage{nomencl} \usepackage{booktabs} \usepackage{multirow} \usepackage{textfit} \usepackage{hyphenat} \usepackage{float} \usepackage{rotfloat} \usepackage{floatflt} \usepackage{rotating} \usepackage{color} \usepackage[footnotesize]{caption} \usepackage{url} \urlstyle{tt} \usepackage{multicol}Do you have any idea what the problem might be?
Thanks, Isa
July 28th, 2011 at 8:07 pm
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…
July 29th, 2011 at 8:06 am
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.
August 20th, 2011 at 6:14 pm
hello Tom
I have a problem with Table numbering; there is one main table, and two subtables; when I refer to the sub tables, it gives number IIa, IIb, while I expect Ia, Ib.
If I change caption=true, then the problem is solved but the figure caption is no more footnotesize, which is not desired.
Please help; thanks in advance.
regards
Flaces
——
\documentclass[conference]{IEEEtran} \usepackage{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}August 23rd, 2011 at 3:25 pm
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.
August 25th, 2011 at 2:28 am
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
September 8th, 2011 at 11:17 pm
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
September 8th, 2011 at 11:34 pm
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.
September 9th, 2011 at 3:36 am
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
makeindexand 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:You may also want to have a look at the first few pages of the package documentation.
Cheers, Tom
September 13th, 2011 at 10:58 pm
so helpful! you can’t imagine for how long i was looking for it! a grand thank you!
September 15th, 2011 at 8:42 am
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
Thanks in advance,
Fred Durao
September 15th, 2011 at 9:18 am
There you go:
\newlength{\mylen} \renewcommand*\cftfigpresnum{Figure~} \settowidth{\mylen}{\cftfigpresnum\cftfigaftersnum} \addtolength{\cftfignumwidth}{\mylen}Found here
Cheers, Tom.
September 15th, 2011 at 9:27 am
Many Thanks Tom,
And I have to confess that I ve been to “here” few minutes ago.
)
Have a nice day.
Fred
September 19th, 2011 at 6:27 pm
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
September 26th, 2011 at 4:23 pm
Jacob, I answered this question before. Hope it works for you as well. Cheers, Tom.
October 6th, 2011 at 1:31 am
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
October 10th, 2011 at 4:53 am
Hi Alan,
Usually, I would expect LaTeX to automatically add line-breaks. If you are using the
hyperrefpackage, 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.
October 9th, 2011 at 4:07 pm
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
October 10th, 2011 at 4:37 am
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
tocloftpackage to do that. In case you are using thehyperrefpackage, 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.
October 10th, 2011 at 9:44 pm
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
October 11th, 2011 at 4:31 am
Hi Hui,
I suggest you use
longtablerather thandeluxetable. 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.
October 12th, 2011 at 1:01 am
Hi Tom,
I have solved the problem by using ‘longtable’, instead of ‘deluxetable’. Thanks very much for your help!
Best wishes!
Hui
October 12th, 2011 at 2:24 pm
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
October 13th, 2011 at 9:03 am
Hi Matt,
The
subfigandsubfigureare two different packages. Thesubfigurepackage was replaced by the more recentsubfigpackage. The floating environment is calledsubfloatfor both, figures and tables. See my post on that topic.I hope that solves your issue. Best, Tom.
October 22nd, 2011 at 7:06 am
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
October 24th, 2011 at 2:37 am
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.
October 24th, 2011 at 2:58 am
Thanks so much! You’re a life saver
Cheers,
Sper
October 25th, 2011 at 7:54 pm
Hi Tom!
Thanks a lot! I managed to insert the table of contents, list of figures and of tables reading your comments.
I have just a small question: for the figures and tables I have a quite long explanation of what they are (3-4 rows), and this is inserted in the caption section. When I run the list of tables and figures, I obtain all the explanation inserted in the caption, and it is too long to be shown in the section list of figures/tables. Therefore my question is: is it possible to have 2 titles for the figures/tables so that I can write the short title in one caption and the long in another one?
Thanks for your help!
October 26th, 2011 at 9:35 am
Hi Didi!
Use the optional parameter of
caption.\caption[short caption for list of figures/tables]{long caption text for figure/table}Best, Tom.
October 25th, 2011 at 11:05 pm
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 ?
October 26th, 2011 at 10:20 am
One way I can think of is using the command
addcontentsline{}{}{}. You could for example create a\mychaptercommand 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
\mychapterinstead of\chapter. It’s still somewhat manual, but it does the trick.Best, Tom.
October 26th, 2011 at 12:12 pm
Yay ! thanks that’s perfect Tom
You rock !
October 29th, 2011 at 3:31 am
Many thanks for this useful write up I had indeed been facing some issues but thus was very helpful indeed
November 10th, 2011 at 1:05 am
I didn’t make any questions but I’d like to thank tou Tom! Your tips helped me a lot!!
November 15th, 2011 at 5:26 pm
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
November 16th, 2011 at 9:30 am
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}November 16th, 2011 at 3:19 pm
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…
November 18th, 2011 at 3:11 am
Hello!
Which
documentclassare 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 thetwosideoption. Have a look at this Wikibooks entry for more information ondocumentclassoptions. You can change headers/footers in different parts of your document using the\pagestylecommand.Hope this helps,
Tom
November 19th, 2011 at 2:23 pm
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 !!
November 17th, 2011 at 7:04 am
Hi Tom,
Thanks so much for your posts. I’ve followed your answer to one of the previous questions in relation to list of figures and list of tables, but ended up with a new problem that I am not sure how to solve…
I have a template that uses the following code to generate the LOF and LOT:
\def\afterpreface{\newpage {\setlength{\parskip}{0.2\baselineskip} \tableofcontents \iflistnomenclatureatfront \listnomenclature \fi \iffigurespage \listoffigures \addcontentsline{toc}{chapter}{\listfigurename} \fi \iftablespage \listoftables \addcontentsline{toc}{chapter}{\listtablename} \fi } \cleardoublepage \pagenumbering{arabic} \pagestyle{fancy} %{headings} }I want to add Figure and Table in the LOF and LOT respectively (as in Figure 2.2 or Table 2.2 etc). I added your suggestion
\usepackage{tocloft}
\renewcommand{\cftfigfont}{Figure }
\renewcommand{\cfttabfont}{Table }[\sourcecode]
in the preamble. This solves my problem but the LOF and LOT do not appear on separate pages. I want them to start on separate pages.
How do I incorporate this into the above code or how to I modify it to include Figure and Table in the LOF and LOT and still have them start on new pages?
Thank you in advance,
Mike
November 20th, 2011 at 4:43 am
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.:
Best, Tom.
November 17th, 2011 at 5:32 pm
Hi Tom!
Thanks so much for your help!
Another small questions: I would like to create subfigures, 4 small graphs on one page, do you think this programming is correct?
\begin{figure}[h] \centering% \subfigure[{a1.pdf}\label{A1}]% {\includegraphics{a1.pdf}}\qquad\qquad \subfigure[{a2.pdf}\label{A1}]% {\includegraphics{a2.pdf}}\qquad\qquad \subfigure[{a3.pdf}\label{A1}]% {\includegraphics{a3.pdf}}\qquad\qquad \subfigure[{a4.pdf}\label{A1}]% {\includegraphics{a4.pdf}}\qquad\qquad \caption{a1.} \end{figure}I believe there is something wrong as I receive an error message.
Thanks a lot!
Dijana
November 18th, 2011 at 2:52 am
Hello Dijana,
Your code is perfectly fine. Do you load the necessary packages,
subfigureandgraphicx, in your preamble?\usepackage{graphicx, subfigure}You may also want to consider using the more recent subfig package which replaces the subfigure package.
Tom.
November 21st, 2011 at 4:22 am
Hi Tom,
Thanks for your tip, its worked perfectly when I modified the code with addition of \newpage..
\listnomenclature \fi \iffigurespage \newpage \listoffigures \addcontentsline{toc}{chapter}{\listfigurename} \fi \iftablespage \newpage \listoftables \addcontentsline{toc}{chapter}{\listtablename} \fiThank you!
Cheers
Mike
November 21st, 2011 at 4:30 pm
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
November 22nd, 2011 at 3:07 am
Hi Vagner,
There does not seem to be any conflict between the
tocloftandfancyhdrpackages.You can try this:
\fancypagestyle{plain}{% \fancyhf{} % Custom fancy head/foot, e.g.: \fancyfoot[R]{\thepage} }If that doesn’t help, please post a minimal example that illustrates the problem.
November 21st, 2011 at 7:28 pm
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.
November 22nd, 2011 at 3:32 am
Hi Shah,
Thanks for your questions. Here is what I think:
1. Easiest is to add them manually, just after your
\listoffigurescall 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
appendixpackage (\begin{appendix}...\end{appendix}) or provide a minimal example for me to reproduce your problem.Hope it helps. Best, Tom.
November 22nd, 2011 at 12:50 am
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
.
November 22nd, 2011 at 2:52 am
Hi there,
Have a look at this post that shows how you can define your own “List of Something” using the
tocloftpackage. It’s straight forward.Best, Tom.
November 25th, 2011 at 12:12 am
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
\refThanks for your hints
November 25th, 2011 at 6:50 am
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.
December 3rd, 2011 at 6:47 pm
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}\dominitocbefore\tableofcontentsand I also used
\adjustmtcat the end of all\chapter*and\section*What Im doing wrong?
December 3rd, 2011 at 10:21 pm
Hi,
I appreciate all your help but I think that my problem is solved.
I was playing around with
\adjustmtcand 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?
December 5th, 2011 at 7:03 am
Hi elfo,
\renewcommand{\mtctitle}{}\mtcsetrules{minitoc}{off}minitocpackage 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.
December 7th, 2011 at 2:53 am
Thank you very much
December 9th, 2011 at 4:33 am
Tom,
How do I modify your solution for adding ‘Page’ before the page numbers in the TOC to extend to the LOF and LOT?
%\usepackage{tocloft} %\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep} \bfseries Page} %\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep} Page}December 12th, 2011 at 2:48 pm
Hi there,
Simply re-new the same for figure and table by replacing
cftsecleaderwithcftfigleaderandcfttableader:\renewcommand{\cftfigleader}{ \cftdotfill{\cftdotsep} Page} \renewcommand{\cfttableader}{ \cftdotfill{\cftdotsep} Page}Best, Tom.
December 9th, 2011 at 6:00 pm
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.
December 12th, 2011 at 3:08 pm
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
notoccitepackage.\usepackage{notoccite} \bibliographystyle{unsrt}Best, Tom.
December 12th, 2011 at 1:17 pm
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
December 12th, 2011 at 2:08 pm
Hi Shah,
Use
\chapter{}or\section{}depending on whether you are writing areportorarticle. Another way would be to define environments by redefiningabstract, e.g.:\newenvironment{acknow}{% \renewcommand*{\abstractname}{Acknowledgments} \abstract}{% \endabstract} ... \begin{acknow} ... \end{acknow}Cheers, Tom.
December 12th, 2011 at 11:27 pm
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
December 13th, 2011 at 9:19 am
Hi Shah,
You can use the command
\markboth{left head}{right head}. Also, you’ll have to inverse the order of\chapterand\addcontentslineto get the page number right.Here is a minimal example.
\documentclass[12pt]{report} \usepackage[english]{babel} \usepackage{fancyhdr, blindtext} \pagestyle{fancy} \begin{document} \tableofcontents \chapter{First chapter} \Blindtext \chapter*{Acknowledgments} \addcontentsline{toc}{chapter}{Acknowledgments} \markboth{Acknowledgements}{} \Blindtext \end{document}Please provide a minimal example next time, it will save us both time and I can help you on the first attempt. Also, you may even solve your problem while creating it.
Thanks, Tom.
December 20th, 2011 at 3:46 pm
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
December 23rd, 2011 at 10:44 am
Dear Rosa
Which
documentclassdo 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.
January 5th, 2012 at 12:28 pm
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
January 18th, 2012 at 6:50 am
Hi Rosa,
I’m glad my previous solution worked. Sorry for not getting back to you earlier. Here is my proposal for your question. Define a new command that creates a chapter and adds itself to the lists. The code below will add “Chapter 1″ to the list of figures / tables. I included both, one example with page number (lof) and the other without (lot). You can modify it, depending on your preference.
\newcommand{\mychapter}[1]{ \chapter{#1} \addtocontents{lot}{\contentsline{chapter}{Chapter \thechapter \vspace{10pt}}{}} \addcontentsline{lof}{chapter}{Chapter \thechapter \vspace{10pt}} }Best, Tom
January 3rd, 2012 at 3:11 pm
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}January 3rd, 2012 at 3:16 pm
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.
January 3rd, 2012 at 3:44 pm
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}}January 4th, 2012 at 9:47 am
Thanks for posting this. Appreciate it. Best, Tom.
January 21st, 2012 at 9:35 pm
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.
January 23rd, 2012 at 5:00 pm
Hi Steve, thanks for your comment. I’m happy that my site was helpful to you. Best, Tom.
February 3rd, 2012 at 6:24 pm
Tom, your blog is very helpful. Thank you very much.
Apologizes for my bad text and if my question have already been answered before, but I want ask to you how I can solve a small trouble.
When I use the command \listoffigures, my big captions crosses the end of page and not continues in the next line below. An only possible solution is using the \caption[]{} command?
Thanks
February 6th, 2012 at 1:53 pm
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.
February 8th, 2012 at 2:46 am
Hi Tom, great info. I have a problem with the list of figure of my thesis document, my captions are a little too long so that when they appear in the list there is a lot of text. How can I do in order to have just a ‘title’ of the figure in the list instead all the caption?
Thanks in advance
February 8th, 2012 at 3:37 pm
Hi Anna,
Just use the optional argument of caption:
\caption[Short lof text]{Long caption text.}Best, Tom.
February 8th, 2012 at 1:53 pm
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
February 8th, 2012 at 4:54 pm
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.
February 9th, 2012 at 4:06 pm
Hi Tom,
This page didn’t help me to fix that problem. But, looking in this page (http://en.wikibooks.org/wiki/LaTeX/Hyperlinks#Hyperref) I found the solution. When I use \usepackage[breaklinks]{hyperref} in preamble, the problem vanishes.
Thanks again.
February 9th, 2012 at 4:27 pm
Hey Frederico, I’m glad you figured out how to solve your problem. Thanks for posting the solution to your problem and good luck with your document. Tom.
February 10th, 2012 at 4:13 pm
This is a great blog.
I have a question about my TOC, LOT and LOF.
My TOC is something like
List of Table……………..i
List of Figure…………….ii
Abstract
Chapter
1. Something……….
1.1. Something…..
2. Something….
2.1. Something….
How can I remove the word “Chapter” in the TOC?
My LOT and LOF is something like
1.1.Something…………………….
1.2.Something………………………..
2.1. Something…………………………
2.2.Something………………………….
How can I remove the double space between 1.2 and 2.2 ?
In addition, there is no page number in my LOT and LOF page even I am using
\addtocontents{toc}{\protect\thispagestyle{fancy}}I also would like to have the identical vertical space from the top of the page to the heading of Table of Content, List of Table, List of Figure, Abstract, Chapter 1, etc and indentical vertical space from these headings to the text body.
Could anyone please help me with that.
February 13th, 2012 at 2:50 pm
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
abstractbefore thetableofcontents, so it generally doesn’t appear in the list. Do you use:\begin{abstract}...\end{abstract}in your code? That may also solve the issue with the word chapter.
Which page number are you referring to, the page number of the figures or the page number of the list-of-figures?
To remove the white space between chapters in the list-of-figures/tables, try the following code. It redefines the chapter and adds a negative vertical space, removing 10pts added to lof/lot after every chapter (see here)
\makeatletter% \newcommand{\saved@chapter}{} \let\saved@chapter\chapter \renewcommand{\chapter}{% \@ifstar {\saved@chapter*}{\@dblarg\my@chapter}% } \newcommand*{\my@chapter}[2][]{% \saved@chapter[#1]{#2}% \addtocontents{lot}{\vspace*{-10pt}} \addtocontents{lof}{\vspace*{-10pt}} } \makeatother%Concerning the spacing, here is a nice Q&A that explains how to change space before and after chapters. For the toc/lof/lot, I suggest the tocloft package.
Best,
Tom.
February 13th, 2012 at 3:39 pm
Hi Tom,
Thanks very much for your reply.
Regearding the page number: Right now, on LOT and LOF pages, the page numbers are blank. I want them to show up.
Regarding the TOC: I want the word “Chapter” in TOC to be removed.
Please see blow for my minimal example.
Thanks
D
[...]Code removed by Tom.[...]
February 13th, 2012 at 3:57 pm
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.
February 11th, 2012 at 5:24 am
Hi Tom,
I have few questions if you could please answer them with your expertise.
a. The chapter heading in the toc is touching the page number in the right hand side of the page. How can I make the heading in two lines when it is long enough to touch the page number in the right?
b. I am able to manage the double spacing between the chapter heading, section heading and subsection heading but unfortunately, not able to make a double spacing between a sub-sub-section in the toc. How can I get a double spacing for all in toc?
c. The captions of the figures are italics in my document. The captions also has a citation for example: Figure 2.1 Figure Caption [2] (but all of these are italic). I want the entire caption to be italic except the citation. How can I get the citation a normal text with caption italic?
Thank you for wonderful support the latex learners like me.
Neil
February 13th, 2012 at 3:45 pm
Hi Neil,
hyperrefpackage, which is the more likely cause. Use the following option to fix it:\usepackage[breaklinks=true]{hyperref}reportdocument class, I only get white spaces between chapter entries. Can you please provide a minimal example that illustrates white spaces forsection, etc.\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.
February 15th, 2012 at 9:17 pm
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.
February 16th, 2012 at 6:03 am
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.
February 16th, 2012 at 7:03 am
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} \makeatotherHad 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.
February 16th, 2012 at 7:53 am
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.
February 16th, 2012 at 9:34 am
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.
February 18th, 2012 at 5:46 am
Hey Nam,
I can’t remember if you are loading the
subfigureorsubfigpackage. If so, please try loading thetocloftpackage with the following option:\usepackage[subfigure]{tocloft}Let me know if that helped.
Best, Tom.
February 20th, 2012 at 2:18 pm
Hi Tom,
I am writing an article and need to submit an appendix online (separate from the main manuscript). Figures have to be labelled Fig. A1, Fig. A2 and so forth, but when I run the script I get these labels: Fig A1, Fig. B2. Here is my script:
\documentclass[12pt]{article} % here are the packages I use \usepackage{amssymb,amsmath,gensymb, supertabular, booktabs, subfigure, caption, everysel, keyval, ragged2e, setspace} % new counter to control the numbering in the figure \newcounter{subf} % making sure that the first numbering is alphabetical and the second is arabic numbering \renewcommand{\thefigure}{\Alph{figure}\arabic{subf}} \begin{document} % starting the counter for the first figure \setcounter{figure}{1} \setcounter{subf}{1} \begin{figure} \end{figure} % starting the second figure % keeping the alphabetical label constant (e.g. A) \addtocounter{figure}{-1} % adding one to the numerical subf counter \addtocounter{subf}{1} \begin{figure} \end{figure} \end{document}Any ideas of why the numerical counter is constant (when it should not be), and the alphabetical counter isn’t constant (when it should be)?
Thanks
Allan
February 20th, 2012 at 2:21 pm
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.
February 20th, 2012 at 2:30 pm
Hi Tom,
Yes, that is certainly a good idea. Have no idea why that option slipped my mind…
As always, thanks.
Allan
February 20th, 2012 at 2:31 pm
Glad I could help. Best, Tom.
March 9th, 2012 at 8:08 pm
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?
March 12th, 2012 at 10:34 am
Hi Dominic,
Thanks for your comment. I created a minimal example and you seem to be right, I had the same problem with the
capoption of thectablepackage. I’ll contact the author. In the meantime, you may want to use thecaptionpackage 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.
March 13th, 2012 at 12:09 am
Just to let you know, as soon as I used the caption package the problem with the cap option of the ctable package was solved.
THK!
March 13th, 2012 at 3:12 am
You are right, thanks for the update! Tom.
March 21st, 2012 at 3:44 am
I have a question about list of figures. In the dissertation style description, it says “List of figures: If an entry takes up more than one line, break up the entry about three-fourths of the way across the page and place the rest of it on a second line, single spacing the two lines. Double-space between entries. ” How can I do that for list of figures. I don`t have to change the captions under the figures. I have to change the captions in the list of figures. Thanks
March 24th, 2012 at 6:35 am
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.
April 3rd, 2012 at 9:35 am
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.
April 3rd, 2012 at 1:04 pm
Hi Daniel,
Thanks for your question. Please send a minimal example for me to reproduce the issue.
Thanks, Tom.
April 21st, 2012 at 8:21 am
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.
April 22nd, 2012 at 8:11 am
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.
May 24th, 2012 at 3:57 pm
Hi Tom,
I am using a \documentclass[12pt]{report} for my thesis along with \listoftables and \listoffigures to generate the LOT and LOF.
The output is like:
FIGURE 1.1: This is the first figure in my thesis with heading more
than two lines. 3
FIGURE 1.2: This is the second figure in my thesis with heading more
than two lines. 5
But I want this to look like:
FIGURE 1.1: This is the first figure in my thesis with heading more 3
than two lines.
FIGURE 1.2: This is the second figure in my thesis with heading more 5
than two lines.
Note: Where 3 and 5 are the page numbers.
The thesis guideline is that the page numbers has to be on the right end of the first line of the figure headings and table headings.
Could you please help me to get this?
Thank you in advance.
Neil.
May 25th, 2012 at 4:18 am
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.
May 25th, 2012 at 1:47 pm
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
May 27th, 2012 at 3:33 am
Hi Neil,
Please read my answer to a previous, similar question.
Best, Tom.
May 27th, 2012 at 1:00 pm
Hi Tom,
Thank you. Problem solved.
Neil
May 27th, 2012 at 1:21 pm
Glad you managed to solve your problem. Best, Tom.
May 29th, 2012 at 12:10 am
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
May 29th, 2012 at 6:39 am
Hi Jimena,
The tocloft package provides a lot of flexibility with the toc/lof/lot formatting. Use the following commands to make the chapter headings in the TOC
normalfont.\documentclass[11pt]{book} \usepackage{tocloft} \renewcommand{\cftchapfont}{} \renewcommand{\cftchappagefont}{\normalfont} \begin{document} \tableofcontents \addcontentsline{toc}{chapter}{List of Figures} \listoffigures \chapter{First} \section{First} \begin{figure}[ht] \centering \rule{4cm}{3cm} \caption{default} \label{default} \end{figure} \end{document}Also, see this TeX FAQ on how to change section heading style.
Best, Tom.
September 2nd, 2012 at 1:02 am
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
September 2nd, 2012 at 4:01 am
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}September 2nd, 2012 at 4:46 pm
Wow, I didn’t expect such a fast and simple solution…guess I need to learn more about LaTeX.
Thanks for the quick response
Sofía.
September 2nd, 2012 at 4:58 pm
No worries
Tom.
October 13th, 2012 at 1:50 pm
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
Thanks in advance.
October 13th, 2012 at 5:12 pm
Hi! I suggest you give the
textgreekpackage a try. See my post for more details.Cheers, Tom.
October 14th, 2012 at 12:12 am
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?
October 14th, 2012 at 5:30 am
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.
October 14th, 2012 at 7:40 am
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.
October 14th, 2012 at 8:19 am
Ohh, I see,
straighttheta, along with a few others, is implemented in the textgreek package.Your code seems ok.
For normal text in math mode use:
\textrm{}For bold use:
\textbf{}October 14th, 2012 at 3:10 pm
Thanks Tom. It works fine now.
November 2nd, 2012 at 3:20 am
I have a problem with \ listoffigures when working with figures use the extension eps and the command \ listoffigures dosen’t work
November 12th, 2012 at 1:23 am
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.
November 12th, 2012 at 2:34 pm
Thanks tom
November 29th, 2012 at 12:12 pm
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?
November 29th, 2012 at 12:21 pm
To clarify the above question. I would like the word “without” has start under the letter A, ie w stand under A.
December 3rd, 2012 at 4:30 pm
Hi and thanks for your question.
I suggest using the
cftfigpresnumcommand instead to add the word “Figure” in front of the number. The rest is nicely documented in the tocloft package documentation.\documentclass[11pt]{article} \usepackage{tocloft, blindtext} \renewcommand{\cftfigpresnum}{Figure } \newlength{\mylen} \settowidth{\mylen}{\bfseries\cftfigpresnum\cftfigaftersnum} \addtolength{\cftfignumwidth}{\mylen} \begin{document} \listoffigures \begin{figure}[ht] \centering \rule{4cm}{3cm} \caption{\blindtext} \label{default} \end{figure} \end{document}November 29th, 2012 at 9:39 pm
I have a problem with \minilof
I am making a list of figure at the end of every chapters. In my list of figure the page number is wrong. Figure 1.1 is on page 43 and in the list of figure the figure page number is 45.
How can I fix this problem. Could I manually give my figure their page number ?
\minilof \begin{figure}\addcontentsline{toc}{section}{Figures} \hspace{-1cm} \includegraphics[width=19cm,height=18cm,angle=90]{geol.eps} \caption[\protect\vspace{0ex}{Simplified geological map of the Sudbury region and the surrounding area. In the lower left square is a map of Canada showing the location of the Sudbury region. See Figure 2 for details on the geology in the Sudbury area. The red star shows the location of SNOLAB.}]{Figure 1.1} \end{figure} \clearpage \begin{figure} \hspace{-1cm} \includegraphics[width=17cm,height=17cm]{geolzoom.eps} \caption[Detailed geological map of the Sudbury region.]{Figure 1.2} \end{figure} \clearpageThank you
December 8th, 2012 at 5:53 am
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}December 4th, 2012 at 12:42 pm
Hello tom thank you for your valuable help.
You are fantastic.
December 5th, 2012 at 3:37 am
Thanks! You are welcome. Tom.
December 4th, 2012 at 3:58 pm
Tom, in the previous example how do I decrease the space between the word and the list of figures Figure?
December 8th, 2012 at 6:51 am
Hi!
Just play with the parameter
\mylen. Try5emfor example:\settowidth{\mylen}{5em}Cheers, Tom.
December 11th, 2012 at 12:17 am
Thank you Tom
December 5th, 2012 at 10:19 am
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
December 8th, 2012 at 7:07 am
Hi Whotee,
Thanks for your comment. I suggest you define your own
list of ...for protocol and functions. I wrote an article on that topic some time ago.I’m only beginning to learn TikZ, but I will definitely try to help you if you post a question here. The best resources for TikZ are TeXample (examples) and tex.SX (support).
Hope this helps,
Tom.
December 10th, 2012 at 9:28 am
hi Tom, thanks.
I have a question on Tikz arrow head: how to make stealth type arrow head bigger without drawing a thicker line, i.e. how to control arrow head size independently.
kind regards
Whotee
December 10th, 2012 at 9:42 am
Hi Whotee,
This discussion should help you answer the question.
Best, Tom.
December 8th, 2012 at 6:30 pm
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} \tableofcontentsWell, I thank your help.
December 9th, 2012 at 6:13 am
Hi Daniel,
This should work.
Best, Tom.
\documentclass[12pt]{report} \usepackage{blindtext, pgffor} \pagestyle{empty} \begin{document} \addtocontents{toc}{\protect\thispagestyle{empty}} \tableofcontents \addtocontents{lof}{\protect\thispagestyle{empty}} \listoffigures \clearpage \pagestyle{plain} \chapter{Dummy chapter} \foreach \n in {0,...,30}{ \begin{figure}[ht] \begin{center} \rule{\textwidth}{0.75\textwidth} \caption{default} \label{fig:\n} \end{center} \end{figure} \Blindtext } \end{document}December 9th, 2012 at 7:27 pm
Hi,
I’m writing my thesis using LED and the scrartcl documentclass. However, when including the \listoffigures and/or the \listoftables command I receive an error message saying
Package etoolbox Error! Boolean ‘\ifciterequest’ undefined.
1.1 \boolfalse {citerequest}
\boolfalse {citetracker} \boolfalse {pagetracker}
Does anybody have an idea about how to solve this?
Thanks in advance!
Regards
Jonas
December 10th, 2012 at 2:41 pm
Hi Jonas,
I would need to see some code to be able to help. Please provide a minimal working example.
Do you have the latest version of etoolbox and biblatex?
Thanks, Tom.
December 10th, 2012 at 3:31 pm
Hi Tom, thanks for your quick answer.
As for my biblatex and etoolbox, I have no idea about the current version I’m using. will check that immediately
my header and some lines of code as a minimum example.
\documentclass[fleqn, 12pt, listof=totoc]{scrartcl} \usepackage{pslatex} \renewcommand{\baselinestretch}{1.5} \usepackage{geometry} \geometry{a4paper, top=30mm, left=35mm, right=25mm, bottom=25mm, headsep=0mm, footskip=10mm} \usepackage{fancyhdr} \usepackage{booktabs} \usepackage{multirow} \usepackage[ngerman]{babel} \usepackage[ansinew]{inputenc} \usepackage[babel,german=quotes]{csquotes} \usepackage{dsfont} \usepackage{color} \usepackage{amsthm} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{enumitem} \usepackage{ulem} \usepackage{amssymb} \usepackage{mdwlist} \usepackage{units} \usepackage{pxfonts} \usepackage[T1]{fontenc} \usepackage{tabularx} \usepackage{tocloft} \usepackage{graphicx} \begin{document} \listoffigures \newpage \section{s1} \subsection{s2} This is what I want to show in the next figure. \begin{figure}[h] \caption{This is what I want in my lof} \includegraphics{file.eps} \label{file} \end{figure} some text referring to figure \ref{file} \end{document}December 15th, 2012 at 9:32 am
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:
From my system:
HTH, Tom.
December 18th, 2012 at 1:21 pm
hi Tom
I have an equation on three lines, with a single number.
\begin{equation} \begin{split} &\pi + \pi + \pi &\\ &\pi + \pi &\\ &\hfill \pi & \end{split} \end{equation}I need to centralize the first line, while second line should align the first line on left side. This works well. The third line should align the second line on the right side. This does not work. I have tried other options like using align, but it does not work.
Thanks in advance.
Kind regards
Whotee
December 21st, 2012 at 4:01 pm
Hi Whotee,
Try the following code and let me know if that’s not what you needed. Best, Tom.
\documentclass[10pt]{article} \usepackage{amsmath} \begin{document} \begin{equation} \begin{split} \pi + \pi& + \pi\\ \pi + \pi&\\ \pi \end{split} \end{equation} \end{document}December 22nd, 2012 at 12:29 am
hi Tom
thanks. I sent some very simple code to let you know my question. In reality these lines of code are bit more complex and not all terms are of equal width. I make one more example to clarify my point, in which this does not work (lines 1,2 to be left aligned, lines 2,3 to be right aligned)
\begin{equation} \begin{split} \alpha + \beta& + \frac{\gamma^2}{\delta+n+Limit}\\ \frac{S}{t-y^3} + i^\j \cdot k&\\ \pi \end{split} \end{equation}I really need this solution for any characters and math symbols.
Thanks, and best regards
January 8th, 2013 at 12:43 pm
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
\phantomcommand, 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?
January 8th, 2013 at 6:13 pm
Thanks Tom.
Please have a look at this code:
\begin{align} &\alpha + \beta + \frac{\gamma^2}{\delta+n+Limit}\\ &\frac{S}{t-y^3} \cdot k \cdot \frac{a}{\bp{b+c+d}^2}\\ &\phantom{\frac{S}{t-y^3} \cdot k \cdot \frac{a}{\bp{b+c+d}^2}}\pi \end{align}For third row, I need to go extreme right of second row MINUS the width of the third row — so that right side of second and third rows are aligned. How can we create white space of the size of difference of two phantoms?
Thanks in advance.
January 9th, 2013 at 3:07 am
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}February 15th, 2013 at 6:32 pm
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
February 16th, 2013 at 4:37 am
Hi James,
Use the optional argument of the
captioncommand.\caption[Figure name in lof]{Figure caption}February 16th, 2013 at 5:31 pm
Thanks Tom!
March 10th, 2013 at 5:37 am
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!!!!
March 11th, 2013 at 11:27 am
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
March 13th, 2013 at 1:19 am
Thanks for your answer!!!!
March 13th, 2013 at 2:57 am
You are welcome! Tom.
March 16th, 2013 at 8:15 pm
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
March 16th, 2013 at 8:18 pm
Only the list of Figures appears correctly – as Figure 1.1, Figure A.1 etc .etc.
March 19th, 2013 at 2:33 am
hi pahadi!
Thanks for your comment. Please provide a minimal working example, like the one below, to illustrate what you are describing. My example only shows numbers in TOC, LOF and LOT.
Thanks,
Tom
\documentclass[11pt]{report} \begin{document} \tableofcontents \listoffigures \listoftables \chapter{main} \section{First} \begin{figure}[ht]\caption{figure1}\label{fig:1}\end{figure} \begin{table}[ht]\caption{table1}\label{tab:1}\end{table} \section{Second} \begin{figure}[ht]\caption{figure2}\label{fig:2}\end{figure} \begin{table}[ht]\caption{table2}\label{tab:2}\end{table} \end{document}March 19th, 2013 at 3:34 am
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 !
March 19th, 2013 at 3:40 am
Cool, glad you solved your problem!
March 22nd, 2013 at 2:47 pm
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.
March 23rd, 2013 at 7:15 am
Hi Emivan,
Please provide a minimal working example that illustrates your problem with as few lines of code as possible. Is this the document-class you are using?
Thanks,
Tom
March 24th, 2013 at 7:28 pm
Yes, it is.
March 25th, 2013 at 2:13 pm
hey all, I am writting my thesis an dI have some problems in list of figures,
the caption of figures exceed the page width like:
3.2 Achieved sum rate for one way and two way AF and DF ….39
3.3 The achieved sum rate of the proposed GA, the ES algorithm, and the optimal solution
how can I make the second figure as:
3.3 The achieved sum rate of the proposed GA, the ES
the optimal solution …………………………………………………..40
Thanks in Advance
March 25th, 2013 at 2:53 pm
Hi Ahmad,
The problem might occur in certain cases when using the hyperref package. You might find the discussion on this site useful. In case that doesn’t solve your problem, please send a minimal working example.
Thanks,
Tom
March 28th, 2013 at 2:57 pm
hi Tom
I have a problem for rowcolor for multirow. As you will see, Carrots and 10 are half hidden by late arrival of rowcolor. This is part of a big table, in which I need to control rowcolor for multirow situation.
\begin{table}[!h] \centering \begin{tabular}{c|cc} \hline Apples & 1 & 2\\ \rowcolor[gray]{.97} \multirow{2}{*}{Carrots} & \multirow{2}{*}{10} & 20\\ \rowcolor[gray]{.97} & & 30\\ \end{tabular} \end{table}Thanks in advance.
Kind regards
Whotee
April 2nd, 2013 at 2:09 am
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}April 2nd, 2013 at 7:24 am
Thanks Tom! it works.
April 9th, 2013 at 12:37 pm
hello Tom
Please see this code:
\begin{equation}\label{sm-e-be}%balance eq. \begin{array}{rcl} \pi = && \frac{1}{\alpha+\beta} + \frac{\alpha}{\alpha^2+\beta} + \frac{\alpha^2}{\alpha^3+\beta^2} + \frac{\alpha^3}{\alpha^4+\beta^3} + \frac{\alpha^4}{\alpha^5+\beta^4}\\ &+& \frac{\sum_{1 < i < j} x_i + \prod_{z \in Z} \Delta^z}{\zeta - \Theta} - \omega \cdot \kappa \\ && 0 \LE j \LE J, 0 \LE Z \LE W_j. \end{array} \end{equation}It has two problems:
1. There is extra space after =. I want + of line 2 to appear after = of line 1, but without extra space. The equations after = and + should be left aligned, as they are now.
2. I want line 3 to right align with line 2.
Overall, all eqs are central.
Earlier I posted about it, but still I am looking for solutions to these issues.
Thanks in advance.
regards
whotee
April 15th, 2013 at 8:16 am
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
\mylengthand set it to the width of line 2. Then I define a box of that width and right-align the equation of line 3 in that box.Hope it works!
\documentclass[11pt]{article} \usepackage{amsmath} \newlength\mylength \settowidth{\mylength}{$+c$} \begin{document} \begin{equation}\label{sm-e-be}%balance eq. \begin{array}{rcl} a & = & b\\ && + c\\ &&\makebox[\mylength][r]{$d$}\\ \end{array} \end{equation} \end{document}April 18th, 2013 at 9:00 am
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
April 18th, 2013 at 9:44 am
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
April 18th, 2013 at 6:22 pm
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.
April 19th, 2013 at 1:59 am
Hi Emivan,
If you are new to bibliographies in LaTeX, take a look at the biblatex package. You might also find this post useful. Citation (bibtex) can be downloaded from google scholar.
HTH,
Tom
April 22nd, 2013 at 4:12 pm
Tom
I am using report class to make my own style file. I used \listoftables and \listoffigures command. They appear in first two lines of my TOC with page numbers. But according to my thesis requirement, these two lines should be removed from TOC (they I need lof and lot to just after my TOC). Can you pls help me?
April 23rd, 2013 at 3:14 am
Hi!
I suggest to load the tocbibind package with the following options:
\usepackage[nottoc, notlof, notlot]{tocbibind}See the package documentation for a complete list of options.
May 12th, 2013 at 9:42 am
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.
May 14th, 2013 at 5:03 pm
Hi Sriram,
I tried, but couldn’t reproduce the problem (see code below). Please send a minimal working example that I can compile and look at in Adobe Reader.
Thanks, Tom
\documentclass{report} \usepackage[nottoc]{tocbibind} \usepackage{blindtext} \usepackage{hyperref} \begin{document} \chapter*{Abstract} \addcontentsline{toc}{chapter}{Abstract}% \blindtext \tableofcontents \listoffigures \listoftables \chapter*{Un-numbered} \addcontentsline{toc}{chapter}{Un-numbered} \section*{Test section} \addcontentsline{toc}{section}{Test section} \chapter{Numbered} \section{Test section} \end{document}May 12th, 2013 at 7:45 pm
Hi Tom,
thanks for your quick answer.
I had a problem with the \listoffigures and \listoftables comand. They not appear (they are empty), what can I do? Thank you very much for any help you can give me.
Here are some lines of my code :
%code removed by Tom. ... \begin{figure}[!h] %dans cet emplacement \begin{center} \includegraphics{images/vide.pdf} \end{center} \end{figure} ...May 13th, 2013 at 2:33 am
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
May 13th, 2013 at 7:54 am
Hi Tom,
Yes, i integrates the figures with this structure in the chapter,
\begin{figure}[!h] \begin{center} \includegraphics[width=260,height=285]{images/twitFace.png} \end{center} \caption{Le trafic...} \label{twitFace} \end{figure}but in the main page (The code that I have already sent), when I made
\listoffigures, it appears empty.Can you please help me?
Thanks in advance.
May 13th, 2013 at 8:17 am
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
captionandlabelwithincenter-environment. There is extra whitespace between figure and caption the way you did it.HTH, Tom
May 13th, 2013 at 2:03 pm
Hi Tom,
Thanks for your advice, i succeed to find the solution
it’s just scheduling of \usepackage in the main page.
Thanks a lot.
May 13th, 2013 at 4:47 pm
Great, I’m glad you found a solution. Best, Tom