plurimath 0.6.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -0
  3. data/lib/plurimath/asciimath/parse.rb +3 -2
  4. data/lib/plurimath/asciimath/transform.rb +32 -5
  5. data/lib/plurimath/latex/constants.rb +2 -1
  6. data/lib/plurimath/latex/transform.rb +9 -13
  7. data/lib/plurimath/math/core.rb +134 -20
  8. data/lib/plurimath/math/formula.rb +88 -18
  9. data/lib/plurimath/math/function/abs.rb +28 -15
  10. data/lib/plurimath/math/function/bar.rb +5 -0
  11. data/lib/plurimath/math/function/base.rb +14 -0
  12. data/lib/plurimath/math/function/binary_function.rb +2 -8
  13. data/lib/plurimath/math/function/ceil.rb +24 -9
  14. data/lib/plurimath/math/function/ddot.rb +6 -1
  15. data/lib/plurimath/math/function/deg.rb +4 -1
  16. data/lib/plurimath/math/function/det.rb +4 -1
  17. data/lib/plurimath/math/function/dim.rb +4 -1
  18. data/lib/plurimath/math/function/dot.rb +5 -0
  19. data/lib/plurimath/math/function/exp.rb +4 -1
  20. data/lib/plurimath/math/function/fenced.rb +25 -16
  21. data/lib/plurimath/math/function/floor.rb +23 -13
  22. data/lib/plurimath/math/function/font_style.rb +18 -8
  23. data/lib/plurimath/math/function/frac.rb +32 -18
  24. data/lib/plurimath/math/function/gcd.rb +4 -1
  25. data/lib/plurimath/math/function/glb.rb +8 -1
  26. data/lib/plurimath/math/function/hat.rb +16 -5
  27. data/lib/plurimath/math/function/hom.rb +4 -1
  28. data/lib/plurimath/math/function/inf.rb +16 -0
  29. data/lib/plurimath/math/function/int.rb +28 -9
  30. data/lib/plurimath/math/function/ker.rb +4 -1
  31. data/lib/plurimath/math/function/lcm.rb +17 -1
  32. data/lib/plurimath/math/function/left.rb +1 -1
  33. data/lib/plurimath/math/function/lg.rb +4 -1
  34. data/lib/plurimath/math/function/lim.rb +10 -0
  35. data/lib/plurimath/math/function/liminf.rb +4 -1
  36. data/lib/plurimath/math/function/limits.rb +22 -9
  37. data/lib/plurimath/math/function/limsup.rb +4 -1
  38. data/lib/plurimath/math/function/linebreak.rb +95 -0
  39. data/lib/plurimath/math/function/ln.rb +4 -1
  40. data/lib/plurimath/math/function/log.rb +21 -12
  41. data/lib/plurimath/math/function/longdiv.rb +19 -0
  42. data/lib/plurimath/math/function/lub.rb +4 -1
  43. data/lib/plurimath/math/function/max.rb +4 -1
  44. data/lib/plurimath/math/function/mbox.rb +8 -7
  45. data/lib/plurimath/math/function/merror.rb +12 -3
  46. data/lib/plurimath/math/function/min.rb +4 -1
  47. data/lib/plurimath/math/function/mod.rb +42 -15
  48. data/lib/plurimath/math/function/msgroup.rb +4 -0
  49. data/lib/plurimath/math/function/msline.rb +10 -0
  50. data/lib/plurimath/math/function/multiscript.rb +20 -0
  51. data/lib/plurimath/math/function/nary.rb +39 -5
  52. data/lib/plurimath/math/function/norm.rb +24 -15
  53. data/lib/plurimath/math/function/obrace.rb +5 -0
  54. data/lib/plurimath/math/function/oint.rb +42 -20
  55. data/lib/plurimath/math/function/over.rb +23 -10
  56. data/lib/plurimath/math/function/overset.rb +13 -10
  57. data/lib/plurimath/math/function/phantom.rb +24 -6
  58. data/lib/plurimath/math/function/power.rb +13 -4
  59. data/lib/plurimath/math/function/power_base.rb +28 -6
  60. data/lib/plurimath/math/function/prod.rb +33 -14
  61. data/lib/plurimath/math/function/right.rb +1 -1
  62. data/lib/plurimath/math/function/rule.rb +1 -1
  63. data/lib/plurimath/math/function/scarries.rb +14 -0
  64. data/lib/plurimath/math/function/semantics.rb +9 -0
  65. data/lib/plurimath/math/function/sqrt.rb +5 -0
  66. data/lib/plurimath/math/function/stackrel.rb +8 -0
  67. data/lib/plurimath/math/function/substack.rb +12 -51
  68. data/lib/plurimath/math/function/sum.rb +43 -20
  69. data/lib/plurimath/math/function/sup.rb +11 -2
  70. data/lib/plurimath/math/function/table/array.rb +1 -1
  71. data/lib/plurimath/math/function/table/matrix.rb +4 -0
  72. data/lib/plurimath/math/function/table.rb +11 -3
  73. data/lib/plurimath/math/function/td.rb +14 -4
  74. data/lib/plurimath/math/function/ternary_function.rb +8 -10
  75. data/lib/plurimath/math/function/text.rb +1 -1
  76. data/lib/plurimath/math/function/tilde.rb +5 -0
  77. data/lib/plurimath/math/function/tr.rb +1 -1
  78. data/lib/plurimath/math/function/ubrace.rb +5 -0
  79. data/lib/plurimath/math/function/unary_function.rb +72 -26
  80. data/lib/plurimath/math/function/underover.rb +25 -8
  81. data/lib/plurimath/math/function/underset.rb +19 -9
  82. data/lib/plurimath/math/function/vec.rb +5 -0
  83. data/lib/plurimath/math/number.rb +3 -3
  84. data/lib/plurimath/math/symbol.rb +13 -5
  85. data/lib/plurimath/mathml/parser.rb +2 -0
  86. data/lib/plurimath/mathml/transform.rb +23 -15
  87. data/lib/plurimath/omml/transform.rb +22 -10
  88. data/lib/plurimath/unitsml.rb +2 -1
  89. data/lib/plurimath/utility.rb +29 -28
  90. data/lib/plurimath/version.rb +1 -1
  91. metadata +3 -3
  92. data/lib/plurimath/math/function/scarry.rb +0 -12
