Primes and superscripts in mathed

Andrew Parsloe ajparsloe at gmail.com
Sun Nov 26 21:10:30 UTC 2023


TeX accepts  S'^{2}  (between $ delimiters) as a valid construction 
(TeXbook, p.130, line above Ex. 16.5) but mathed in LyX converts this to 
S'{}^{2}. In this simple case that is not a problem (in fact the 
interpolated {} gives better spacing) but it becomes a problem with 
expressions like (real-life example)

  S'^{\,-1}_{0i}  or S_{0i}'^{\,-1}

These compile fine in TeX and display as desired but mathed turns them into

  S'{}_{0i}^{\,-1}  and  S_{0i}'{}^{\,-1}

which give very different and clearly wrong results in the pdf.

The combination of a prime followed by a superscript seems a 
sufficiently basic sequence to me that I think mathed should handle it 
with more finesse than immediately and always inserting an empty brace 
pair between ' and ^.

[[Speculation:  I don't know the code but perhaps the problem is that 
mathed insists on subscript preceding superscript when both are involved 
in a symbol? R^{ij}_{kl} in mathed becomes R_{kl}^{ij}, and inserting a 
prime as in R'_{kl}^{ij} then produces the double superscript error. In 
contrast, R_{kl}'^{ij} does not. TeX accepts the '^ combination and I 
think mathed should do so too.]]

Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20231127/20bce126/attachment-0001.html>


More information about the lyx-devel mailing list