Class: Plurimath::Math::Function::Table::Matrix

Inherits:
Table
  • Object
show all
Defined in:
lib/plurimath/math/function/table/matrix.rb

Instance Method Summary collapse

Constructor Details

#initialize(value = [], open_paren = "(", close_paren = ")", options = {}) ⇒ Matrix

Returns a new instance of Matrix.



8
9
10
11
12
13
# File 'lib/plurimath/math/function/table/matrix.rb', line 8

def initialize(value = [],
               open_paren = "(",
               close_paren = ")",
               options = {})
  super
end

Instance Method Details

#to_asciimath(options:) ⇒ Object



15
16
17
18
19
20
# File 'lib/plurimath/math/function/table/matrix.rb', line 15

def to_asciimath(options:)
  ascii_value = value.map do |v|
    v.to_asciimath(options: options)
  end.join(", ")
  "{:#{ascii_value}:}"
end

#to_latex(options:) ⇒ Object



22
23
24
# File 'lib/plurimath/math/function/table/matrix.rb', line 22

def to_latex(options:)
  "\\begin#{opening}#{latex_content(options: options)}\\end#{matrix_class}"
end

#to_mathml_without_math_tag(intent, options:) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/plurimath/math/function/table/matrix.rb', line 26

def to_mathml_without_math_tag(intent, options:)
  table_tag = Utility.update_nodes(
    ox_element("mtable", attributes: table_attribute),
    value&.map do |object|
      object&.to_mathml_without_math_tag(intent, options: options)
    end,
  )
  return table_tag if table_tag_only?

  Utility.update_nodes(
    ox_element("mrow"),
    [mo_tag(open_paren), table_tag, mo_tag(close_paren)],
  )
end

#to_unicodemath(options:) ⇒ Object



41
42
43
44
45
46
# File 'lib/plurimath/math/function/table/matrix.rb', line 41

def to_unicodemath(options:)
  first_value = value.map do |v|
    v.to_unicodemath(options: options)
  end.join("@")
  "#{open_paren&.to_unicodemath(options: options)}■(#{first_value})#{close_paren&.to_unicodemath(options: options)}"
end