@@ -54,6 +54,20 @@ module Plurimath
54
54
  )
55
55
  [ssub_element]
56
56
  end
57
+
58
+ def line_breaking(obj)
59
+ parameter_one&.line_breaking(obj)
60
+ if obj.value_exist?
61
+ obj.update(self.class.new(Utility.filter_values(obj.value), parameter_two))
62
+ self.parameter_two = nil
63
+ return
64
+ end
65
+
66
+ parameter_two&.line_breaking(obj)
67
+ if obj.value_exist?
68
+ obj.update(self.class.new(nil, Utility.filter_values(obj.value)))
69
+ end
70
+ end
57
71
  end
58
72
  end
59
73
  end
@@ -4,12 +4,12 @@ module Plurimath
4
4
  module Math
5
5
  module Function
6
6
  class BinaryFunction < Core
7
- attr_accessor :parameter_one, :parameter_two
7
+ attr_accessor :parameter_one, :parameter_two, :hide_function_name
8
8
 
9
9
  def initialize(parameter_one = nil, parameter_two = nil)
10
10
  @parameter_one = parameter_one
11
11
  @parameter_two = parameter_two
12
- Utility.validate_left_right([parameter_one, parameter_two])
12
+ Utility.validate_left_right(variables.map { |var| get(var) })
13
13
  end
14
14
 
15
15
  def to_asciimath
@@ -116,12 +116,6 @@ module Plurimath
116
116
  "(#{field.to_asciimath})"
117
117
  end
118
118
 
