[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lyx-devel
Subject:    Re: Primes and superscripts in mathed
From:       Andrew Parsloe <ajparsloe () gmail ! com>
Date:       2023-11-27 22:15:29
Message-ID: 813f31f4-8eab-47d1-aabf-7e962c813fba () gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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@lists.lyx.org> on behalf of 
> Andrew Parsloe <ajparsloe@gmail.com>
> *Sent:* Monday, 27 November 2023 10:10 AM
> *To:* LyX Developers <lyx-devel@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
>
[Attachment #5 (text/html)]

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">On 27/11/2023 6:02 pm, Isaac Oscar
      Gariano wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:SY7P282MB38980365E9F914833A540D778CBDA@SY7P282MB3898.AUSP282.PROD.OUTLOOK.COM">
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <style type="text/css" style="display:none;">P \
{margin-top:0;margin-bottom:0;}</style>  <div class="elementToProof"
style="font-family: &quot;Segoe UI&quot;, &quot;Segoe UI Web (West European)&quot;, \
&quot;Helvetica Neue&quot;, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">  \
Personally, I just don't use the <code>'</code>​ in LyX at all,  especially as it \
doesn't display correctly, and as you show,  doesn't combine properly with other \
superscripts/subscripts.</div>  <div class="elementToProof"
style="font-family: &quot;Segoe UI&quot;, &quot;Segoe UI Web (West European)&quot;, \
&quot;Helvetica Neue&quot;, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">  \
Instead, I always do <code>^\prime</code>​ which looks much  nicer, and lets you \
control things better.<br>  <br>
        So perhaps the code would work better if it just made <code>'</code>​
        autocorrect to <code>^\prime</code>​ ?<br>
        <br>
        (In fact I've defined my own <code>\pri</code>​ command which
        alters the LaTeX height of the
        <code>\prime</code>​ to one I like more; and ones that use the \
<code>unicode-math</code>​  multi-prime commands
        <code>\dprime</code>​, <code>\tprime</code>​, and \
<code>\qprime</code>​).</div>  </blockquote>
    <p>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).</p>
    <p><br>
    </p>
    <p>Andrew<br>
    </p>
    <blockquote type="cite"
cite="mid:SY7P282MB38980365E9F914833A540D778CBDA@SY7P282MB3898.AUSP282.PROD.OUTLOOK.COM">
  <div class="elementToProof"
style="font-family: &quot;Segoe UI&quot;, &quot;Segoe UI Web (West European)&quot;, \
&quot;Helvetica Neue&quot;, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">  <br>
      </div>
      <div id="Signature">
        <div><span
style="font-family: &quot;Segoe UI&quot;, &quot;Segoe UI Web (West European)&quot;, \
&quot;Helvetica Neue&quot;, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">—  \
Isaac Oscar Gariano​  </span></div>
      </div>
      <hr style="display:inline-block;width:98%" tabindex="-1">
      <div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
          face="Calibri, sans-serif" color="#000000"><b>From:</b>
          lyx-devel <a class="moz-txt-link-rfc2396E" \
href="mailto:lyx-devel-bounces@lists.lyx.org">&lt;lyx-devel-bounces@lists.lyx.org&gt;</a> \
                on behalf of
          Andrew Parsloe <a class="moz-txt-link-rfc2396E" \
href="mailto:ajparsloe@gmail.com">&lt;ajparsloe@gmail.com&gt;</a><br>  <b>Sent:</b> \
                Monday, 27 November 2023 10:10 AM<br>
          <b>To:</b> LyX Developers <a class="moz-txt-link-rfc2396E" \
href="mailto:lyx-devel@lists.lyx.org">&lt;lyx-devel@lists.lyx.org&gt;</a><br>  \
<b>Subject:</b> Primes and superscripts in mathed</font>  <div> </div>
      </div>
      <div>
        <p>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)<br>
        </p>
        <p> S'^{\,-1}_{0i}  or S_{0i}'^{\,-1}<br>
        </p>
        <p>These compile fine in TeX and display as desired but mathed
          turns them into<br>
        </p>
        <p> S'{}_{0i}^{\,-1}  and  S_{0i}'{}^{\,-1}</p>
        <p>which give very different and clearly wrong results in the
          pdf. </p>
        <p>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 ^.  </p>
        <p>[[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.]]</p>
        <p>Andrew<br>
        </p>
        <p>
          <style>div.x_standard
	{margin-bottom:2ex}</style></p>
      </div>
    </blockquote>
  </body>
</html>



-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic