brucemiller / LaTeXML

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

broken handling of underscore in file names read by `\lstinputlisting` #2178

Closed xworld21 closed 1 year ago

xworld21 commented 1 year ago

MWE:

\documentclass{article}
\usepackage{listings}
\begin{document}
\lstinputlisting{t/000_test_context.t}
\lstlistoflistings
\end{document}

generates

<?xml version="1.0" encoding="UTF-8"?>
<?latexml searchpaths="/Users/xworld21/Documents/Workspace/TeX/LaTeXML"?>
<?latexml class="article"?>
<?latexml package="listings"?>
<?latexml RelaxNGSchema="LaTeXML"?>
<document xmlns="http://dlmf.nist.gov/LaTeXML">
  <resource src="LaTeXML.css" type="text/css"/>
  <resource src="ltx-article.css" type="text/css"/>
  <resource src="ltx-listings.css" type="text/css"/>
  <float class="ltx_lstlisting" xml:id="LSTx1">
    <toccaption>t/000˙test˙context.t</toccaption>
    <!-- OMITTED -->
    </listing>
  </float>
  <TOC lists="lol" scope="global">
    <title>Listings</title>
  </TOC>
</document>

Something weird is happening with the _ character.

Note that the listings.sty package handles the underscore correctly.