LaTeXML icon indicating copy to clipboard operation
LaTeXML copied to clipboard

Duplicated characters when using listings.sty morestring feature

Open henrikt-ma opened this issue 1 year ago • 1 comments

Build:

\documentclass{article}
\NeedsTeXFormat{LaTeX2e}

\usepackage{listings}
\lstset{
% morestring=[b]{A},
  morestring=[b]{B},
}

\begin{document}

\lstinline!A!

\lstinline!B!

\lstinline!xBx!

\end{document}

While the pdfLaTeX build shows a single A and a single B for the first two paragraphs, the LaTeXML build contains a doubled-up BB (the A can also be doubled-up by uncommenting the corresponding morestring line).

The problem was originally reported to me in https://github.com/modelica/ModelicaSpecification/issues/3572, where the use of morestring makes more sense than in the minimal example included here.

Edit: I extended the minimal document with \lstinline!xBx!, which shows that the morestring feature isn't breaking every occurrence of the character, which probably explains why we haven't noted the problem earlier.

henrikt-ma avatar Sep 17 '24 22:09 henrikt-ma

Thank you for the report. I have reproduced the bug as stated, indeed a double BB is produced.

dginev avatar Sep 17 '24 22:09 dginev