MakeIndex, Nomenclature, Glossaries and AcronymsList of Figures

Information and discussion about MakeIndex - the tool to generate subject indices for LaTeX documents.
Post Reply
Shamson
Posts: 8
Joined: Tue Dec 26, 2017 6:33 pm

List of Figures

Post by Shamson »

Dear community members,
I could add text "Figure" to the List of figures (\listoffigures), but the problem is that hyperref can not cover those extra text "Figure"s. Can you please suggest a solution for this?

Thanks a lot.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

List of Figures

Post by Stefan Kottwitz »

Hi Shamson,

welcome to the forum!

It depends on how you add it. What are you doing, can you show code? With document class and preamble please, so we can test and fix it.

Stefan
LaTeX.org admin
Shamson
Posts: 8
Joined: Tue Dec 26, 2017 6:33 pm

List of Figures

Post by Shamson »

Dear Stefan,
I just saw your answer. Thanks, I hope this community is strongly supported by experts.

So, \listoffigures generate list of figures. Then I use \renewcommand{\cftfigfont}{Figure} .

but the problem is that hyperref can not cover those extra text "Figure"s. Can you please suggest a solution for this?

Thanks a lot.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

List of Figures

Post by Stefan Kottwitz »

Hi Shamson!

Redefining \cftfigfont is a just a quick hack, I guess you read it on some web site. \cftfigfont is a macro for the figure font name, for example one writes \renewcommand{\cftfigfont}{\bfseries} to get bold figure numbers. That hack sets Figure instead of \bfseries right before a figure number, so it seems to work in the text but hyperref cannot see this to extend the hyperlink.

A correct way would be:

Code: Select all

\usepackage{tocloft}
\usepackage{hyperref}
\renewcommand{\cftfigpresnum}{Figure\ }

\newlength{\figlen}
\settowidth{\figlen}{\cftfigpresnum}
\setlength{\cftfignumwidth}{\dimexpr\figlen+1.5em}
Stefan
LaTeX.org admin
Shamson
Posts: 8
Joined: Tue Dec 26, 2017 6:33 pm

List of Figures

Post by Shamson »

Dear Stefan,
You did a great job.
Thank you very much.
Post Reply