GeneralFormatting listoffigures

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
sprince09
Posts: 5
Joined: Wed Apr 21, 2010 8:44 pm

Formatting listoffigures

Post by sprince09 »

For a list of figures (\listoffigures), how can I remove the space that get's automatically added between chapters? Also, how can I modify the entries in the \listoffigures to display something like 'Fig x.y' instead of just the figure number 'x.y'?

Recommended reading 2024:

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

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

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Formatting listoffigures

Post by gmedina »

Hi,

tocloft could be an option. Read the package documentation or use the "Search" functionality of this board to find the explicit answer.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
sprince09
Posts: 5
Joined: Wed Apr 21, 2010 8:44 pm

Formatting listoffigures

Post by sprince09 »

Thanks, the tocloft packages seems to be what I needed, or at least partially. I was able to add the 'figure' prefix to all of my entries as required, but I still can't get rid of the spacing between paragraphs.

To add 'figure' before number in list of figures:

Code: Select all

\renewcommand{\cftfignumwidth}{6em}
\renewcommand{\cftfigpresnum}{Figure }
\listoffigures
Anyone know how to get rid of this space? I've tried all of the \cftbeforeXskip and \cftXafterpnum commands but I still get this (see attached pic) annoying space.
Attachments
Pic of extra space
Pic of extra space
space.png (34.32 KiB) Viewed 21983 times
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Re: Formatting listoffigures

Post by gmedina »

Which document class are you using?
1,1,2,3,5,8,13,21,34,55,89,144,233,...
sprince09
Posts: 5
Joined: Wed Apr 21, 2010 8:44 pm

Re: Formatting listoffigures

Post by sprince09 »

report
sprince09
Posts: 5
Joined: Wed Apr 21, 2010 8:44 pm

Formatting listoffigures

Post by sprince09 »

Relavent portion of code:

Code: Select all


% List of figures and tables
\clearpage
\renewcommand{\listfigurename}{\begin{center} \normalsize \textbf{LIST OF FIGURES} \end{center}}
\renewcommand{\cftfignumwidth}{6em}
\renewcommand{\cftfigpresnum}{Figure }
\renewcommand{\cftbeforefigskip}{0em}
\renewcommand{\cftbeforechapskip}{0em}
\renewcommand{\cftfigafterpnum}{}
\addcontentsline{toc}{section}{LIST OF FIGURES}
\listoffigures
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Formatting listoffigures

Post by gmedina »

Add the following lines to the preamble of your document:

Code: Select all

\makeatletter
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
                         \refstepcounter{chapter}%
                         \typeout{\@chapapp\space\thechapter.}%
                         \addcontentsline{toc}{chapter}%
                                   {\protect\numberline{\thechapter}#1}%
                    \else
                      \addcontentsline{toc}{chapter}{#1}%
                    \fi
                    \chaptermark{#1}%
                    \if@twocolumn
                      \@topnewpage[\@makechapterhead{#2}]%
                    \else
                      \@makechapterhead{#2}%
                      \@afterheading
                    \fi}
\makeatother
1,1,2,3,5,8,13,21,34,55,89,144,233,...
sprince09
Posts: 5
Joined: Wed Apr 21, 2010 8:44 pm

Re: Formatting listoffigures

Post by sprince09 »

Huh, that's magic to me but it worked perfectly. Thanks!
Post Reply