119
- def empty_tag(wrapper_tag)
120
- r_tag = Utility.ox_element("r", namespace: "m")
121
- r_tag << (Utility.ox_element("t", namespace: "m") << "&#8203;")
122
- wrapper_tag << r_tag
123
- end
124
-
125
119
  def underover(display_style)
126
120
  return r_element(class_name, rpr_tag: false) unless all_values_exist?
127
121
 
@@ -6,23 +6,22 @@ module Plurimath
6
6
  module Math
7
7
  module Function
8
8
  class Ceil < UnaryFunction
9
+ attr_accessor :open_paren, :close_paren
10
+
9
11
  def to_latex
10
12
  "{\\lceil #{latex_value} \\rceil}"
11
13
  end
12
14
 
13
15
  def to_mathml_without_math_tag
14
- left_value = Utility.ox_element("mo") << "&#x2308;"
15
- first_value = mathml_value&.insert(0, left_value)
16
- right_value = Utility.ox_element("mo") << "&#x2309;"
17
- Utility.update_nodes(
18
- Utility.ox_element("mrow"),
19
- first_value << right_value,
20
- )
16
+ first_value = mathml_value
17
+ first_value = first_value&.insert(0, paren_node("&#x2308;")) unless open_paren
18
+ first_value = first_value << paren_node("&#x2309;") unless close_paren
19
+ Utility.update_nodes(ox_element("mrow"), first_value)
21
20
  end
22
21
 
23
22
  def to_omml_without_math_tag(display_style)
24
- lceil = Symbol.new("⌈")
25
- rceil = Symbol.new("⌉")
23
+ lceil = Symbol.new("⌈") unless open_paren
24
+ rceil = Symbol.new("⌉") unless close_paren
26
25
  fenced = Fenced.new(lceil, Array(parameter_one), rceil)
27
26
  Array(fenced.to_omml_without_math_tag(display_style))
28
27
  end
@@ -31,6 +30,22 @@ module Plurimath
31
30
  first_value = "<i>#{parameter_one.to_html}</i>" if parameter_one
32
31
  "<i>&#x2308;</i>#{first_value}<i>&#x2309;</i>"
33
32
  end
33
+
34
+ def line_breaking(obj)
35
+ parameter_one.line_breaking(obj)
36
+ if obj.value_exist?
37
+ ceil_object = self.class.new(Utility.filter_values(obj.value))
38
+ ceil_object.open_paren = true
39
+ ceil_object.close_paren = false
40
+ obj.update(ceil_object)
41
+ self.close_paren = true
42
+ self.open_paren = false unless open_paren
43
+ end
44
+ end
45
+
46
+ def paren_node(value)
47
+ ox_element("mo") << value
48
+ end
34
49
  end
35
50
  end
36
51
  end
@@ -21,7 +21,7 @@ module Plurimath
21
21
  )
22
22
  end
23
23
 
24
- def to_omml_without_math_tag(display_style)
24
+ def to_omml_without_math_tag(_)
25
25
  return r_element("..", rpr_tag: false) unless parameter_one
26
26
 
27
27
  symbol = Symbol.new("..")
@@ -32,6 +32,11 @@ module Plurimath
32
32
  first_value = "<i>#{parameter_one.to_html}</i>" if parameter_one
33
33
  "#{first_value}<i>..</i>"
34
34
  end
35
+
36
+ def line_breaking(obj)
37
+ parameter_one&.line_breaking(obj)
38
+ obj.update(Utility.filter_values(obj.value)) if obj.value_exist?
39
+ end
35
40
  end
36
41
  end
37
42
  end
@@ -11,7 +11,10 @@ module Plurimath
11
11
  end
12
12
 
13
13
  def to_omml_without_math_tag(display_style)
14
- [r_element("deg", rpr_tag: false), omml_value(display_style)]
14
+ array = []
15
+ array << r_element("deg", rpr_tag: false) unless hide_function_name
16
+ array += Array(omml_value(display_style))
17
+ array
15
18
  end
