mathml2latex 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +47 -0
  3. data/Rakefile +19 -0
  4. data/lib/mathml2latex.rb +27 -0
  5. data/lib/mathml2latex/mathml_latex_service.rb +42 -0
  6. data/lib/mathml2latex/symbols.rb +1561 -0
  7. data/lib/mathml2latex/version.rb +3 -0
  8. data/lib/mathml2latex/xslt/elements/menclose.xsl +39 -0
  9. data/lib/mathml2latex/xslt/elements/merror.xsl +8 -0
  10. data/lib/mathml2latex/xslt/elements/mfenced.xsl +64 -0
  11. data/lib/mathml2latex/xslt/elements/mfrac.xsl +56 -0
  12. data/lib/mathml2latex/xslt/elements/mi_mn_mo_mtext_ms.xsl +199 -0
  13. data/lib/mathml2latex/xslt/elements/mmultiscripts.xsl +61 -0
  14. data/lib/mathml2latex/xslt/elements/mover.xsl +66 -0
  15. data/lib/mathml2latex/xslt/elements/mphantom.xsl +10 -0
  16. data/lib/mathml2latex/xslt/elements/mroot.xsl +21 -0
  17. data/lib/mathml2latex/xslt/elements/mrow.xsl +8 -0
  18. data/lib/mathml2latex/xslt/elements/mspace.xsl +24 -0
  19. data/lib/mathml2latex/xslt/elements/msqrt.xsl +10 -0
  20. data/lib/mathml2latex/xslt/elements/mstyle.xsl +39 -0
  21. data/lib/mathml2latex/xslt/elements/msub.xsl +12 -0
  22. data/lib/mathml2latex/xslt/elements/msubsup.xsl +14 -0
  23. data/lib/mathml2latex/xslt/elements/msup.xsl +12 -0
  24. data/lib/mathml2latex/xslt/elements/mtable.xsl +86 -0
  25. data/lib/mathml2latex/xslt/elements/mtd.xsl +30 -0
  26. data/lib/mathml2latex/xslt/elements/mtr.xsl +11 -0
  27. data/lib/mathml2latex/xslt/elements/munder.xsl +73 -0
  28. data/lib/mathml2latex/xslt/elements/munderover.xsl +92 -0
  29. data/lib/mathml2latex/xslt/includes.xsl +30 -0
  30. data/lib/mathml2latex/xslt/mml2latex.xsl +30 -0
  31. data/lib/mathml2latex/xslt/shared/color.xsl +117 -0
  32. data/lib/mathml2latex/xslt_functions.rb +29 -0
  33. data/spec/fixtures/basic/aligned_equations.xml +37 -0
  34. data/spec/fixtures/basic/arrow_accent.xml +11 -0
  35. data/spec/fixtures/basic/backspace.xml +6 -0
  36. data/spec/fixtures/basic/bottom_parenthesis.xml +12 -0
  37. data/spec/fixtures/basic/definite_integral_with_differential.xml +17 -0
  38. data/spec/fixtures/basic/digit_space.xml +6 -0
  39. data/spec/fixtures/basic/double_vertical_bars.xml +10 -0
  40. data/spec/fixtures/basic/element_over.xml +15 -0
  41. data/spec/fixtures/basic/element_under.xml +17 -0
  42. data/spec/fixtures/basic/element_under_over.xml +23 -0
  43. data/spec/fixtures/basic/enclose_box_matrix.xml +28 -0
  44. data/spec/fixtures/basic/enclose_left.xml +9 -0
  45. data/spec/fixtures/basic/enclose_right.xml +8 -0
  46. data/spec/fixtures/basic/fraction.xml +6 -0
  47. data/spec/fixtures/basic/greek.xml +30 -0
  48. data/spec/fixtures/basic/left_right_arrow_accent.xml +12 -0
  49. data/spec/fixtures/basic/left_subscript.xml +15 -0
  50. data/spec/fixtures/basic/left_super_sub_script.xml +21 -0
  51. data/spec/fixtures/basic/left_superscript.xml +15 -0
  52. data/spec/fixtures/basic/matrix.xml +26 -0
  53. data/spec/fixtures/basic/matrix_bottom_curly_bracket.xml +32 -0
  54. data/spec/fixtures/basic/matrix_curly_brackets.xml +30 -0
  55. data/spec/fixtures/basic/matrix_parenthesis.xml +28 -0
  56. data/spec/fixtures/basic/matrix_square_brackets.xml +30 -0
  57. data/spec/fixtures/basic/matrix_top_curly_bracket.xml +32 -0
  58. data/spec/fixtures/basic/matrix_with_vertical_bar.xml +30 -0
  59. data/spec/fixtures/basic/n_root.xml +6 -0
  60. data/spec/fixtures/basic/over_script_with_brace.xml +18 -0
  61. data/spec/fixtures/basic/parenthesis.xml +9 -0
  62. data/spec/fixtures/basic/piecewise_function.xml +22 -0
  63. data/spec/fixtures/basic/square_root.xml +5 -0
  64. data/spec/fixtures/basic/subscript.xml +13 -0
  65. data/spec/fixtures/basic/subscript_with_big_operator.xml +10 -0
  66. data/spec/fixtures/basic/sum_over_under.xml +13 -0
  67. data/spec/fixtures/basic/sum_super_sub.xml +9 -0
  68. data/spec/fixtures/basic/super_sub_script.xml +18 -0
  69. data/spec/fixtures/basic/super_sub_script_big_operator.xml +18 -0
  70. data/spec/fixtures/basic/superscript.xml +9 -0
  71. data/spec/fixtures/basic/top_parenthesis.xml +6 -0
  72. data/spec/fixtures/basic/under_script_with_brace.xml +18 -0
  73. data/spec/fixtures/basic/vector_accent.xml +13 -0
  74. data/spec/fixtures/complex/sum_with_nested_matrix.xml +79 -0
  75. data/spec/lib/mathml2latex/mathml_latex_service_spec.rb +383 -0
  76. data/spec/lib/mathml2latex/xslt_functions_spec.rb +39 -0
  77. data/spec/mathml2latex_spec.rb +52 -0
  78. data/spec/spec_helper.rb +15 -0
  79. metadata +257 -0
