Bug report: List of listings incompatible with book classes

Léo de Souza leo.de_souza at minesparis.psl.eu
Sat Oct 5 11:52:12 UTC 2024


Hello,

I would like to report that inserting a list of listings creates errors with book document classes.

Environment:

I compiled LyX 2.4.2.1 on Ubuntu 22.04 with Qt6 enabled.

Steps to reproduce:

1. Create a new document: File > New
2. Set the document class to one of the book classes, for example Koma-Script Book
3. Insert a list of listings: Insert > List/Contents/References > List of Listings
4. Try to compile the PDF document: Document > View [PDF (pdflatex)]

Expected result: The document is compiled successfully.

Actual result: Various errors depending on the document class.

Additional information:

This is the LaTeX code typically generated by LyX when adding a list of listings:

    \documentclass{scrbook}
    \usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc}
    \usepackage{listings}
    \renewcommand{\lstlistlistingname}{\inputencoding{latin9}Listings}

    \begin{document}
    \lstlistoflistings{}
    \end{document}

Adding the following ERT at the beginnig of the document prevents errors :

    \renewcommand{\lstlistlistingname}{Listings}

I suspect the errors are happening because LyX automatically add a line in the preamble that contains \inputencoding{latin9}


More information about the lyx-devel mailing list