16
19
  end
17
20
  end
@@ -11,7 +11,10 @@ module Plurimath
11
11
  end
12
12
 
13
13
  def to_omml_without_math_tag(display_style)
14
- [r_element("det", rpr_tag: false), omml_value(display_style)]
14
+ array = []
15
+ array << r_element("det", rpr_tag: false) unless hide_function_name
16
+ array += Array(omml_value(display_style))
17
+ array
15
18
  end
16
19
  end
17
20
  end
@@ -11,7 +11,10 @@ module Plurimath
11
11
  end
12
12
 
13
13
  def to_omml_without_math_tag(display_style)
14
- [r_element("dim", rpr_tag: false), omml_value(display_style)]
14
+ array = []
15
+ array << r_element("dim", rpr_tag: false) unless hide_function_name
16
+ array += Array(omml_value(display_style))
17
+ array
15
18
  end
16
19
  end
17
20
  end
@@ -41,6 +41,11 @@ module Plurimath
41
41
  end
42
42
  end
43
43
 
44
+ def line_breaking(obj)
45
+ parameter_one&.line_breaking(obj)
46
+ obj.update(Utility.filter_values(obj.value)) if obj.value_exist?
47
+ end
48
+
44
49
  protected
45
50
 
46
51
  def acc_tag(display_style)
@@ -11,7 +11,10 @@ module Plurimath
11
11
  end
12
12
 
13
13
  def to_omml_without_math_tag(display_style)
14
- [r_element("exp", rpr_tag: false), omml_value(display_style)]
14
+ array = []
15
+ array << r_element("exp", rpr_tag: false) unless hide_function_name
16
+ array += Array(omml_value(display_style))
17
+ array
15
18
  end
16
19
  end
17
20
  end
@@ -39,20 +39,12 @@ module Plurimath
39
39
  def to_omml_without_math_tag(display_style)
40
40
  d = Utility.ox_element("d", namespace: "m")
41
41
  dpr = Utility.ox_element("dPr", namespace: "m")
42
- first_value(dpr)
43
- third_value(dpr)
42
+ parameter = Formula.new(Array(parameter_two))
43
+ open_paren(dpr)
44
+ close_paren(dpr)
45
+ fenced_value = omml_parameter(parameter, display_style, tag_name: "e")
44
46
  dpr << Utility.pr_element("ctrl", true, namespace: "m")
45
- Utility.update_nodes(
46
- d,
47
- [
48
- dpr,
49
- omml_parameter(
50
- Formula.new(Array(parameter_two)),
51
- display_style,
52
- tag_name: "e",
53
- ),
54
- ],
55
- )
47
+ Utility.update_nodes(d, [dpr, fenced_value])
56
48
  [d]
57
49
  end
58
50
 
@@ -78,14 +70,21 @@ module Plurimath
78
70
  end
79
71
 
80
72
  def to_omml_math_zone(spacing, last = false, indent = true, display_style:)
81
- filtered_values(parameter_two).map.with_index(1) do |object, index|
73
+ filtered_values(parameter_two).map do |object|
82
74
  object.to_omml_math_zone(spacing, last, !indent, display_style: display_style)
83
75
  end
84
76
  end
85
77
 
78
+ def line_breaking(obj)
79
+ field_values = result(Array(parameter_two))
80
+ return unless field_values.length > 1
81
+
82
+ obj.update(value_split(obj, field_values))
83
+ end
84
+
86
85
  protected
87
86
 
88
- def first_value(dpr)
87
+ def open_paren(dpr)
89
88
  first_value = parameter_one&.value
90
89
  return dpr if first_value.nil? || first_value.empty?
91
90
 
@@ -97,7 +96,7 @@ module Plurimath
97
96
  )
98
97
  end
99
98
 
100
- def third_value(dpr)
99
+ def close_paren(dpr)
101
100
  third_value = parameter_three&.value
102
101
  return dpr if third_value.nil? || third_value.empty?
103
102
 
