General\listoffigures

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
hasi
Posts: 3
Joined: Tue Jan 01, 2008 7:10 pm

\listoffigures

Post by hasi »

I'm having troubles with the \listoffigures command.
The number of the figure and the beginning of the caption overlap a bit for numbers larger than ten.
This doesn't happen with the \tableofcontents, however.

I'm a bit at loss. Is there a special package I need?
is there a way to change the distance between numbers and captions?
Attachments
Picture 1.png
Picture 1.png (5.15 KiB) Viewed 9000 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

\listoffigures

Post by Juanjo »

It suffices to modify the internal LaTeX command \l@figure. In the standard classes, it has the following definition:

Code: Select all

\newcommand*\l@figure{\@dottedtocline{1}{1.5em}{2.3em}}
The length 1.5em is the space from the left margin to every line in the list of figures, whereas 2.3em is the space reserved for the number of every figure. It seems that you need to increase this length. Put in the preamble of your document something like:

Code: Select all

\makeatletter
\renewcommand*\l@figure{\@dottedtocline{1}{1.5em}{3.3em}}
\makeatother
Try a different value, instead of 3.3em, if needed.
hasi
Posts: 3
Joined: Tue Jan 01, 2008 7:10 pm

Re: \listoffigures

Post by hasi »

This works.

Phew! Thank you very much, this saved my day!!!!
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

\listoffigures

Post by localghost »

The preferable solution would be to use the tocloft package and add some commands in the preamble.

Code: Select all

\cftsetpnumwidth{2em}
\setlength{\cftsubsecnumwidth}{4em}
\setlength{\cftfignumwidth}{3em}

Best regards
Thorsten
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

\listoffigures

Post by Juanjo »

In fact, for the problem discussed here, it would suffice to load tocloft and the command
\setlength{\cftfignumwidth}{3em}. This can also be done with the titletoc package and the command \dottedcontents{figure}[4.5em]{}{3em}{0.75em}. I think it is a better choice if the sectioning commands are redefined with the titlesec package, since both packages cooperate perfectly. Anyway, since the direct approach is so simple, I wonder if it is really worthy to load a package.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: \listoffigures

Post by localghost »

Using a package is always preferable, because its code is (or should be) tested by the author. So the risk of side effects is minimized.
Post Reply