TEIC / Stylesheets

TEI XSL Stylesheets
231 stars 124 forks source link

tei2latex issue with un-escaped `#` #565

Closed peterstadler closed 2 years ago

peterstadler commented 2 years ago

This came up during work on the CMC proposal, where references with/to hashtags are quite frequent. Yet the "#" character is a reserved character in LaTeX and needs to be escaped properly. This already works quite well but there's yet another case:

Given the TEI snippet

<body>
   <p>This works: <ref target="https://twitter.com">#hashtag</ref></p>

   <egXML xmlns="http://www.tei-c.org/ns/Examples" xml:id="ex.tweets">
      <p>A hashtag within a ref within an egXML:</p>
      <ref target="https://twitter.com">#hashtag</ref>
   </egXML>

   <p>But this fails to transform properly: <ptr target="#ex.tweets"/>.</p>
</body>

This is the output of teitolatex (snippet):

This works: \xref{https://twitter.com}{\#hashtag}\par\bgroup\exampleFont \begin{shaded}\noindent\mbox{}{<\textbf{p}>}A hashtag within a ref within an egXML:{</\textbf{p}>}\mbox{}\newline 
{<\textbf{ref}\hspace*{6pt}{target}="{https://twitter.com}">}\#hashtag{</\textbf{ref}>}\end{shaded}\egroup\par \par
But this fails to transform properly: \hyperref[ex.tweets]{A hashtag within a ref within an egXML:#hashtag}.

Most occurrences of the string "#hashtag" are correctly prefixed by a backslash, only the generated link text for the <ptr> is lacking this escape character.