W3C home > Mailing lists > Public > www-math@w3.org > July 2015

Re: Use of \catcode command for character letters ^ and _ in pmml-new.sty file restricts the normal use of these characters for superscripts and subscripts.

From: David Carlisle <davidc@nag.co.uk>
Date: Wed, 8 Jul 2015 09:38:35 +0100
Message-ID: <559CE18B.2000402@nag.co.uk>
To: <www-math@w3.org>
On 07/07/2015 20:46, saf sied wrote:
> At some places in my text document I am using Dr. Carlisle’s XSLT

"David" is fine:-)

> <https://github.com/davidcarlisle/web-xslt/tree/master/pmml2tex> to
> convert MathML to LaTeX; whereas, at other places I am using standard
> ams-LaTeX.
> In MikTeX, the following properly displays “a squared” and “a sub 2”
> \documentclass{article}
> \begin{document}
> \[a^2\]
> \[a_2\]
> \end{document}
> But when including the \usepackage{pmml-new} in the preamble the above
> displays as simple text a^2 and a_2.
> If I remove the last two lines (shown at the end below) from the
> pmml-new.sty file the “^” and “_” work fine for superscripts and
> subscripts respectively. Moreover, msup and msub defined in the above
> file continue to work for superscript and subscript, as well. I would
> like to use both the LaTeX generated from MathML and the standard LaTeX
> in a same document. For example I would like to be able to use the
> following quadratic formula generated from MathML or a simple LaTeX
>   \(a^2\) on the same tex document:
> \(\let\par\empty
> x={\frac{{-b\unicode{177}\sqrt{{\msup{{b}}{{{2}}}}-{4}ac}}}{{{2}a}}}
> \)
> Would removing the following last two lines from the pmml-new.sty file
> cause any other issues? If yes, are there any other changes we can make
> to the .sty file to make both ams-LaTeX and LaTeX generated by Dr.
> Carlisle’s files work together on a same document
> \catcode`\_=12
> \catcode`\^=12
>

Yes you could remove that from a local copy or just set them back to
catcode 8 and 7 after loading the package.

The original use case for the style was converting XML (such as the XML
source of the MathML spec) where ^ (and especially) _ may occur just as
normal text and rather than have to trap and escape those I just made
all _ normal text and never generated _ for subscripts, always used
\msub etc.

As your fragments show it doesn't really to to make "clean" tex to put
into an existing document, it was used to convert the entire document to
tex for pdf generation as a "black box" process, so the tex it generates
is rather ugly.

David


________________________________


The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is:

Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.



This e-mail has been scanned for all viruses by Microsoft Office 365.

________________________________
Received on Wednesday, 8 July 2015 08:40:36 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 July 2015 08:40:38 UTC