The following code is a minimal dtx code with ending .tex (only for the example).
I try to understand when an index created and when not, how this is influenced by the loading of hyperref and fail to see that the commands of doc.sty behave as documented.
% \iffalse
%<*driver>
\ProvidesFile{dtxcode.tex}
%</driver>
%
%<*driver>
\documentclass{ltxdoc}
% \usepackage{hyperref}
% \EnableCrossrefs % (default) Every new macro name used within a macrocode or
% macrocode∗ environment will produce an index entry.
\DisableCrossrefs % turn off this feature
%
% If an index is created is determined by the use of the following
% declarations in the driver file preamble; if neither is used, no index is
% produced.
% \PageIndex % all index entries refer to their page number
% \CodelineIndex % index entries produced by \DescribeMacro and \DescribeEnv
% refer to page number but those produced by the macro
% environment refer to the code lines,
% which will be numbered automatically.
% \CodelineNumbered % no index is created, but the code lines are numbered
\RecordChanges
\listfiles
\begin{document}
\DocInput{dtxcode.tex}
\PrintIndex
\end{document}
%</driver>
% \fi
%%
% \DescribeMacro{\foobar} Prints out foobar \index{test}
%
% \Finale
\endinput
In this code the index is created with both \DisableCrossrefs
and DisableCrossrefs
However If I load additionally the package hyperref the index disappears completely no matter what commands I activate. The index file created is nevertheless still the same - it is just not loaded.
And if I use \CodelineNumbered
when hyperref is loaded the index appears again though it should not according to the docs of doc.sty.
To me this appears like a bug in ltxdoc/doc.sty.
EDIT:
Here a list of scenarios and their results. In all cases the idx file was deleted before execution and the pdf was created with pdflatex
, makeindex.exe -s gind.ist %.idx
, pdflatex
(a) no hyperref, \EnableCrossrefs and \PageIndex
%\usepackage{hyperref}
\EnableCrossrefs
\PageIndex
Index is created.
(b) no hyperref, \DisableCrossrefs and \PageIndex
%\usepackage{hyperref}
\DisableCrossrefs
\PageIndex
Index is created (but should not?)
(c) no hyperref, \DisableCrossrefs and \CodelineNumbered
%\usepackage{hyperref}
\DisableCrossrefs
\CodelineNumbered
Index is not created, empty idx file.
(d) no hyperref, \EnableCrossrefs and \CodelineNumbered
%\usepackage{hyperref}
\EnableCrossrefs
\CodelineNumbered
Index is not created. It seams that \EnableCrossrefs
and \DisableCrossrefs
do not control the index in contrast to the description of the documentation.
(e) with hyperref, \EnableCrossrefs and \PageIndex
\usepackage{hyperref}
\EnableCrossrefs
\PageIndex
idx file is created but only self defined \index
entries are displayed. In this case test
but not foobar
, though both are in the idx file with
\indexentry{foobar=\verb!*+\foobar+|usage|hyperpage}{1}
\indexentry{test|hyperpage}{1}
(f) with hyperref, \EnableCrossrefs and \CodelineNumbered
\usepackage{hyperref}
\EnableCrossrefs
\CodelineNumbered
No idx file is created as without hyperref.
To summarize: With loading of hyperref the creation of the index files is not influenced, but the index entries of doc.sty arenot included during compilation in the pdf.
dtxcode.glo
because of\RecordChanges
that is converted bymakeindex -s gglo -o dtxcode.gls dtxcode.glo
. (b) I don't get adtxcode.idx
with/withouthyperref
or with/without\CodelineNumbered
. Please make more clear, which scenario you are using and which files are created by a scenario.