@@ -0,0 +1,30 @@
1
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
2
+ <mi>&#x3B1;</mi>
3
+ <mi>&#x3B2;</mi>
4
+ <mi>&#x3B3;</mi>
5
+ <mi>&#x3B4;</mi>
6
+ <mi>&#x3B5;</mi>
7
+ <mi>&#x3B6;</mi>
8
+ <mi>&#x3B7;</mi>
9
+ <mi>&#x3B8;</mi>
10
+ <mi>&#x3D1;</mi>
11
+ <mi>&#x3B9;</mi>
12
+ <mi>&#x3BA;</mi>
13
+ <mi>&#x3BB;</mi>
14
+ <mi>&#x3BC;</mi>
15
+ <mi>&#x3BD;</mi>
16
+ <mi>&#x3BE;</mi>
17
+ <mi>&#x3BF;</mi>
18
+ <mi>&#x3C0;</mi>
19
+ <mi>&#x3D6;</mi>
20
+ <mi>&#x3C1;</mi>
21
+ <mi>&#x3C2;</mi>
22
+ <mi>&#x3C3;</mi>
23
+ <mi>&#x3C4;</mi>
24
+ <mi>&#x3C5;</mi>
25
+ <mi>&#x3C6;</mi>
26
+ <mi>&#x3D5;</mi>
27
+ <mi>&#x3C7;</mi>
28
+ <mi>&#x3C8;</mi>
29
+ <mi>&#x3C9;</mi>
30
+ </math>
@@ -0,0 +1,12 @@
1
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
2
+ <mover>
3
+ <mrow>
4
+ <mi>a</mi>
5
+ <mi>b</mi>
6
+ <mi>c</mi>
7
+ <mi>d</mi>
8
+ <mi>e</mi>
9
+ </mrow>
10
+ <mo>↔</mo>
11
+ </mover>
12
+ </math>
@@ -0,0 +1,15 @@
1
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
2
+ <mmultiscripts>
3
+ <mi>b</mi>
4
+ <mprescripts />
5
+ <mrow>
6
+ <mi>s</mi>
7
+ <mi>u</mi>
8
+ <mi>b</mi>
9
+ </mrow>
10
+ <none />
11
+ </mmultiscripts>
12
+ <mi>a</mi>
13
+ <mi>s</mi>
14
+ <mi>e</mi>
15
+ </math>
@@ -0,0 +1,21 @@
1
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
2
+ <mmultiscripts>
3
+ <mi>b</mi>
4
+ <mprescripts/>
5
+ <mrow>
6
+ <mi>s</mi>
7
+ <mi>u</mi>
8
+ <mi>b</mi>
9
+ </mrow>
10
+ <mrow>
11
+ <mi>s</mi>
12
+ <mi>u</mi>
13
+ <mi>p</mi>
14
+ <mi>e</mi>
15
+ <mi>r</mi>
16
+ </mrow>
17
+ </mmultiscripts>
18
+ <mi>a</mi>
19
+ <mi>s</mi>
20
+ <mi>e</mi>
21
+ </math>
@@ -0,0 +1,15 @@
1
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
2
+ <mmultiscripts>
3
+ <mi>b</mi>
4
+ <mprescripts/>
5
+ <none/>
6
+ <mrow>
7
+ <mi>s</mi>
8
+ <mi>u</mi>
9
+ <mi>p</mi>
10
+ </mrow>
11
+ </mmultiscripts>
12
+ <mi>a</mi>
13
+ <mi>s</mi>
14
+ <mi>e</mi>
15
+ </math>
@@ -0,0 +1,26 @@
1
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
2
+ <mtable>
3
+ <mtr>
4
+ <mtd>
5
+ <mn>11</mn>
6
+ </mtd>
7
+ <mtd>
8
+ <mn>12</mn>
9
+ </mtd>
10
+ <mtd>
11
+ <mn>13</mn>
12
+ </mtd>
13
+ </mtr>
14
+ <mtr>
15
+ <mtd>
16
+ <mn>21</mn>
17
+ </mtd>
18
+ <mtd>
19
+ <mn>22</mn>
20
+ </mtd>
21
+ <mtd>
22
+ <mn>23</mn>
23
+ </mtd>
24
+ </mtr>
25
+ </mtable>
26
+ </math>
@@ -0,0 +1,32 @@
1
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
2
+ <munder>
3
+ <mtable>
4
+ <mtr>
5
+ <mtd>
6
+ <mn>11</mn>
7
+ </mtd>
8
+ <mtd>
9
+ <mn>22</mn>
10
+ </mtd>
11
+ <mtd>
12
+ <mn>33</mn>
13
+ </mtd>
14
+ </mtr>
15
+ <mtr>
16
+ <mtd>
17
+ <mi>a</mi>
18
+ <mi>a</mi>
19
+ </mtd>
20
+ <mtd>
21
+ <mi>b</mi>
22
+ <mi>b</mi>
23
+ </mtd>
24
+ <mtd>
25
+ <mi>c</mi>
26
+ <mi>c</mi>
27
+ </mtd>
28
+ </mtr>
29
+ </mtable>
30
+ <mo>⏟</mo>
31
+ </munder>
32
+ </math>
@@ -0,0 +1,30 @@
1
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
2
+ <mfenced open="{" close="}">
3
+ <mtable>
4
+ <mtr>
5
+ <mtd>
6
+ <mn>11</mn>
7
+ </mtd>
8
+ <mtd>
9
+ <mn>22</mn>
10
+ </mtd>
11
+ </mtr>
12
+ <mtr>
13
+ <mtd>
14
+ <mn>33</mn>
15
+ </mtd>
16
+ <mtd>
17
+ <mn>44</mn>
18
+ </mtd>
19
+ </mtr>
20
+ <mtr>
21
+ <mtd>
22
+ <mn>55</mn>
23
+ </mtd>
24
+ <mtd>
25
+ <mn>66</mn>
26
+ </mtd>
27
+ </mtr>
28
+ </mtable>
29
+ </mfenced>
30
+ </math>
@@ -0,0 +1,28 @@
1
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
2
+ <mfenced>
3
+ <mtable>
4
+ <mtr>
5
+ <mtd>
6
+ <mn>11</mn>
7
+ </mtd>
8
+ <mtd>
9
+ <mn>12</mn>
10
+ </mtd>
11
+ <mtd>
12
+ <mn>13</mn>
13
+ </mtd>
14
+ </mtr>
15
+ <mtr>
16
+ <mtd>
17
+ <mn>21</mn>
18
+ </mtd>
19
+ <mtd>
20
+ <mn>22</mn>
21
+ </mtd>
22
+ <mtd>
23
+ <mn>23</mn>
24
+ </mtd>
25
+ </mtr>
26
+ </mtable>
27
+ </mfenced>
28
+ </math>
@@ -0,0 +1,30 @@
1
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
2
+ <mfenced open="[" close="]">
3
+ <mtable>
4
+ <mtr>
5
+ <mtd>
6
+ <mn>11</mn>
7
+ </mtd>
8
+ <mtd>
9
+ <mn>12</mn>
10
+ </mtd>
11
+ </mtr>
12
+ <mtr>
13
+ <mtd>
14
+ <mn>21</mn>
15
+ </mtd>
16
+ <mtd>
17
+ <mn>22</mn>
18
+ </mtd>
19
+ </mtr>
20
+ <mtr>
21
+ <mtd>
22
+ <mn>31</mn>
23
+ </mtd>
24
+ <mtd>
25
+ <mn>32</mn>
26
+ </mtd>
27
+ </mtr>
28
+ </mtable>
29
+ </mfenced>
30
+ </math>
@@ -0,0 +1,32 @@
1
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
2
+ <mover>
3
+ <mtable>
4
+ <mtr>
5
+ <mtd>
6
+ <mn>11</mn>
7
+ </mtd>
8
+ <mtd>
9
+ <mn>22</mn>
10
+ </mtd>
11
+ <mtd>
12
+ <mn>33</mn>
13
+ </mtd>
14
+ </mtr>
15
+ <mtr>
16
+ <mtd>
17
+ <mi>a</mi>
18
+ <mi>a</mi>
19
+ </mtd>
20
+ <mtd>
21
+ <mi>b</mi>
22
+ <mi>b</mi>
23
+ </mtd>
24
+ <mtd>
25
+ <mi>c</mi>
26
+ <mi>c</mi>
27
+ </mtd>
28
+ </mtr>
29
+ </mtable>
30
+ <mo>⏞</mo>
31
+ </mover>
32
+ </math>
@@ -0,0 +1,30 @@
1
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
2
+ <mfenced open="|" close="|">
3
+ <mtable>
4
+ <mtr>
5
+ <mtd>
6
+ <mn>11</mn>
7
+ </mtd>
8
+ <mtd>
9
+ <mn>22</mn>
10
+ </mtd>
11
+ </mtr>
12
+ <mtr>
13
+ <mtd>
14
+ <mn>33</mn>
15
+ </mtd>
16
+ <mtd>
17
+ <mn>44</mn>
18
+ </mtd>
19
+ </mtr>
20
+ <mtr>
21
+ <mtd>
22
+ <mn>55</mn>
23
+ </mtd>
24
+ <mtd>
25
+ <mn>66</mn>
26
+ </mtd>
27
+ </mtr>
28
+ </mtable>
29
+ </mfenced>
30
+ </math>
@@ -0,0 +1,6 @@
1
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
2
+ <mroot>
3
+ <mi>b</mi>
4
+ <mi>a</mi>
5
+ </mroot>
6
+ </math>
@@ -0,0 +1,18 @@
1
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
2
+ <mover>
3
+ <mover>
4
+ <mrow>
5
+ <mi>b</mi>
6
+ <mi>a</mi>
7
+ <mi>s</mi>
8
+ <mi>e</mi>
9
+ </mrow>
10
+ <mo>⏞</mo>
11
+ </mover>
12
+ <mrow>
13
+ <mi>t</mi>
14
+ <mi>o</mi>
15
+ <mi>p</mi>
16
+ </mrow>
17
+ </mover>
18
+ </math>
@@ -0,0 +1,9 @@
1
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
2
+ <mfenced>
3
+ <mrow>
4
+ <mi>w</mi>
5
+ <mi>w</mi>
6
+ <mi>w</mi>
7
+ </mrow>
8
+ </mfenced>
9
+ </math>
@@ -0,0 +1,22 @@
1
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
2
+ <mfenced open="{" close="">
3
+ <mtable columnspacing="1.4ex" columnalign="left">
4
+ <mtr>
5
+ <mtd>
6
+ <mn>11</mn>
7
+ </mtd>
8
+ <mtd>
9
+ <mn>22</mn>
10
+ </mtd>
11
+ </mtr>
12
+ <mtr>
13
+ <mtd>
14
+ <mn>33</mn>
15
+ </mtd>
16
+ <mtd>
17
+ <mn>44</mn>
18
+ </mtd>
19
+ </mtr>
20
+ </mtable>
21
+ </mfenced>
22
+ </math>
@@ -0,0 +1,5 @@
1
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
2
+ <msqrt>
3
+ <mi>ss</mi>
4
+ </msqrt>
5
+ </math>
@@ -0,0 +1,13 @@
1
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
2
+ <mi>b</mi>
3
+ <mi>a</mi>
4
+ <mi>s</mi>
5
+ <msub>
6
+ <mi>e</mi>
7
+ <mrow>
8
+ <mi>s</mi>
9
+ <mi>u</mi>
10
+ <mi>b</mi>
11
+ </mrow>
12
+ </msub>
13
+ </math>
@@ -0,0 +1,10 @@
1
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
2
+ <msub>
3
+ <mo largeop="true">base</mo>
4
+ <mrow>
5
+ <mi>s</mi>
6
+ <mi>u</mi>
7
+ <mi>b</mi>
8
+ </mrow>
9
+ </msub>
10
+ </math>
@@ -0,0 +1,13 @@
1
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
2
+ <munderover>
3
+ <mo>&#x2211;</mo>
4
+ <mrow>
5
+ <mi>a</mi>
6
+ <mi>a</mi>
7
+ </mrow>
8
+ <mrow>
9
+ <mi>b</mi>
10
+ <mi>b</mi>
11
+ </mrow>
12
+ </munderover>
13
+ </math>
@@ -0,0 +1,9 @@
1
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
2
+ <mstyle displaystyle="false">
3
+ <munderover>
4
+ <mo>&#x2211;</mo>
5
+ <mn>67</mn>
6
+ <mn>12</mn>
7
+ </munderover>
8
+ </mstyle>
9
+ </math>