Skip to content

Commit 87f05f4

Browse files
committed
MathML writer: use upright style for uppercase Greek by default.
Closes #255.
1 parent 321fc91 commit 87f05f4

File tree

13 files changed

+48
-45
lines changed

13 files changed

+48
-45
lines changed

src/Text/TeXMath/Writers/MathML.hs

+5-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import Text.XML.Light
2828
import Text.TeXMath.Types
2929
import Text.TeXMath.Unicode.ToUnicode
3030
import Data.Generics (everywhere, mkT)
31-
import Text.TeXMath.Shared (getMMLType, handleDownup)
31+
import Text.TeXMath.Shared (getMMLType, handleDownup, isUppercaseGreek)
3232
import Text.TeXMath.Readers.MathML.MMLDict (getMathMLOperator)
3333
import qualified Data.Text as T
3434
import Text.Printf
@@ -158,7 +158,10 @@ showExp tt e =
158158
vnode :: String -> T.Text -> Element
159159
vnode elname t
160160
= case tt of
161-
Nothing -> tunode elname t
161+
Nothing ->
162+
if isUppercaseGreek t -- see #255
163+
then withAttribute "mathvariant" "normal" $ tunode elname t
164+
else tunode elname t
162165
Just TextNormal -> withAttribute "mathvariant" "normal" $
163166
tunode elname t
164167
Just textStyle ->

test/writer/mml/00370_Greek_and_Coptic.test

+24-24
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@
248248
<mi>ΐ</mi>
249249
</mtd>
250250
<mtd columnalign="center" style="text-align: center">
251-
<mo>Π</mo>
251+
<mo mathvariant="normal">Π</mo>
252252
</mtd>
253253
<mtd columnalign="center" style="text-align: center">
254254
<mi>ΰ</mi>
@@ -277,10 +277,10 @@
277277
<mi>@</mi>
278278
</mtd>
279279
<mtd columnalign="center" style="text-align: center">
280-
<mo>Α</mo>
280+
<mo mathvariant="normal">Α</mo>
281281
</mtd>
282282
<mtd columnalign="center" style="text-align: center">
283-
<mo>Ρ</mo>
283+
<mo mathvariant="normal">Ρ</mo>
284284
</mtd>
285285
<mtd columnalign="center" style="text-align: center">
286286
<mo>α</mo>
@@ -309,7 +309,7 @@
309309
<mi>@</mi>
310310
</mtd>
311311
<mtd columnalign="center" style="text-align: center">
312-
<mo>Β</mo>
312+
<mo mathvariant="normal">Β</mo>
313313
</mtd>
314314
<mtd columnalign="center" style="text-align: center">
315315
<mi>@</mi>
@@ -341,10 +341,10 @@
341341
<mi>@</mi>
342342
</mtd>
343343
<mtd columnalign="center" style="text-align: center">
344-
<mo>Γ</mo>
344+
<mo mathvariant="normal">Γ</mo>
345345
</mtd>
346346
<mtd columnalign="center" style="text-align: center">
347-
<mo>Σ</mo>
347+
<mo mathvariant="normal">Σ</mo>
348348
</mtd>
349349
<mtd columnalign="center" style="text-align: center">
350350
<mo>γ</mo>
@@ -373,10 +373,10 @@
373373
<mi>΄</mi>
374374
</mtd>
375375
<mtd columnalign="center" style="text-align: center">
376-
<mo>Δ</mo>
376+
<mo mathvariant="normal">Δ</mo>
377377
</mtd>
378378
<mtd columnalign="center" style="text-align: center">
379-
<mo>Τ</mo>
379+
<mo mathvariant="normal">Τ</mo>
380380
</mtd>
381381
<mtd columnalign="center" style="text-align: center">
382382
<mo>δ</mo>
@@ -405,10 +405,10 @@
405405
<mi>΅</mi>
406406
</mtd>
407407
<mtd columnalign="center" style="text-align: center">
408-
<mo>Ε</mo>
408+
<mo mathvariant="normal">Ε</mo>
409409
</mtd>
410410
<mtd columnalign="center" style="text-align: center">
411-
<mo>Υ</mo>
411+
<mo mathvariant="normal">Υ</mo>
412412
</mtd>
413413
<mtd columnalign="center" style="text-align: center">
414414
<mo>ε</mo>
@@ -437,10 +437,10 @@
437437
<mi>Ά</mi>
438438
</mtd>
439439
<mtd columnalign="center" style="text-align: center">
440-
<mo>Ζ</mo>
440+
<mo mathvariant="normal">Ζ</mo>
441441
</mtd>
442442
<mtd columnalign="center" style="text-align: center">
443-
<mo>Φ</mo>
443+
<mo mathvariant="normal">Φ</mo>
444444
</mtd>
445445
<mtd columnalign="center" style="text-align: center">
446446
<mo>ζ</mo>
@@ -469,10 +469,10 @@
469469
<mi>·</mi>
470470
</mtd>
471471
<mtd columnalign="center" style="text-align: center">
472-
<mo>Η</mo>
472+
<mo mathvariant="normal">Η</mo>
473473
</mtd>
474474
<mtd columnalign="center" style="text-align: center">
475-
<mo>Χ</mo>
475+
<mo mathvariant="normal">Χ</mo>
476476
</mtd>
477477
<mtd columnalign="center" style="text-align: center">
478478
<mo>η</mo>
@@ -501,10 +501,10 @@
501501
<mi>Έ</mi>
502502
</mtd>
503503
<mtd columnalign="center" style="text-align: center">
504-
<mo>Θ</mo>
504+
<mo mathvariant="normal">Θ</mo>
505505
</mtd>
506506
<mtd columnalign="center" style="text-align: center">
507-
<mo>Ψ</mo>
507+
<mo mathvariant="normal">Ψ</mo>
508508
</mtd>
509509
<mtd columnalign="center" style="text-align: center">
510510
<mo>θ</mo>
@@ -533,10 +533,10 @@
533533
<mi>Ή</mi>
534534
</mtd>
535535
<mtd columnalign="center" style="text-align: center">
536-
<mo>Ι</mo>
536+
<mo mathvariant="normal">Ι</mo>
537537
</mtd>
538538
<mtd columnalign="center" style="text-align: center">
539-
<mo>Ω</mo>
539+
<mo mathvariant="normal">Ω</mo>
540540
</mtd>
541541
<mtd columnalign="center" style="text-align: center">
542542
<mo>ι</mo>
@@ -565,7 +565,7 @@
565565
<mi>Ί</mi>
566566
</mtd>
567567
<mtd columnalign="center" style="text-align: center">
568-
<mo>Κ</mo>
568+
<mo mathvariant="normal">Κ</mo>
569569
</mtd>
570570
<mtd columnalign="center" style="text-align: center">
571571
<mi>Ϊ</mi>
@@ -597,7 +597,7 @@
597597
<mi>@</mi>
598598
</mtd>
599599
<mtd columnalign="center" style="text-align: center">
600-
<mo>Λ</mo>
600+
<mo mathvariant="normal">Λ</mo>
601601
</mtd>
602602
<mtd columnalign="center" style="text-align: center">
603603
<mi>Ϋ</mi>
@@ -629,7 +629,7 @@
629629
<mi>Ό</mi>
630630
</mtd>
631631
<mtd columnalign="center" style="text-align: center">
632-
<mo>Μ</mo>
632+
<mo mathvariant="normal">Μ</mo>
633633
</mtd>
634634
<mtd columnalign="center" style="text-align: center">
635635
<mi>ά</mi>
@@ -661,7 +661,7 @@
661661
<mi>@</mi>
662662
</mtd>
663663
<mtd columnalign="center" style="text-align: center">
664-
<mo>Ν</mo>
664+
<mo mathvariant="normal">Ν</mo>
665665
</mtd>
666666
<mtd columnalign="center" style="text-align: center">
667667
<mi>έ</mi>
@@ -693,7 +693,7 @@
693693
<mi>Ύ</mi>
694694
</mtd>
695695
<mtd columnalign="center" style="text-align: center">
696-
<mo>Ξ</mo>
696+
<mo mathvariant="normal">Ξ</mo>
697697
</mtd>
698698
<mtd columnalign="center" style="text-align: center">
699699
<mi>ή</mi>
@@ -725,7 +725,7 @@
725725
<mi>Ώ</mi>
726726
</mtd>
727727
<mtd columnalign="center" style="text-align: center">
728-
<mo>Ο</mo>
728+
<mo mathvariant="normal">Ο</mo>
729729
</mtd>
730730
<mtd columnalign="center" style="text-align: center">
731731
<mi>ί</mi>