@@ -123,6 +122,16 @@ module Plurimath
123
122
 
124
123
  field&.value
125
124
  end
125
+
126
+ def value_split(obj, field_value)
127
+ object = cloned_objects
128
+ breaked_result = field_value.first.last.omml_line_break(field_value)
129
+ self.parameter_two = Array(breaked_result.shift)
130
+ object.parameter_one = nil
131
+ object.parameter_two = breaked_result.flatten
132
+ self.parameter_three = nil
133
+ object
134
+ end
126
135
  end
127
136
  end
128
137
  end
@@ -6,28 +6,38 @@ module Plurimath
6
6
  module Math
7
7
  module Function
8
8
  class Floor < UnaryFunction
9
+ attr_accessor :open_paren, :close_paren
10
+
9
11
  def to_latex
10
12
  "{\\lfloor #{parameter_one.to_latex} \\rfloor}"
11
13
  end
12
14
 
13
15
  def to_mathml_without_math_tag
14
16
  first_value = parameter_one&.to_mathml_without_math_tag
15
- Utility.update_nodes(
16
- Utility.ox_element("mrow"),
17
- [
18
- Utility.ox_element("mo") << "&#x230a;",
19
- first_value,
20
- Utility.ox_element("mo") << "&#x230b;",
21
- ],
22
- )
17
+ value_array = [first_value]
18
+ value_array.insert(0, (ox_element("mo") << "&#x230a;")) unless open_paren
19
+ value_array << (ox_element("mo") << "&#x230b;") unless close_paren
20
+ Utility.update_nodes(ox_element("mrow"), value_array)
23
21
  end
24
22
 
25
23
  def to_omml_without_math_tag(display_style)
26
- [
27
- r_element("⌊"),
28
- omml_value(display_style),
29
- r_element("⌋"),
30
- ]
24
+ array = []
25
+ array << r_element("⌊") unless open_paren
26
+ array += Array(omml_value(display_style))
27
+ array << r_element("⌋") unless close_paren
28
+ array
29
+ end
30
+
31
+ def line_breaking(obj)
32
+ parameter_one.line_breaking(obj)
33
+ if obj.value_exist?
34
+ ceil_object = self.class.new(Utility.filter_values(obj.value))
35
+ ceil_object.open_paren = true
36
+ ceil_object.close_paren = false
37
+ obj.update(ceil_object)
38
+ self.close_paren = true
39
+ self.open_paren = false unless open_paren
40
+ end
31
41
  end
32
42
  end
33
43
  end
@@ -37,7 +37,7 @@ module Plurimath
37
37
  true
38
38
  end
39
39
 
40
- def extract_class_from_text
40
+ def extract_class_name_from_text
41
41
  parameter_one.parameter_one if parameter_one.is_a?(Text)
42
42
  parameter_one.class_name
43
43
  end
@@ -47,15 +47,13 @@ module Plurimath
47
47
  end
48
48
 
49
49
  def font_styles(display_style, sty: "p", scr: nil)
50
- r_tag = Utility.ox_element("r", namespace: "m")
50
+ r_tag = Utility.ox_element("r", namespace: "m")
51
51
  rpr_tag = Utility.ox_element("rPr", namespace: "m")
52
- fonts = []
53
- fonts << Utility.ox_element("scr", namespace: "m", attributes: { "m:val": scr }) if scr
54
- fonts << Utility.ox_element("sty", namespace: "m", attributes: { "m:val": sty }) if sty
55
- r_tag << Utility.update_nodes(rpr_tag, fonts)
52
+ rpr_tag << Utility.ox_element("scr", namespace: "m", attributes: { "m:val": scr }) if scr
53
+ rpr_tag << Utility.ox_element("sty", namespace: "m", attributes: { "m:val": sty }) if sty
56
54
  Utility.update_nodes(
57
- r_tag,
58
- Array(parameter_one.font_style_t_tag(display_style)),
55
+ (r_tag << rpr_tag),
56
+ Array(parameter_one&.font_style_t_tag(display_style)),
59
57
  )
