brucemiller / LaTeXML

LaTeXML: a TeX and LaTeX to XML/HTML/ePub/MathML translator.
http://dlmf.nist.gov/LaTeXML/
Other
957 stars 101 forks source link

Duplicated characters when using listings.sty morestring feature #2417

Open henrikt-ma opened 2 months ago

henrikt-ma commented 2 months ago

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.

dginev commented 2 months ago

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