[tex4ht] minitoc is generated but with no links. How to make minitoc be clickable?

Nasser M. Abbasi nma at 12000.org
Fri Aug 9 22:10:34 CEST 2013


Hello;

I am trying to generate table of contents for different pages
in a very large and split document, and also control where the
TOC gets displayed.

Some sections or chapters can be too small to require a TOC, and some
are larger and a TOC will be useful there or I might not want a TOC
at some of them.

The common solution now is to use \TocAt{chapter,section,subsection}
to make a TOC for each chapter which contains entries for sections
and subsections inside that chapter. This works fine. For example,
If one does not want a TOC for each chapter, then \TocAt{chapter} will
do the trick.

The problem is that this method affects the WHOLE document. i.e it
is global. So one can not select which chapter or which section to
have a TOC for like with pdflatex output.

minitoc canbe used for this, but when I tried on a small example, the
minitoc was generated but it had no links. This makes it not
very useful. i.e. the actual entries in the TOC are not clickable
like the main TOC, but contains raw text.

Here is a MWE using minitoc with tex4ht, and below it
is another MWE showing the use of \TocAt{}

htlatex foo.tex "htm,2"

-------------------------------
\documentclass{report}%
\usepackage{ifpdf}
\usepackage{lipsum}
\usepackage{minitoc}

\begin{document}
\title{test minTOC with tex4ht}
\author{me}
\date{\today}
\maketitle
\dominitoc
\tableofcontents

\chapter{chapter 1}
\minitoc  %make TOC only for this chapter
   \lipsum{1}
\section{section 1 under chapter 1}
    text
\subsection{subsection 1 under section 1 under chapter 1}
       text
\subsubsection{subsubsection 1}

\chapter{chapter 2}  % No TOC here
   \lipsum{1}
\section{section 1 under chapter 2}
\end{document}
-------------------------

This below will generate a clickable TOC for each separate
chapter. (but again, I only wanted one for the first chapter
in this example)

htlatex foo.tex "htm,2"
also tried
htlatex foo.tex "htm,2,minitoc<"

----------------------------------
\documentclass{report}%
\usepackage{ifpdf}
\usepackage{lipsum}
\usepackage{minitoc}

\begin{document}
  \ifx\HCode\undefined \else
  \TocAt{chapter,section,subsection}
  \fi

\title{test minTOC with tex4ht}
\author{me}
\date{\today}
\maketitle

\ifdefined\HCode
\else
\dominitoc
\fi

\tableofcontents

\chapter{chapter 1}
\ifdefined\HCode
\else
\minitoc  %make TOC only for this chapter
\fi

   \lipsum{1}
   \section{section 1 under chapter 1}
    text
      \subsection{subsection 1 under section 1 under chapter 1}
       text
           \subsubsection{subsubsection 1}
\chapter{chapter 2}
   \lipsum{1}
   \section{section 1 under chapter 2}
\end{document}
---------------------------

Is it possible to add full support to minitoc or is there a way
to control TOC per section/chapter level? May be using some
\Configure command I can use where I want to TOC to show up or not?

references:
------------
1. http://tug.org/applications/tex4ht/mn11.html#QQ1-11-55
2. http://www.ctan.org/pkg/minitoc
3. http://tug.org/pipermail/tex4ht/2011q1/000250.html

thank you,
--Nasser


More information about the tex4ht mailing list