diff options
author | Hans Hagen <pragma@wxs.nl> | 2019-08-09 21:12:52 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2019-08-09 21:12:52 +0200 |
commit | 76a1861b8ff7c2befbc41270833a4a0919c93c30 (patch) | |
tree | 0053915db1de56ac3da2a1415b5447bf66acd81f /tex/context/base/mkiv/back-exp.lua | |
parent | e92fac1b64f7969cadd8ae60f336c43624250d42 (diff) | |
download | context-76a1861b8ff7c2befbc41270833a4a0919c93c30.tar.gz |
2019-08-09 18:36:00
Diffstat (limited to 'tex/context/base/mkiv/back-exp.lua')
-rw-r--r-- | tex/context/base/mkiv/back-exp.lua | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/tex/context/base/mkiv/back-exp.lua b/tex/context/base/mkiv/back-exp.lua index 9b15028bd..b7d5f6b2c 100644 --- a/tex/context/base/mkiv/back-exp.lua +++ b/tex/context/base/mkiv/back-exp.lua @@ -1234,28 +1234,38 @@ do local ndata = #data local roottg = root.tg if roottg == "msubsup" then + -- kind of tricky: we have a diufferent order in display mode local nucleus, superscript, subscript - for i=1,ndata do - local di = data[i] - if not di then - -- weird - elseif di.content then - -- text - elseif not nucleus then - nucleus = i - elseif not superscript then - superscript = i - elseif not subscript then - subscript = i - else - -- error + if ndata > 3 then + -- error + else + for i=1,ndata do + local di = data[i] + if not di then + -- weird + elseif di.content then + -- text + else + local s = specifications[di.fulltag] + if s.subscript then + subscript = i + elseif s.superscript then + superscript = i + else + nucleus = i + end + end + end + if superscript or subscript then + -- we probably always have 3 anyway ... needs checking + local nuc = nucleus and data[nucleus] + local sub = subscript and data[subscript] + local sup = superscript and data[superscript] + local n = 0 -- play safe + if nuc then n = n + 1 ; data[n] = nuc end + if sub then n = n + 1 ; data[n] = sub end + if sup then n = n + 1 ; data[n] = sup end end - end - if superscript and subscript then - local sup, sub = data[superscript], data[subscript] - data[superscript], data[subscript] = sub, sup - -- sub.__o__, sup.__o__ = subscript, superscript - sub.__i__, sup.__i__ = superscript, subscript end -- elseif roottg == "msup" or roottg == "msub" then -- -- m$^2$ |