Class: Plurimath::Math::Function::Table::Bmatrix

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

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Bmatrix.



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

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

Instance Method Details

#to_latex(options:) ⇒ Object



15
16
17
# File 'lib/plurimath/math/function/table/bmatrix.rb', line 15

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

#to_mathml_without_math_tag(intent, options:) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/plurimath/math/function/table/bmatrix.rb', line 19

def to_mathml_without_math_tag(intent, options:)
  table_tag = ox_element("mtable", attributes: table_attribute)
  if intent
    table_tag["intent"] =
      ":matrix(#{value.length},#{td_count})"
  end
  Utility.update_nodes(
    table_tag,
    value&.map do |object|
      object&.to_mathml_without_math_tag(intent, options: options)
    end,
  )
  Utility.update_nodes(
    ox_element("mrow", attributes: intent_attr(intent)),
    [
      mo_element(mathml_parenthesis(open_paren, intent,
                                    options: options)),
      table_tag,
      mo_element(mathml_parenthesis(close_paren, intent,
                                    options: options)),
    ],
  )
end

#to_unicodemath(options:) ⇒ Object



43
44
45
46
47
48
# File 'lib/plurimath/math/function/table/bmatrix.rb', line 43

def to_unicodemath(options:)
  unicode_value = value.map do |val|
    val.to_unicodemath(options: options)
  end.join("@")
  "#{matrix_symbol}(#{unicode_value})"
end