Graphics, Figures & Tables ⇒ How To Breakup List Of Figures For Bookmarks In PDF File
-
- Posts: 51
- Joined: Wed Aug 06, 2014 6:59 pm
How To Breakup List Of Figures For Bookmarks In PDF File
In general \listoffigures gives a listing of all the figures in the document. The "pdflatex" command produces a PDF file with a list of bookmarks on the left side of the document. The bookmarks come from the table of contents.
The section, subsection, and subsubsections appear in the bookmarks, but they're displayed in a tree. I.E.: You won't see these subsections unless you open the tree via clicking on the "+" sign next to the chapter name.
In the bookmarks, what I would like to be able to have is (instead of just creating a single link to a list of all the figures in the document) divide the output from the \listoffigures command in a tree-like layout just like sections, subsections are displayable via a tree.
FYI: I add the list of figures to the table of contents using the following code:
...
\phantomsection\label{listoffig}
\addcontentsline{toc}{chapter}{List of Figures}
\listoffigures
...
So, I get one link in the bookmarks of the PDF file.
Thanks,
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
-
- Posts: 51
- Joined: Wed Aug 06, 2014 6:59 pm
Re: How To Breakup List Of Figures For Bookmarks In PDF File
\usepackage{tocloft}
...
\newcommand{\listlemmaname}{List of Lemmas}
\newlistof{lemma}{lem}{\listlemmaname}
\newcommand{\lemma}[1]{%
\refstepcounter{lemma}
\par\noindent\textbf{Lemma \thelemma. #1}
\addcontentsline{lem}{lemma}
{\protect\numberline{\thechapter.\thelemma}#1}\par
}
...
\listoflemma
...
\lemma{My first lemma}
\label{lem:lemma1}
Reference:
http://texblog.org/2011/09/09/10-ways-t ... tocloflot/
-
- Posts: 51
- Joined: Wed Aug 06, 2014 6:59 pm
Re: How To Breakup List Of Figures For Bookmarks In PDF File
Thanks,
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
How To Breakup List Of Figures For Bookmarks In PDF File
Please provide a minimal working example this time. Follow the link and read how to do it.
-
- Posts: 51
- Joined: Wed Aug 06, 2014 6:59 pm
How To Breakup List Of Figures For Bookmarks In PDF File
- Add sections to the list of figures.
- Add line to the list of figures.
And, this gives an error when I add lines to the list of figures in my actual (real) document. It tells me, "! Argument of \contentsline has an extra }."
Reference:
http://texblog.org/2013/07/16/how-to-ad ... nd-tables/
Code: Select all
\documentclass[11pt]{article}\usepackage{blindtext}\usepackage{caption}\usepackage{etoolbox}\begin{document}\tableofcontents\preto\figure{%\ifnum\value{figure}=0\addtocontents{lof}{{\bfseries Section\thesection\vskip10pt}}\fi}\listoffigures\addtocontents{lof}{\contentsline{section}{\protect\rule{\linewidth}{.5pt}}{}}\section{First section}\begin{minipage}{\linewidth}\begin{center}\rule{5cm}{4cm}\captionof{figure}{this is my 1st caption}\end{center}\end{minipage}\begin{minipage}{\linewidth}\begin{center}\rule{5cm}{4cm}\captionof{figure}{this is my 2nd caption}\end{center}\end{minipage}\blindtext\addtocontents{lof}{\contentsline{section}{\protect\rule{\linewidth}{.5pt}}{}}\section{Second section}\begin{minipage}{\linewidth}\begin{center}\rule{5cm}{4cm}
How To Breakup List Of Figures For Bookmarks In PDF File
I added the bookmark feature for figure (and table) captions to the code.
It needs three runs of (pdflatex) to complete the correct ToC/LoT/LoF files.
Code: Select all
\documentclass[paper=a4,12pt]{scrartcl}%\usepackage[demo]{graphicx}%\usepackage{etoolbox}%\usepackage{xpatch}%\usepackage{blindtext}%\usepackage{caption}%\usepackage{placeins}%\usepackage{morewrites}%\usepackage{assoccnt}%\usepackage{letltxmacro}%\usepackage[bookmarksopen=true,bookmarksopenlevel=4]{hyperref}%\makeatletter% Get some file handles first\newwrite\figurecountsout%\newwrite\tablecountsout%\newread\figurecountsin%\newread\tablecountsin%%%% `Unique` bookmarks\newcounter{totalsections}\DeclareAssociatedCounters{section}{totalsections}%%% Redefine \caption\LetLtxMacro\LaTeXStandardCaption\caption%\newcommand{\caption@@noopt}[1]{%\caption@@opt[#1]{#1}%}%\apptocmd{\refstepcounter}{\gdef\LastRefSteppedCounter{#1}}{}{}%