test/writer/mml/complex3.test

+6-6
Original file line numberDiff line numberDiff line change
@@ -10078,7 +10078,7 @@
1007810078
<mtr>
1007910079
<mtd columnalign="center" style="text-align: center">
1008010080
<msubsup>
10081-
<mi>Γ</mi>
10081+
<mi mathvariant="normal">Γ</mi>
1008210082
<msubsup>
1008310083
<mn>1</mn>
1008410084
<msup>
@@ -11238,7 +11238,7 @@
1123811238
<mi>λ</mi>
1123911239
<mo>;</mo>
1124011240
<msup>
11241-
<mi>Ω</mi>
11241+
<mi mathvariant="normal">Ω</mi>
1124211242
<mi>′</mi>
1124311243
</msup>
1124411244
</mrow>
@@ -11255,7 +11255,7 @@
1125511255
<mi>λ</mi>
1125611256
<mo>;</mo>
1125711257
<msup>
11258-
<mi>Ω</mi>
11258+
<mi mathvariant="normal">Ω</mi>
1125911259
<mi>′</mi>
1126011260
</msup>
1126111261
</mrow>
@@ -11287,7 +11287,7 @@
1128711287
<mi>λ</mi>
1128811288
<mo>;</mo>
1128911289
<msup>
11290-
<mi>Ω</mi>
11290+
<mi mathvariant="normal">Ω</mi>
1129111291
<mi>′</mi>
1129211292
</msup>
1129311293
</mrow>
@@ -11303,7 +11303,7 @@
1130311303
<mrow>
1130411304
<mi>λ</mi>
1130511305
<mo>;</mo>
11306-
<mi>Ω</mi>
11306+
<mi mathvariant="normal">Ω</mi>
1130711307
</mrow>
1130811308
<mo stretchy="false" form="postfix">)</mo>
1130911309
</mrow>
@@ -13247,7 +13247,7 @@
1324713247
</mrow>
1324813248
<mi>&#8290;</mi>
1324913249
<mrow>
13250-
<mo>Δ</mo>
13250+
<mo mathvariant="normal">Δ</mo>
1325113251
<msub>
1325213252
<mi>x</mi>
1325313253
<mi>i</mi>

test/writer/mml/d.test

+1-1
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@
406406
<mtext mathvariant="normal">Delta</mtext>
407407
</mtd>
408408
<mtd columnalign="center" style="text-align: center">
409-
<mo>Δ</mo>
409+
<mo mathvariant="normal">Δ</mo>
410410
</mtd>
411411
</mtr>
412412
<mtr>

test/writer/mml/g.test

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
<mtext mathvariant="normal">Gamma</mtext>
118118
</mtd>
119119
<mtd columnalign="center" style="text-align: center">
120-
<mo>Γ</mo>
120+
<mo mathvariant="normal">Γ</mo>
121121
</mtd>
122122
</mtr>
123123
<mtr>

