Troubleshooting \PrintIndex \PrintChanges

docindexing

The code below contains a change markup and the intent is that it be printed. I get:

ERROR: LaTeX Error: \verb ended by end of line.

How can I fix it?

foo.dtx

% \iffalse meta-comment
% !TEX program  = pdfLaTeX
%<*internal> 
\iffalse
%</internal> 
%<*readme> 
-----------------------------------------------------------------------------------
##### foo --- dummy dtx file
------------------------------------------------------------------------------------
%</readme> 
%<*internal> 
\fi
\def\nameofplainTeX{plain}
\ifx\fmtname\nameofplainTeX\else
\expandafter\begingroup
\fi
%</internal> 
%<*install> 
\input l3docstrip.tex
\keepsilent
\askforoverwritefalse
\preamble
------------------------------------------------------------------------------
foo --- dummy dtx file
------------------------------------------------------------------------------

\endpreamble
\postamble

Copyright (C) 2021 by Author

\endpostamble
\generate{
  \file{\jobname.sty}{\from{\jobname.dtx}{package}}
}
%</install> 
%<install> \endbatchfile
%<*internal> 
\generate{
  \file{\jobname.ins}{\from{\jobname.dtx}{install}}
}
\nopreamble\nopostamble
\generate{
  \file{README.md}{\from{\jobname.dtx}{readme}}
}
\ifx\fmtname\nameofplainTeX
\expandafter\endbatchfile
\else
\expandafter\endgroup
\fi
%</internal> 
%<package> \NeedsTeXFormat{LaTeX2e}[2021-06-01]
%<package> \ProvidesExplPackage
%<package> {foo}                                              % Package name
%<package> {2021-08-03}                                       % Release date
%<package> {1.0}                                              % Release version
%<package> {foo --- dummy dtx file }
%<*driver> 
\documentclass[show-notes]{l3doc}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\usepackage{foo}
\usepackage{hyperref}
\begin{document}
\DocInput{\jobname.dtx}
\end{document}
%</driver> 
% \fi
% 
% \GetFileInfo{\jobname.sty}
% \begin{documentation}
% 
% \changes{Version 1.0}
% {2020/08/03}
% {Initial version}
%^^A {\DTMdate{2020-08-03}}
% 
% \StopEventually{\clearpage{}\PrintChanges\PrintIndex}
% \end{documentation}
% \begin{implementation}
%    \begin{macrocode}
%<*package>      
%<@@=foo>      
\ExplSyntaxOn
%    \end{macrocode}
%    \begin{macrocode}
\ExplSyntaxOff
%</package> 
%    \end{macrocode}
% \end{implementation}
% \Finale
% ^^A\PrintIndex \PrintChanges
\endinput

/latex-dev/base/doc.dtx

% \DescribeMacro\PrintIndex
% To read in and print the sorted index, just put the
% |\PrintIndex| command as the last (commented-out, and thus
% executed during the documentation pass through the file) command
% in your package file.  Precede it by any bibliography commands
% necessary for your citations.
% Alternatively, it may be more convenient to put all such calls
% amongt the arguments of the |\StopEventually| macro, in
% which case a |\Finale| command should appear at the end of
% your file.

PS: only \PrintIndex is the problem

Best Answer

You are likely running MakeIndex with a call such as

 makeindex -o foo.ind foo.idx

which will use the default style. What you need is

 makeindex -o foo.ind -s gind.ist foo.idx

which will use the correct indexing style file to convert the .idx file generated by doc.

Related Question