I refer to Still problems with multiple indexes in ltxdoc

The solution given there works for that simple MWE, but in my real project I encounter a more serious problem. The next M_not_WE shows it. When I run "pdflatex testidx.dtx" it responds with:

! Undefined control sequence.
\special@index ...w \immediate \write \@indexfile
  {\string \indexentry
l.26 % \begin{macro}{\my@macroA}

When I comment out the line "\CodelineIndex" it runs through

What is wrong with my code?

% \iffalse
\makeindex[options=-s gind.ist,title={General Index}]
% \fi
% \DescribeMacro{\my@macroA}
% \DescribeMacro{\mymacroB}
% \StopEventually{}
% \section{Implementation}
% \iffalse
% \fi
% \begin{macro}{\my@macroA}
%    \begin{macrocode}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\mymacroB}
%    \begin{macrocode}
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
%    \end{macrocode}
% \iffalse
% \fi
% \Finale

There were no responses at all, so I answer my own question. After some experimenting I found a solution by not using imakeidx at all. What I did is essentially this (remember that I wanted to have a list of user commands at the end of the documentation of my package, using ltxdoc):

First I write the commands in a file with some formatting stuff. I thereby use hyperref to get a clickable index. At the end I read this file to get the list.

Prelimary Stuff

\immediate\openout\UCFile="| sort -d > \jobname.odw

Read the commands


Example of a call


Write the file

\begin{multicols}{3}[\section{List of User Commands}]
     {\PackageWarning{ODw}{File \jobname.odw not found}}


pdflatex must be called with the option --shell-escape

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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