Hello Stack Exchangers

I have been facing a problem in the successful compilation of the listings package's LaTeX Macros (.dtx) file into the local directory. The intention is not only to use the sty already present in the directory but to compile it on Windows 10 by using TeXWorks. The following error pops up (on Console output) upon compilation by using both XeTeX and LaTeX:

! Extra }, or forgotten \endgroup. l.228 \item definelanguage} , \hyperpage{43} ?

And in the Errors, warning, badboxes, the following error is the hurdle for the compilation:

listings.ind 228 Extra }, or forgotten \endgroup. l.228 \item definelanguage} , \hyperpage{43}

The package was downloaded from CTAN and the intention for downloading was to compile the package for understanding and utilizing it (especially in verbatim commands).

If it is downloaded by another person & successfully compiles (the listings.dtx file), then it means that the problem is not in the syntax present in the package. Otherwise, it is the syntactical issue that needs be resolved before the package's distribution to the users and developers.

The .ind file is also missing (when the package was downloaded) which is present in the syntax of the listings.dtx file, and is mentioned in the l.3683 as listings.ind.

There is another file by the name of lstdrvrs which is a .dtx file and that file can be successfully compiled. Your test for assessing the package will be appreciated.


  • listings is in texlive and miktex, why are you installing a local copy? although it should work, show your full log Dec 9, 2023 at 7:38

1 Answer 1


listings is in texlive and miktex so you should never need to install it from ctan. If you do install it, then beware a local version will mask any copy of the package in the standard directories so you will not benefit from any future updates.

However it does work, the ctan download includes a Makefile with the steps required but to do it by hand you need to first run

pdflatex listings.dtx

This will generate listings.idx from which you need to use makeindex to generate the sorted index. The error you show indicates you used

makeindex listings

But that assumes the default makeindex style where @ is a special index character which makes it inconvenient for tex code. Like most packages using the doc package system, listings uses the gind.ist makeindex style so use

makeindex -s gind.ist listings

then run

pdflatex listings.dtx


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .