Chapter 19
Index and Glossary

   19.1 theindex
   19.2 makeidx
   19.3 splitidx.sty
   19.4 External Processing of Index File (idxmake.4ht)
   19.5 Glossaries
   19.6 Glossary

ltidxglo.dtx

The index part is defined in latex.ltx, loaded by \makeindex, and can be overridden elsewhwere (e.g., in index.sty). The case is similar for make glossary.

<..control @..>
 \def\#{\string\#}%
 -_-_-

Within the source, we have a definition \chardef\#=‘\# which in immediate environment has the meaning of \# and in regular envirionment the meaning of \chat‘\#.

<..latex ltidxglo..>
 \NewConfigure{wrindex}[1]{\concat:config\a:wrindex{#1}}
 \let\a:wrindex\empty
 \expandafter\ifx \csname @indexfile\endcsname\relax \else
    \let\o:wrindex:=\@wrindex
    \def\@wrindex{\a:wrindex \o:wrindex:}
    \Configure{wrindex}
       {<.control @.>\warn:idx{\jobname}%
        \:wribefr\@indexfile}
 \fi
 \ifx \@glossaryfile\:UndDef \else
    \let\:wrglossary=\@wrglossary
    \def\@wrglossary{\:wribefr\@glossaryfile\:wrglossary}
 \fi
 \def\:wribefr#1{\title:chs{\html:addr
    \hbox{\Link-{}{<.index haddr.>}\EndLink}}{}%
    \edef\:temp{\write#1{\expandafter\string\a:idxmake{\RefFileNumber
       \FileNumber}{\title:chs {<.index haddr.>}{\cur:th
       \:currentlabel}}{\a:makeindex}}}\:temp}
 \ifx \a:makeindex\:UnDef
    \NewConfigure{makeindex}{1} \Configure{makeindex}{}
 \fi
 \ifx \beforeentry\:UnDef \def\beforeentry#1#2{}   \fi
 \NewConfigure{idxmake}{1}
 \Configure{idxmake}{\beforeentry}
 -_-_-

Without the \hbox we have sometimes a problem. Why?

The index command expandas to \begingroup \@sanitize \@wrindex and changes catcodes within \@sanitize. The \:wrindex needs to be careful with catcodes changes to avoid errors. For instance, a spacefactor in the following at oolatex

\documentclass[12pt]{article} 
\usepackage{makeidx} 
\makeindex 
\begin{document} 
\index{Hola: Hallo} Hola 
\printindex 
\end{document} 

or braces in the following for htlatex.

\documentclass{article} 
\usepackage[frenchb]{babel} 
\usepackage{makeidx} 
\makeindex 
 
\begin{document} 
\begin{itemize} 
\item \index{blabla} blabla 
\item blabla 
\end{itemize} 
\end{document}