Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

For a relatively short report I would like to merge the list of figures (LoF) into the document's table of contents. In two related questions, Gonzalo Medina has suggested to just change the file extension LaTeX uses for the LoF, so that entries for figures end up in jobname.toc:

However, if this approach is used in conjunction with hyperref (to get a PDF ToC), the figure entries end up on chapter level (level 0) in the PDF ToC – with the effect, that the figure becomes the father of all following section or subsection entries:

\documentclass{scrartcl}
\usepackage{tocloft}
\usepackage{subfig}
\usepackage{hyperref}

\makeatletter
\renewcommand\ext@figure{toc}
\makeatother

\newlength\mylen
\renewcommand\cftfigpresnum{Figure~}
\settowidth\mylen{\bfseries\cftfigpresnum\cftfigaftersnum}
\addtolength\cftfignumwidth{\mylen}

\begin{document}

\tableofcontents
\section{Test Section One}
Text
\subsection{Subsection One.1}
\begin{figure}[!ht]
A
\caption{test figure}
\end{figure}
\subsection{Subsection One.2}
Text
\section{Test Section Two}
\begin{figure}[!ht]
A
\caption{another test figure}
\end{figure}
\begin{figure}[!ht]
\subfloat[][A subfigure]{A}
\subfloat[][A subfigure]{B}
\caption{test figure with subfigures}
\end{figure}
\subsection{Subsection Two.1}
Text
\end{document}

The following screenshot shows the problem: In the PDF ToC (left side), Subsection One.2 and even Test Section Two are nested below the entry for test figure. Moreover, the figures are missing the Figure <#> prefix:

enter image description here

Questions:

  • How do I get the figure entries to appear on subsection level inside the PDF ToC?
  • How to add the Figure <#> prefix to the PDF ToC entries?
share|improve this question
    
@dustin: Thanks, but the point is that I want the figures on subsection level only in the PDF ToC, not regarding references inside the document's body. –  Daniel Jun 24 '13 at 20:12
    
I never had that issue because I removed the figures from the sidebar view. They only show up in the TOC for me. I will remove the answer now. –  dustin Jun 25 '13 at 19:12

1 Answer 1

up vote 2 down vote accepted

The level of figures inside the bookmarks / contents are specified by toclevel@<element>:

Related to your question (I hope I understood you):

\usepackage[bookmarksdepth=4]{hyperref}
\makeatletter
 \def\toclevel@figure{4}
\makeatother
share|improve this answer
    
Thanks Marco, that was it! –  Daniel Jun 25 '13 at 18:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.