60
58
  [r_tag]
61
59
  end
@@ -104,6 +102,18 @@ module Plurimath
104
102
  fonts = Utility::FONT_STYLES.select { |_font, font_class| font_class == self.class }.keys.map(&:to_s)
105
103
  Omml::Parser::SUPPORTED_FONTS.values.find { |value| fonts.include?(value) }
106
104
  end
105
+
106
+ def line_breaking(obj)
107
+ parameter_one&.line_breaking(obj)
108
+ return unless obj.value_exist?
109
+
110
+ obj.update(
111
+ self.class.new(
112
+ Utility.filter_values(obj.value),
113
+ self.parameter_two,
114
+ )
115
+ )
116
+ end
107
117
  end
108
118
  end
109
119
  end
@@ -19,16 +19,12 @@ module Plurimath
19
19
  end
20
20
 
21
21
  def to_mathml_without_math_tag
22
- frac_tag = Utility.ox_element("mfrac")
23
- first_value = parameter_one&.to_mathml_without_math_tag
24
- second_value = parameter_two&.to_mathml_without_math_tag
25
- Utility.update_nodes(
26
- frac_tag,
27
- [
28
- first_value,
29
- second_value,
30
- ].flatten,
31
- )
22
+ tag_name = hide_function_name ? "mfrac" : "mrow"
23
+ mathml_value = [
24
+ parameter_one&.to_mathml_without_math_tag,
25
+ parameter_two&.to_mathml_without_math_tag,
26
+ ]
27
+ Utility.update_nodes(ox_element("mfrac"), mathml_value)
32
28
  end
33
29
 
34
30
  def to_latex
@@ -41,15 +37,33 @@ module Plurimath
41
37
  f_element = Utility.ox_element("f", namespace: "m")
42
38
  fpr_element = Utility.ox_element("fPr", namespace: "m")
43
39
  fpr_element << Utility.pr_element("ctrl", true, namespace: "m")
