LaTeX forum ⇒ MakeIndex, Nomenclature, Glossaries and AcronymsList of Figures Topic is solved

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

List of Figures

Postby Shamson » Tue Dec 26, 2017 11:43 pm

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.

User avatar
Stefan Kottwitz
Site Admin
Posts: 8955
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Wed Dec 27, 2017 11:53 am

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
Site admin

Shamson
Posts: 8
Joined: Tue Dec 26, 2017 6:33 pm

Postby Shamson » Sun Dec 31, 2017 2:18 pm

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: 8955
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Sun Dec 31, 2017 3:01 pm

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:

  1. \usepackage{tocloft}
  2. \usepackage{hyperref}
  3. \renewcommand{\cftfigpresnum}{Figure\ }
  4.  
  5. \newlength{\figlen}
  6. \settowidth{\figlen}{\cftfigpresnum}
  7. \setlength{\cftfignumwidth}{\dimexpr\figlen+1.5em}


Stefan
Site admin

Shamson
Posts: 8
Joined: Tue Dec 26, 2017 6:33 pm

Postby Shamson » Mon Jan 01, 2018 9:45 pm

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


Return to “MakeIndex, Nomenclature, Glossaries and Acronyms”

Who is online

Users browsing this forum: No registered users and 4 guests