plurimath 0.7.2 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitmodules +3 -0
- data/Latex-Supported-Data.adoc +1 -0
- data/UnicodeMath-Supported-Data.adoc +1342 -0
- data/UnitsML-Supported-Data.adoc +444 -0
- data/lib/plurimath/asciimath/parse.rb +1 -1
- data/lib/plurimath/asciimath/transform.rb +2 -6
- data/lib/plurimath/latex/constants.rb +2 -0
- data/lib/plurimath/math/core.rb +38 -6
- data/lib/plurimath/math/formula.rb +60 -6
- data/lib/plurimath/math/function/abs.rb +4 -0
- data/lib/plurimath/math/function/arg.rb +22 -0
- data/lib/plurimath/math/function/bar.rb +4 -0
- data/lib/plurimath/math/function/base.rb +49 -0
- data/lib/plurimath/math/function/binary_function.rb +6 -0
- data/lib/plurimath/math/function/cancel.rb +5 -0
- data/lib/plurimath/math/function/ceil.rb +6 -0
- data/lib/plurimath/math/function/color.rb +20 -1
- data/lib/plurimath/math/function/ddot.rb +4 -0
- data/lib/plurimath/math/function/dot.rb +5 -0
- data/lib/plurimath/math/function/fenced.rb +98 -7
- data/lib/plurimath/math/function/floor.rb +6 -0
- data/lib/plurimath/math/function/font_style/monospace.rb +4 -0
- data/lib/plurimath/math/function/font_style.rb +31 -6
- data/lib/plurimath/math/function/frac.rb +69 -15
- data/lib/plurimath/math/function/hat.rb +4 -0
- data/lib/plurimath/math/function/inf.rb +30 -0
- data/lib/plurimath/math/function/int.rb +47 -1
- data/lib/plurimath/math/function/intent.rb +22 -0
- data/lib/plurimath/math/function/left.rb +4 -0
- data/lib/plurimath/math/function/lim.rb +6 -0
- data/lib/plurimath/math/function/limits.rb +28 -0
- data/lib/plurimath/math/function/linebreak.rb +5 -0
- data/lib/plurimath/math/function/log.rb +27 -20
- data/lib/plurimath/math/function/longdiv.rb +4 -0
- data/lib/plurimath/math/function/mbox.rb +4 -0
- data/lib/plurimath/math/function/menclose.rb +74 -5
- data/lib/plurimath/math/function/merror.rb +2 -0
- data/lib/plurimath/math/function/mglyph.rb +64 -0
- data/lib/plurimath/math/function/mlabeledtr.rb +29 -0
- data/lib/plurimath/math/function/mod.rb +4 -0
- data/lib/plurimath/math/function/mpadded.rb +84 -0
- data/lib/plurimath/math/function/ms.rb +33 -0
- data/lib/plurimath/math/function/msgroup.rb +4 -0
- data/lib/plurimath/math/function/msline.rb +2 -4
- data/lib/plurimath/math/function/multiscript.rb +70 -6
- data/lib/plurimath/math/function/nary.rb +69 -10
- data/lib/plurimath/math/function/none.rb +25 -0
- data/lib/plurimath/math/function/norm.rb +6 -0
- data/lib/plurimath/math/function/obrace.rb +4 -0
- data/lib/plurimath/math/function/oint.rb +25 -1
- data/lib/plurimath/math/function/over.rb +6 -0
- data/lib/plurimath/math/function/overset.rb +46 -1
- data/lib/plurimath/math/function/phantom.rb +18 -2
- data/lib/plurimath/math/function/power.rb +37 -0
- data/lib/plurimath/math/function/power_base.rb +45 -18
- data/lib/plurimath/math/function/prod.rb +46 -0
- data/lib/plurimath/math/function/right.rb +4 -0
- data/lib/plurimath/math/function/root.rb +9 -1
- data/lib/plurimath/math/function/rule.rb +4 -0
- data/lib/plurimath/math/function/sqrt.rb +7 -1
- data/lib/plurimath/math/function/stackrel.rb +6 -0
- data/lib/plurimath/math/function/substack.rb +4 -0
- data/lib/plurimath/math/function/sum.rb +45 -24
- data/lib/plurimath/math/function/table/bmatrix.rb +18 -5
- data/lib/plurimath/math/function/table/cases.rb +24 -0
- data/lib/plurimath/math/function/table/eqarray.rb +24 -0
- data/lib/plurimath/math/function/table/matrix.rb +23 -3
- data/lib/plurimath/math/function/table/pmatrix.rb +4 -0
- data/lib/plurimath/math/function/table/vmatrix.rb +10 -0
- data/lib/plurimath/math/function/table.rb +58 -7
- data/lib/plurimath/math/function/td.rb +9 -0
- data/lib/plurimath/math/function/ternary_function.rb +14 -1
- data/lib/plurimath/math/function/text.rb +6 -0
- data/lib/plurimath/math/function/tilde.rb +4 -0
- data/lib/plurimath/math/function/tr.rb +9 -0
- data/lib/plurimath/math/function/ubrace.rb +5 -0
- data/lib/plurimath/math/function/ul.rb +4 -0
- data/lib/plurimath/math/function/unary_function.rb +4 -0
- data/lib/plurimath/math/function/underover.rb +14 -0
- data/lib/plurimath/math/function/underset.rb +49 -1
- data/lib/plurimath/math/function/vec.rb +4 -0
- data/lib/plurimath/math/number.rb +33 -3
- data/lib/plurimath/math/symbol.rb +68 -3
- data/lib/plurimath/math.rb +3 -2
- data/lib/plurimath/mathml/constants.rb +16 -0
- data/lib/plurimath/mathml/parser.rb +42 -2
- data/lib/plurimath/mathml/transform.rb +80 -29
- data/lib/plurimath/omml/parser.rb +8 -0
- data/lib/plurimath/omml/transform.rb +29 -26
- data/lib/plurimath/unicode_math/constants.rb +1014 -0
- data/lib/plurimath/unicode_math/parse.rb +233 -0
- data/lib/plurimath/unicode_math/parser.rb +58 -0
- data/lib/plurimath/unicode_math/parsing_rules/absence_rules.rb +138 -0
- data/lib/plurimath/unicode_math/parsing_rules/common_rules.rb +114 -0
- data/lib/plurimath/unicode_math/parsing_rules/constants_rules.rb +102 -0
- data/lib/plurimath/unicode_math/parsing_rules/helper.rb +19 -0
- data/lib/plurimath/unicode_math/parsing_rules/masked.rb +62 -0
- data/lib/plurimath/unicode_math/parsing_rules/sub_sup.rb +254 -0
- data/lib/plurimath/unicode_math/transform.rb +3831 -0
- data/lib/plurimath/{unicode.rb → unicode_math.rb} +2 -2
- data/lib/plurimath/unitsml.rb +14 -1
- data/lib/plurimath/utility.rb +346 -11
- data/lib/plurimath/version.rb +1 -1
- data/lib/plurimath/xml_engine/oga.rb +5 -0
- data/lib/plurimath/xml_engine/ox.rb +5 -0
- metadata +25 -3
@@ -31,18 +31,26 @@ module Plurimath
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def to_omml_without_math_tag(display_style)
|
34
|
+
attribute = { "m:val": "off" }
|
34
35
|
rad_element = Utility.ox_element("rad", namespace: "m")
|
35
36
|
pr_element = Utility.ox_element("radPr", namespace: "m")
|
37
|
+
pr_element << Utility.ox_element("degHide", namespace: "m", attributes: attribute)
|
36
38
|
Utility.update_nodes(
|
37
39
|
rad_element,
|
38
40
|
[
|
39
|
-
|
41
|
+
pr_element,
|
40
42
|
omml_parameter(parameter_two, display_style, tag_name: "deg"),
|
41
43
|
omml_parameter(parameter_one, display_style, tag_name: "e"),
|
42
44
|
],
|
43
45
|
)
|
44
46
|
[rad_element]
|
45
47
|
end
|
48
|
+
|
49
|
+
def to_unicodemath
|
50
|
+
first_value = parameter_one.to_unicodemath if parameter_one
|
51
|
+
second_value = parameter_two.to_unicodemath if parameter_two
|
52
|
+
"√(#{first_value}&#{second_value})"
|
53
|
+
end
|
46
54
|
end
|
47
55
|
end
|
48
56
|
end
|
@@ -6,6 +6,8 @@ module Plurimath
|
|
6
6
|
module Math
|
7
7
|
module Function
|
8
8
|
class Sqrt < UnaryFunction
|
9
|
+
attr_accessor :options
|
10
|
+
|
9
11
|
def to_mathml_without_math_tag
|
10
12
|
sqrt_tag = Utility.ox_element("msqrt")
|
11
13
|
Utility.update_nodes(
|
@@ -21,7 +23,7 @@ module Plurimath
|
|
21
23
|
pr_element << Utility.ox_element(
|
22
24
|
"degHide",
|
23
25
|
namespace: "m",
|
24
|
-
attributes: { "m:val": "
|
26
|
+
attributes: { "m:val": "on" },
|
25
27
|
)
|
26
28
|
Utility.update_nodes(
|
27
29
|
rad_element,
|
@@ -38,6 +40,10 @@ module Plurimath
|
|
38
40
|
parameter_one&.line_breaking(obj)
|
39
41
|
obj.update(Utility.filter_values(obj.value)) if obj.value_exist?
|
40
42
|
end
|
43
|
+
|
44
|
+
def to_unicodemath
|
45
|
+
"√#{unicodemath_parens(parameter_one)}"
|
46
|
+
end
|
41
47
|
end
|
42
48
|
end
|
43
49
|
end
|
@@ -48,6 +48,12 @@ module Plurimath
|
|
48
48
|
[limupp]
|
49
49
|
end
|
50
50
|
|
51
|
+
def to_unicodemath
|
52
|
+
first_value = "(#{parameter_one&.to_unicodemath})"
|
53
|
+
second_value = "(#{parameter_two&.to_unicodemath})"
|
54
|
+
"#{second_value}┴#{first_value}"
|
55
|
+
end
|
56
|
+
|
51
57
|
def line_breaking(obj)
|
52
58
|
parameter_one.line_breaking(obj)
|
53
59
|
if obj.value_exist?
|
@@ -30,6 +30,10 @@ module Plurimath
|
|
30
30
|
def to_omml_without_math_tag(display_style)
|
31
31
|
Table.new(parameter_one).to_omml_without_math_tag(display_style)
|
32
32
|
end
|
33
|
+
|
34
|
+
def to_unicodemath
|
35
|
+
"■(#{parameter_one.compact.map(&:to_unicodemath).join("@")})"
|
36
|
+
end
|
33
37
|
end
|
34
38
|
end
|
35
39
|
end
|
@@ -6,6 +6,7 @@ module Plurimath
|
|
6
6
|
module Math
|
7
7
|
module Function
|
8
8
|
class Sum < TernaryFunction
|
9
|
+
attr_accessor :options
|
9
10
|
FUNCTION = {
|
10
11
|
name: "summation",
|
11
12
|
first_value: "subscript",
|
@@ -13,6 +14,18 @@ module Plurimath
|
|
13
14
|
third_value: "term",
|
14
15
|
}.freeze
|
15
16
|
|
17
|
+
def initialize(parameter_one = nil,
|
18
|
+
parameter_two = nil,
|
19
|
+
parameter_three = nil,
|
20
|
+
options = {})
|
21
|
+
super(parameter_one, parameter_two, parameter_three)
|
22
|
+
@options = options unless options&.empty?
|
23
|
+
end
|
24
|
+
|
25
|
+
def ==(object)
|
26
|
+
super(object) && object.options == options
|
27
|
+
end
|
28
|
+
|
16
29
|
def to_asciimath
|
17
30
|
first_value = "_#{wrapped(parameter_one)}" if parameter_one
|
18
31
|
second_value = "^#{wrapped(parameter_two)}" if parameter_two
|
@@ -28,31 +41,28 @@ module Plurimath
|
|
28
41
|
def to_mathml_without_math_tag
|
29
42
|
first_value = ox_element("mo")
|
30
43
|
first_value << invert_unicode_symbols.to_s unless hide_function_name
|
44
|
+
return first_value unless all_values_exist?
|
31
45
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
)
|
53
|
-
else
|
54
|
-
first_value
|
55
|
-
end
|
46
|
+
value_array = [
|
47
|
+
parameter_one&.to_mathml_without_math_tag,
|
48
|
+
parameter_two&.to_mathml_without_math_tag,
|
49
|
+
]
|
50
|
+
tag_name = if parameter_two && parameter_one
|
51
|
+
"underover"
|
52
|
+
else
|
53
|
+
parameter_one ? "under" : "over"
|
54
|
+
end
|
55
|
+
munderover_tag = Utility.ox_element("m#{tag_name}")
|
56
|
+
Utility.update_nodes(munderover_tag, value_array.insert(0, first_value))
|
57
|
+
return munderover_tag if parameter_three.nil?
|
58
|
+
|
59
|
+
Utility.update_nodes(
|
60
|
+
ox_element("mrow"),
|
61
|
+
[
|
62
|
+
munderover_tag,
|
63
|
+
parameter_three&.to_mathml_without_math_tag,
|
64
|
+
],
|
65
|
+
)
|
56
66
|
end
|
57
67
|
|
58
68
|
def to_html
|
@@ -61,6 +71,13 @@ module Plurimath
|
|
61
71
|
"<i>∑</i>#{first_value}#{second_value}"
|
62
72
|
end
|
63
73
|
|
74
|
+
def to_unicodemath
|
75
|
+
first_value = "_#{unicodemath_parens(parameter_one)}" if parameter_one
|
76
|
+
second_value = "^#{unicodemath_parens(parameter_two)}" if parameter_two
|
77
|
+
mask = options&.dig(:mask) if options&.key?(:mask)
|
78
|
+
"∑#{mask}#{first_value}#{second_value}#{naryand_value(parameter_three)}"
|
79
|
+
end
|
80
|
+
|
64
81
|
def to_omml_without_math_tag(display_style)
|
65
82
|
return r_element("∑", rpr_tag: false) unless all_values_exist?
|
66
83
|
|
@@ -101,6 +118,10 @@ module Plurimath
|
|
101
118
|
obj.update(Utility.filter_values(obj.value))
|
102
119
|
end
|
103
120
|
end
|
121
|
+
|
122
|
+
def is_nary_function?
|
123
|
+
true
|
124
|
+
end
|
104
125
|
end
|
105
126
|
end
|
106
127
|
end
|
@@ -24,11 +24,24 @@ module Plurimath
|
|
24
24
|
table_tag,
|
25
25
|
value&.map(&:to_mathml_without_math_tag),
|
26
26
|
)
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
Utility.update_nodes(
|
28
|
+
Utility.ox_element("mrow"),
|
29
|
+
[
|
30
|
+
mo_element(mathml_parenthesis(open_paren)),
|
31
|
+
table_tag,
|
32
|
+
mo_element(mathml_parenthesis(close_paren)),
|
33
|
+
],
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
def to_unicodemath
|
38
|
+
"#{matrix_symbol}(#{value.map(&:to_unicodemath).join("@")})"
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def matrix_symbol
|
44
|
+
open_paren == "{" ? "Ⓢ" : "ⓢ"
|
32
45
|
end
|
33
46
|
end
|
34
47
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../table"
|
4
|
+
|
5
|
+
module Plurimath
|
6
|
+
module Math
|
7
|
+
module Function
|
8
|
+
class Table
|
9
|
+
class Cases < Table
|
10
|
+
def initialize(value = [],
|
11
|
+
open_paren = "{",
|
12
|
+
close_paren = ":}",
|
13
|
+
options = {})
|
14
|
+
super
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_unicodemath
|
18
|
+
"Ⓒ(#{value.map(&:to_unicodemath).join("@")})"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../table"
|
4
|
+
|
5
|
+
module Plurimath
|
6
|
+
module Math
|
7
|
+
module Function
|
8
|
+
class Table
|
9
|
+
class Eqarray < Table
|
10
|
+
def initialize(value = [],
|
11
|
+
open_paren = "",
|
12
|
+
close_paren = "",
|
13
|
+
options = {})
|
14
|
+
super
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_unicodemath
|
18
|
+
"#{open_paren}█(#{value&.map(&:to_unicodemath).join("@")})#{close_paren}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -23,12 +23,32 @@ module Plurimath
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def to_mathml_without_math_tag
|
26
|
-
table_tag = Utility.
|
26
|
+
table_tag = Utility.update_nodes(
|
27
|
+
ox_element("mtable", attributes: table_attribute),
|
28
|
+
value&.map(&:to_mathml_without_math_tag)
|
29
|
+
)
|
30
|
+
return table_tag if table_tag_only?
|
31
|
+
|
27
32
|
Utility.update_nodes(
|
28
|
-
|
29
|
-
|
33
|
+
ox_element("mrow"),
|
34
|
+
[mo_tag(open_paren), table_tag, mo_tag(close_paren)]
|
30
35
|
)
|
31
36
|
end
|
37
|
+
|
38
|
+
def to_unicodemath
|
39
|
+
first_value = value.map(&:to_unicodemath).join("@")
|
40
|
+
"#{open_paren}■(#{first_value})#{close_paren}"
|
41
|
+
end
|
42
|
+
|
43
|
+
protected
|
44
|
+
|
45
|
+
def mo_tag(paren)
|
46
|
+
(ox_element("mo") << paren) unless validate_paren(paren)
|
47
|
+
end
|
48
|
+
|
49
|
+
def table_tag_only?
|
50
|
+
(open_paren&.include?("(") && close_paren&.include?(")")) || !(open_paren && close_paren)
|
51
|
+
end
|
32
52
|
end
|
33
53
|
end
|
34
54
|
end
|
@@ -17,6 +17,16 @@ module Plurimath
|
|
17
17
|
def to_latex
|
18
18
|
"\\begin#{opening}#{latex_content}\\end#{matrix_class}"
|
19
19
|
end
|
20
|
+
|
21
|
+
def to_unicodemath
|
22
|
+
"#{matrix_symbol}(#{value.map(&:to_unicodemath).join("@")})"
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def matrix_symbol
|
28
|
+
open_paren == "norm[" ? "⒩" : "⒱"
|
29
|
+
end
|
20
30
|
end
|
21
31
|
end
|
22
32
|
end
|
@@ -46,8 +46,8 @@ module Plurimath
|
|
46
46
|
return norm_table(table_tag) if open_paren == "norm["
|
47
47
|
|
48
48
|
if present?(open_paren) || present?(close_paren)
|
49
|
-
first_paren =
|
50
|
-
second_paren =
|
49
|
+
first_paren = mo_element(mathml_parenthesis(open_paren))
|
50
|
+
second_paren = mo_element(mathml_parenthesis(close_paren))
|
51
51
|
mrow_tag = Utility.ox_element("mrow")
|
52
52
|
return Utility.update_nodes(mrow_tag, [first_paren, table_tag, second_paren])
|
53
53
|
end
|
@@ -72,7 +72,7 @@ module Plurimath
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def to_omml_without_math_tag(display_style)
|
75
|
-
ox_table = if
|
75
|
+
ox_table = if single_table?
|
76
76
|
single_td_table(display_style)
|
77
77
|
else
|
78
78
|
multiple_td_table(display_style)
|
@@ -80,6 +80,14 @@ module Plurimath
|
|
80
80
|
fenced_table(ox_table)
|
81
81
|
end
|
82
82
|
|
83
|
+
def to_unicodemath
|
84
|
+
if unicodemath_table_class?
|
85
|
+
"#{unicodemath_class_name}(#{value.map(&:to_unicodemath).join("@")})"
|
86
|
+
else
|
87
|
+
"#{open_paren}■(#{value.map(&:to_unicodemath).join("@")})#{close_paren}"
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
83
91
|
def to_asciimath_math_zone(spacing, last = false, indent = true)
|
84
92
|
[
|
85
93
|
"#{spacing}\"table\" function apply\n",
|
@@ -115,7 +123,7 @@ module Plurimath
|
|
115
123
|
end
|
116
124
|
|
117
125
|
def mathml_parenthesis(field)
|
118
|
-
return "" if field&.include?(":")
|
126
|
+
return "" if field&.include?(":") || validate_paren(field)
|
119
127
|
|
120
128
|
present?(field) ? field : ""
|
121
129
|
end
|
@@ -235,13 +243,12 @@ module Plurimath
|
|
235
243
|
end
|
236
244
|
|
237
245
|
def norm_table(table_tag)
|
238
|
-
mo_tag = Utility.ox_element("mo") << "∥"
|
239
246
|
Utility.update_nodes(
|
240
247
|
Utility.ox_element("mrow"),
|
241
248
|
[
|
242
|
-
|
249
|
+
mo_element("‖"),
|
243
250
|
table_tag,
|
244
|
-
|
251
|
+
mo_element("‖"),
|
245
252
|
],
|
246
253
|
)
|
247
254
|
end
|
@@ -284,6 +291,50 @@ module Plurimath
|
|
284
291
|
def parentheless_table
|
285
292
|
"{:#{value.map(&:to_asciimath).join(", ")}:}"
|
286
293
|
end
|
294
|
+
|
295
|
+
def single_table?
|
296
|
+
value.map { |d| d.parameter_one.length == 1 }.all? &&
|
297
|
+
nil_option?(:frame) &&
|
298
|
+
nil_option?(:columnlines) &&
|
299
|
+
nil_option?(:rowlines)
|
300
|
+
end
|
301
|
+
|
302
|
+
def nil_option?(option)
|
303
|
+
options[option].nil? ||
|
304
|
+
options[option] == "" ||
|
305
|
+
options[option] == "none"
|
306
|
+
end
|
307
|
+
|
308
|
+
def validate_paren(paren)
|
309
|
+
["〖", "〗"].include?(paren)
|
310
|
+
end
|
311
|
+
|
312
|
+
def mo_element(value)
|
313
|
+
Utility.ox_element("mo") << value
|
314
|
+
end
|
315
|
+
|
316
|
+
def unicodemath_table_class?
|
317
|
+
return unless class_name == "table"
|
318
|
+
return if open_paren.nil? && close_paren.nil?
|
319
|
+
|
320
|
+
(!(open_paren.nil? || open_paren.empty?) && !(close_paren.nil? || close_paren.empty?)) ||
|
321
|
+
Utility::PARENTHESIS[open_paren&.to_sym] == close_paren ||
|
322
|
+
(open_paren.include?("|") && close_paren.include?("|"))
|
323
|
+
end
|
324
|
+
|
325
|
+
def unicodemath_class_name
|
326
|
+
return matrices_functions(:Vmatrix) if class_name == "vmatrix" && open_paren == "norm["
|
327
|
+
return matrices_functions(:vmatrix) if open_paren == "|" && close_paren == "|"
|
328
|
+
return matrices_functions(:matrix) if class_name == "Bmatrix" && open_paren == "{"
|
329
|
+
return unless unicodemath_table_class?
|
330
|
+
|
331
|
+
matrix_name = UnicodeMath::Constants::PARENTHESIS_MATRICES.key(open_paren)
|
332
|
+
matrices_functions(matrix_name)
|
333
|
+
end
|
334
|
+
|
335
|
+
def matrices_functions(matrix_name)
|
336
|
+
UnicodeMath::Constants::MATRIXS[matrix_name]
|
337
|
+
end
|
287
338
|
end
|
288
339
|
end
|
289
340
|
end
|
@@ -6,6 +6,11 @@ module Plurimath
|
|
6
6
|
module Math
|
7
7
|
module Function
|
8
8
|
class Td < BinaryFunction
|
9
|
+
def initialize(parameter_one = nil, parameter_two = nil)
|
10
|
+
parameter_one&.delete_if { |td| td == "&" }
|
11
|
+
super(parameter_one, parameter_two)
|
12
|
+
end
|
13
|
+
|
9
14
|
def to_asciimath
|
10
15
|
parameter_one.map(&:to_asciimath).join(" ")
|
11
16
|
end
|
@@ -40,6 +45,10 @@ module Plurimath
|
|
40
45
|
[me]
|
41
46
|
end
|
42
47
|
|
48
|
+
def to_unicodemath
|
49
|
+
parameter_one&.map(&:to_unicodemath)&.join
|
50
|
+
end
|
51
|
+
|
43
52
|
def to_asciimath_math_zone(spacing, last = false, _)
|
44
53
|
[
|
45
54
|
"#{spacing}\"td\" function apply\n",
|
@@ -125,7 +125,7 @@ module Plurimath
|
|
125
125
|
|
126
126
|
def ascii_wrap(field)
|
127
127
|
asciimath = field.to_asciimath
|
128
|
-
return
|
128
|
+
return asciimath if ["obrace", "ubrace"].include?(field.class_name)
|
129
129
|
|
130
130
|
case field
|
131
131
|
when Formula || field.class.name.include?("Function")
|
@@ -180,6 +180,19 @@ module Plurimath
|
|
180
180
|
|
181
181
|
Underset.new(overset, parameter_two)&.to_omml_without_math_tag(display_style)
|
182
182
|
end
|
183
|
+
|
184
|
+
def naryand_value(field)
|
185
|
+
return "" unless field
|
186
|
+
|
187
|
+
field_value = field.to_unicodemath
|
188
|
+
field.is_a?(Math::Function::Fenced) ? "▒#{field_value}" : "▒〖#{field_value}〗"
|
189
|
+
end
|
190
|
+
|
191
|
+
def prime_unicode?(field)
|
192
|
+
return unless field.is_a?(Math::Symbol)
|
193
|
+
|
194
|
+
UnicodeMath::Constants::PREFIXED_PRIMES.any? { |prefix, prime| field.value.include?(prime) || field.value.include?("'") }
|
195
|
+
end
|
183
196
|
end
|
184
197
|
end
|
185
198
|
end
|
@@ -35,6 +35,12 @@ module Plurimath
|
|
35
35
|
[text]
|
36
36
|
end
|
37
37
|
|
38
|
+
def to_unicodemath
|
39
|
+
return unless value
|
40
|
+
|
41
|
+
value&.start_with?("\\") ? value : "\"#{(Utility.html_entity_to_unicode(value))}\""
|
42
|
+
end
|
43
|
+
|
38
44
|
def insert_t_tag(display_style)
|
39
45
|
r_tag = Utility.ox_element("r", namespace: "m")
|
40
46
|
Utility.update_nodes(r_tag, to_omml_without_math_tag(display_style))
|
@@ -6,6 +6,11 @@ module Plurimath
|
|
6
6
|
module Math
|
7
7
|
module Function
|
8
8
|
class Tr < UnaryFunction
|
9
|
+
def initialize(parameter_one = [])
|
10
|
+
parameter_one.map!.with_index { |_, index| Td.new([]) } if parameter_one&.all?("@")
|
11
|
+
super(parameter_one)
|
12
|
+
end
|
13
|
+
|
9
14
|
def to_asciimath
|
10
15
|
"[#{parameter_one.map(&:to_asciimath).join(', ')}]"
|
11
16
|
end
|
@@ -45,6 +50,10 @@ module Plurimath
|
|
45
50
|
end
|
46
51
|
end
|
47
52
|
|
53
|
+
def to_unicodemath
|
54
|
+
parameter_one&.map(&:to_unicodemath)&.join("&")
|
55
|
+
end
|
56
|
+
|
48
57
|
def to_asciimath_math_zone(spacing, last = false, indent = true)
|
49
58
|
[
|
50
59
|
"#{spacing}\"tr\" function apply\n",
|
@@ -57,6 +57,11 @@ module Plurimath
|
|
57
57
|
Underset.new(parameter_one, symbol).to_omml_without_math_tag(true)
|
58
58
|
end
|
59
59
|
|
60
|
+
def to_unicodemath
|
61
|
+
first_value = "(#{parameter_one&.to_unicodemath})" if parameter_one
|
62
|
+
"⏟#{first_value}"
|
63
|
+
end
|
64
|
+
|
60
65
|
def line_breaking(obj)
|
61
66
|
parameter_one&.line_breaking(obj)
|
62
67
|
obj.update(Utility.filter_values(obj.value)) if obj.value_exist?
|
@@ -47,6 +47,12 @@ module Plurimath
|
|
47
47
|
underover(display_style)
|
48
48
|
end
|
49
49
|
|
50
|
+
def to_unicodemath
|
51
|
+
sub_value = "┬#{unicodemath_parens(parameter_two)}" if parameter_two
|
52
|
+
sup_value = "┴#{unicodemath_parens(parameter_three)}" if parameter_three
|
53
|
+
"#{parameter_one&.to_unicodemath}#{sub_value}#{sup_value}"
|
54
|
+
end
|
55
|
+
|
50
56
|
def line_breaking(obj)
|
51
57
|
parameter_one&.line_breaking(obj)
|
52
58
|
if obj.value_exist?
|
@@ -67,6 +73,14 @@ module Plurimath
|
|
67
73
|
self.parameter_three = nil
|
68
74
|
end
|
69
75
|
end
|
76
|
+
|
77
|
+
def new_nary_function(fourth_value)
|
78
|
+
Nary.new(parameter_one, parameter_two, parameter_three, fourth_value, { type: "undOvr" })
|
79
|
+
end
|
80
|
+
|
81
|
+
def is_nary_function?
|
82
|
+
parameter_one.is_nary_function? || parameter_one.is_nary_symbol?
|
83
|
+
end
|
70
84
|
end
|
71
85
|
end
|
72
86
|
end
|