mathup icon indicating copy to clipboard operation
mathup copied to clipboard

Prescripts and postscripts

Open runarberg opened this issue 2 years ago • 0 comments

Currently it is possible to write prescripts and postscripts (e.g. tensors) using empty groups {::}_a{::}^b C {::}_d {::}^e. Not only is the syntax clunky, but the markup this generates is wrong which might have accessibility implication.

Proposal

A proposed tensor notation would fix that:

  • All groups that start with ^ or _ will be parsed as pre- or postscripts.
  • Any ^ within the group will start a new upper index and any _ will start a lower index.
  • , will skip to the next index position. That is without the comma, a lower and upper index are allowed in the same index position, with it you can move straight to the next position (see examples).
  • If preceded by a whitespace (or first in a group/sentence) the group will be prescripts, otherwise it will be postscripts.

Examples

(^a_b^c_d)E(^f_g^h_i)

(^a_b^c_d)E(^f_g^h_i)
<mmultiscripts>
  <mi>E</mi>

  <mi>g</mi>
  <mi>f</mi>

  <mi>i</mi>
  <mi>h</mi>

  <mprescripts />

  <mi>b</mi>
  <mi>a</mi>

  <mi>d</mi>
  <mi>c</mi>
</mmultiscripts>

Use , to skip to next index position (i.e. normal tensor indices).

(_a,^b,_c,^d)E(^f,_g,^h,_i)

(_a,^b,_c,^d)E(^f,_g,^h,_i)
<mmultiscripts>
  <mi>E</mi>

  <mrow></mrow>
  <mi>f</mi>

  <mi>g</mi>
  <mrow></mrow>

  <mrow></mrow>
  <mi>h</mi>

  <mi>i</mi>
  <mrow></mrow>

  <mprescripts />

  <mi>a</mi>
  <mrow></mrow>

  <mrow></mrow>
  <mi>b</mi>

  <mrow></mrow>
  <mrow></mrow>

  <mi>c</mi>
  <mrow></mrow>

  <mrow></mrow>
  <mi>d</mi>
</mmultiscripts>

Gamma(^mu, _nu, _rho)

Gamma(^mu, _nu, _rho)
<mmultiscripts>
  <mi mathvariant="normal">Γ</mi>

  <mrow></mrow>
  <mi>μ</mi>

  <mi>ν</mi>
  <mrow></mrow>

  <mi>ρ</mi>
  <mrow></mrow>
</mmultiscripts>

(^14_6)rm C

(^14_6)rm C
<mmultiscripts>
  <mi mathvariant="normal">C</mi>
  <mprescripts />
  <mi>6</mi>
  <mi>14</mi>
</mmultiscripts>

runarberg avatar Dec 02 '23 22:12 runarberg