Primes and superscripts in mathed

Andrew Parsloe ajparsloe at gmail.com
Mon Nov 27 22:15:29 UTC 2023


On 27/11/2023 6:02 pm, Isaac Oscar Gariano wrote:
> Personally, I just don't use the |'|​ in LyX at all, especially as it 
> doesn't display correctly, and as you show, doesn't combine properly 
> with other superscripts/subscripts.
> Instead, I always do |^\prime|​ which looks much nicer, and lets you 
> control things better.
>
> So perhaps the code would work better if it just made |'|​ autocorrect 
> to |^\prime|​ ?
>
> (In fact I've defined my own |\pri|​ command which alters the LaTeX 
> height of the |\prime|​ to one I like more; and ones that use the 
> |unicode-math|​ multi-prime commands |\dprime|​, |\tprime|​, and 
> |\qprime|​).

I was unaware of the command \prime until looking up the TeXbook for my 
email. I've also now made a shortcut that does what I want. Thank you 
(but I still think LyX should handle the combination '^ better).


Andrew

>
> — Isaac Oscar Gariano​
> ------------------------------------------------------------------------
> *From:* lyx-devel <lyx-devel-bounces at lists.lyx.org> on behalf of 
> Andrew Parsloe <ajparsloe at gmail.com>
> *Sent:* Monday, 27 November 2023 10:10 AM
> *To:* LyX Developers <lyx-devel at lists.lyx.org>
> *Subject:* Primes and superscripts in mathed
>
> 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/20231128/b2761898/attachment.html>


More information about the lyx-devel mailing list