test/writer/mml/l.test

+1-1
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@
364364
<mtext mathvariant="normal">Lambda</mtext>
365365
</mtd>
366366
<mtd columnalign="center" style="text-align: center">
367-
<mo>Λ</mo>
367+
<mo mathvariant="normal">Λ</mo>
368368
</mtd>
369369
</mtr>
370370
<mtr>

test/writer/mml/miSfonts8.test

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<mo>+</mo>
2424
<mi>f</mi>
2525
<mo>+</mo>
26-
<mi>Γ</mi>
26+
<mi mathvariant="normal">Γ</mi>
2727
<mo>+</mo>
2828
<mi>d</mi>
2929
</mrow>

test/writer/mml/o.test

+2-2
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@
285285
<mtext mathvariant="normal">ohm</mtext>
286286
</mtd>
287287
<mtd columnalign="center" style="text-align: center">
288-
<mo>Ω</mo>
288+
<mo mathvariant="normal">Ω</mo>
289289
</mtd>
290290
</mtr>
291291
<mtr>
@@ -357,7 +357,7 @@
357357
<mtext mathvariant="normal">Omega</mtext>
358358
</mtd>
359359
<mtd columnalign="center" style="text-align: center">
360-
<mo>Ω</mo>
360+
<mo mathvariant="normal">Ω</mo>
361361
</mtd>
362362
</mtr>
363363
<mtr>

test/writer/mml/p.test

+3-3
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@
241241
<mtext mathvariant="normal">Phi</mtext>
242242
</mtd>
243243
<mtd columnalign="center" style="text-align: center">
244-
<mo>Φ</mo>
244+
<mo mathvariant="normal">Φ</mo>
245245
</mtd>
246246
</mtr>
247247
<mtr>
@@ -281,7 +281,7 @@
281281
<mtext mathvariant="normal">Pi</mtext>
282282
</mtd>
283283
<mtd columnalign="center" style="text-align: center">
284-
<mo>Π</mo>
284+
<mo mathvariant="normal">Π</mo>
285285
</mtd>
286286
</mtr>
287287
<mtr>
@@ -769,7 +769,7 @@
769769
<mtext mathvariant="normal">Psi</mtext>
770770
</mtd>
771771
<mtd columnalign="center" style="text-align: center">
772-
<mo>Ψ</mo>
772+
<mo mathvariant="normal">Ψ</mo>
773773
</mtd>
774774
</mtr>
775775
<mtr>

test/writer/mml/s.test

+1-1
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@
636636
<mtext mathvariant="normal">Sigma</mtext>
637637
</mtd>
638638
<mtd columnalign="center" style="text-align: center">
639-
<mo>Σ</mo>
639+
<mo mathvariant="normal">Σ</mo>
640640
</mtd>
641641
</mtr>
642642
<mtr>

test/writer/mml/t.test

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@
245245
<mtext mathvariant="normal">Theta</mtext>
246246
</mtd>
247247
<mtd columnalign="center" style="text-align: center">
248-
<mo>Θ</mo>
248+
<mo mathvariant="normal">Θ</mo>
249249
</mtd>
250250
</mtr>
251251
<mtr>

test/writer/mml/u.test

+1-1
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@
600600
<mtext mathvariant="normal">Upsilon</mtext>
601601
</mtd>
602602
<mtd columnalign="center" style="text-align: center">
603-
<mo>Υ</mo>
603+
<mo mathvariant="normal">Υ</mo>
604604
</mtd>
605605
</mtr>
606606
<mtr>

test/writer/mml/x.test

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
<mtext mathvariant="normal">Xi</mtext>
113113
</mtd>
114114
<mtd columnalign="center" style="text-align: center">
115-
<mo>Ξ</mo>
115+
<mo mathvariant="normal">Ξ</mo>
116116
</mtd>
117117
</mtr>
118118
<mtr>

0 commit comments

Comments
 (0)