44
- Utility.update_nodes(
45
- f_element,
46
- [
47
- fpr_element,
48
- omml_parameter(parameter_one, display_style, tag_name: "num"),
49
- omml_parameter(parameter_two, display_style, tag_name: "den"),
50
- ],
40
+ Array(
41
+ Utility.update_nodes(
42
+ f_element,
43
+ [
44
+ fpr_element,
45
+ omml_parameter(parameter_one, display_style, tag_name: "num"),
46
+ omml_parameter(parameter_two, display_style, tag_name: "den"),
47
+ ],
48
+ ),
51
49
  )
52
- [f_element]
50
+ end
51
+
52
+ def line_breaking(obj)
53
+ parameter_one&.line_breaking(obj)
54
+ if obj.value_exist?
55
+ obj.update(self.class.new(Utility.filter_values(obj.value), parameter_two))
56
+ self.parameter_two = nil
57
+ self.hide_function_name = true
58
+ return
59
+ end
60
+
61
+ parameter_two&.line_breaking(obj)
62
+ if obj.value_exist?
63
+ frac = self.class.new(nil, Utility.filter_values(obj.value))
64
+ frac.hide_function_name = true
65
+ obj.update(frac)
66
+ end
53
67
  end
54
68
  end
55
69
  end
@@ -11,7 +11,10 @@ module Plurimath
11
11
  end
12
12
 
13
13
  def to_omml_without_math_tag(display_style)
14
- [r_element("gcd", rpr_tag: false), omml_value(display_style)]
14
+ array = []
15
+ array << r_element("gcd", rpr_tag: false) unless hide_function_name
16
+ array += Array(omml_value(display_style))
17
+ array
15
18
  end
16
19
  end
17
20
  end
@@ -10,8 +10,15 @@ module Plurimath
10
10
  false
11
11
  end
12
12
 
13
+ def to_latex
14
+ "glb{#{latex_value}}"
15
+ end
16
+
13
17
  def to_omml_without_math_tag(display_style)
14
- [r_element("glb", rpr_tag: false), omml_value(display_style)]
18
+ array = []
19
+ array << r_element("glb", rpr_tag: false) unless hide_function_name
20
+ array += Array(omml_value(display_style))
21
+ array
15
22
  end
16
23
  end
17
24
  end
@@ -43,22 +43,33 @@ module Plurimath
43
43
  end
44
44
 
45
45
  def to_omml_without_math_tag(display_style)
46
- return r_element("^", rpr_tag: false) unless parameter_one
46
+ return r_element("^", rpr_tag: false) unless parameter_one
47
+ return omml_value(display_style) if hide_function_name
47
48
 
48
49
  if attributes && attributes[:accent]
49
50
  accent_tag(display_style)
50
51
  else
51
- symbol = Symbol.new("&#x302;")
52
- Overset.new(parameter_one, symbol).to_omml_without_math_tag(true)
52
+ symbol = Symbol.new("&#x302;") unless hide_function_name
53
+ Overset.new(parameter_one, symbol).to_omml_without_math_tag(display_style)
54
+ end
55
+ end
56
+
57
+ def line_breaking(obj)
58
+ parameter_one&.line_breaking(obj)
59
+ if obj.value_exist?
60
+ obj.update(
61
+ Overset.new(Utility.filter_values(obj.value), nil),
62
+ )
53
63
  end
54
64
  end
55
65
 
56
66
  protected
57
67
 
58
68
  def accent_tag(display_style)
59
- acc_tag = Utility.ox_element("acc", namespace: "m")
69
+ symbol = "̂" unless hide_function_name
70
+ acc_tag = Utility.ox_element("acc", namespace: "m")
60
71
  acc_pr_tag = Utility.ox_element("accPr", namespace: "m")
61
- acc_pr_tag << (Utility.ox_element("chr", namespace: "m", attributes: { "m:val": "̂" }))
72
+ acc_pr_tag << (Utility.ox_element("chr", namespace: "m", attributes: { "m:val": symbol }))
62
73
  Utility.update_nodes(
63
74
  acc_tag,
64
75
  [
@@ -7,7 +7,10 @@ module Plurimath
7
7
  module Function
8
8
  class Hom < UnaryFunction
9
9
  def to_omml_without_math_tag(display_style)
10
- [r_element("hom", rpr_tag: false), omml_value(display_style)]
10
+ array = []
11
+ array << r_element("hom", rpr_tag: false) unless hide_function_name
12
+ array += Array(omml_value(display_style))
13
+ array
11
14
  end
12
15
  end
13
16
  end
@@ -6,6 +6,12 @@ module Plurimath
6
6
  module Math
7
7
  module Function
8
8
  class Inf < BinaryFunction
9
+ def to_asciimath
10
+ first_value = "_(#{parameter_one.to_asciimath})" if parameter_one
11
+ second_value = "^(#{parameter_two.to_asciimath})" if parameter_two
12
+ "#{class_name}#{first_value}#{second_value}"
13
+ end
14
+
9
15
  def to_latex
10
16
  first_value = "_{#{parameter_one.to_latex}}" if parameter_one
11
17
  second_value = "^{#{parameter_two.to_latex}}" if parameter_two
@@ -33,6 +39,16 @@ module Plurimath
33
39
  def to_omml_without_math_tag(display_style)
34
40
  underover(display_style)
35
41
  end
42
+
43
+ def line_breaking(obj)
44
+ parameter_one.line_breaking(obj)
45
+ if obj.value_exist?
46
+ obj.update(
47
+ Underover.new(nil, Utility.filter_values(obj.value), parameter_two)
48
+ )
49
+ self.parameter_two = nil
50
+ end
51
+ end
36
52
  end
37
53
  end
38
54
  end
@@ -52,15 +52,7 @@ module Plurimath
52
52
  def to_omml_without_math_tag(display_style)
53
53
  if all_values_exist?
54
54
  nary = Utility.ox_element("nary", namespace: "m")
55
- Utility.update_nodes(
56
- nary,
57
- [
58
- narypr("∫", function_type: "subSup"),
59
- omml_parameter(parameter_one, display_style, tag_name: "sub"),
60
- omml_parameter(parameter_two, display_style, tag_name: "sup"),
61
- omml_parameter(parameter_three, display_style, tag_name: "e"),
62
- ],
63
- )
55
+ Utility.update_nodes(nary, nary_array(display_style))
64
56
  [nary]
65
57
  else
66
58
  r_tag = Utility.ox_element("r", namespace: "m")
@@ -69,6 +61,33 @@ module Plurimath
69
61
  [r_tag]
70
62
  end
71
63
  end
64
+
65
+ def line_breaking(obj)
66
+ parameter_one&.line_breaking(obj)
67
+ if obj.value_exist?
68
+ int = Int.new(Utility.filter_values(obj.value), parameter_two, parameter_three)
69
+ int.hide_function_name = true
70
+ obj.update(int)
71
+ self.parameter_two = nil
72
+ self.parameter_three = nil
73
+ return
74
+ end
75
+
76
+ parameter_three&.line_breaking(obj)
77
+ if obj.value_exist?
78
+ obj.update(Utility.filter_values(obj.value))
79
+ end
80
+ end
81
+
82
+ def nary_array(display_style)
83
+ symbol = hide_function_name ? "" : "∫"
84
+ [
85
+ narypr(symbol, function_type: "subSup"),
86
+ omml_parameter(parameter_one, display_style, tag_name: "sub"),
87
+ omml_parameter(parameter_two, display_style, tag_name: "sup"),
88
+ omml_parameter(parameter_three, display_style, tag_name: "e"),
89
+ ]
90
+ end
72
91
  end
73
92
  end
74
93
  end
@@ -7,7 +7,10 @@ module Plurimath
7
7
  module Function
8
8
  class Ker < UnaryFunction
9
9
  def to_omml_without_math_tag(display_style)
10
- [r_element("ker", rpr_tag: false), omml_value(display_style)]
10
+ array = []
11
+ array << r_element("ker", rpr_tag: false) unless hide_function_name
12
+ array += Array(omml_value(display_style))
13
+ array
11
14
  end
12
15
  end
13
16
  end
@@ -6,8 +6,24 @@ module Plurimath
6
6
  module Math
7
7
  module Function
8
8
  class Lcm < UnaryFunction
9
+ def validate_function_formula
10
+ false
11
+ end
12
+
13
+ def to_asciimath
14
+ first_value = " #{asciimath_value}" if parameter_one
15
+ "lcm#{first_value}"
16
+ end
17
+
18
+ def to_latex
19
+ "lcm{#{latex_value}}"
20
+ end
21
+
9
22
  def to_omml_without_math_tag(display_style)
10
- [r_element("lcm", rpr_tag: false), omml_value(display_style)]
23
+ array = []
24
+ array << r_element("lcm", rpr_tag: false) unless hide_function_name
25
+ array += Array(omml_value(display_style))
26
+ array
11
27
  end
12
28
  end
13
29
  end
@@ -16,7 +16,7 @@ module Plurimath
16
16
  mo
17
17
  end
18
18
 
19
- def to_omml_without_math_tag(display_style)
19
+ def to_omml_without_math_tag(_)
20
20
  mr = Utility.ox_element("m:r")
21
21
  if parameter_one
22
22
  mt = Utility.ox_element("m:t")
@@ -11,7 +11,10 @@ module Plurimath
11
11
  end
12
12
 
13
13
  def to_omml_without_math_tag(display_style)
14
- [r_element("lg", rpr_tag: false), omml_value(display_style)]
14
+ array = []
15
+ array << r_element("lg", rpr_tag: false) unless hide_function_name
16
+ array += Array(omml_value(display_style))
17
+ array
15
18
  end
16
19
  end
17
20
  end