Sha256: 06a5cbeafe41f67160838fec18611a5d450e3f296fc04f26c76393dfb38f7fff
Contents?: true
Size: 1.74 KB
Versions: 14
Compression:
Stored size: 1.74 KB
Contents
# frozen_string_literal: true require_relative "../table" module Plurimath module Math module Function class Table class Matrix < Table def initialize(value = [], open_paren = "(", close_paren = ")", options = {}) super end def to_asciimath(options:) ascii_value = value.map { |v| v.to_asciimath(options: options) }.join(", ") "{:#{ascii_value}:}" end def to_latex(options:) "\\begin#{opening}#{latex_content(options: options)}\\end#{matrix_class}" end def to_mathml_without_math_tag(intent, options:) table_tag = Utility.update_nodes( ox_element("mtable", attributes: table_attribute), value&.map { |object| object&.to_mathml_without_math_tag(intent, options: options) } ) return table_tag if table_tag_only? Utility.update_nodes( ox_element("mrow"), [mo_tag(open_paren), table_tag, mo_tag(close_paren)] ) end def to_unicodemath(options:) first_value = value.map { |v| v.to_unicodemath(options: options) }.join("@") "#{open_paren&.to_unicodemath(options: options)}■(#{first_value})#{close_paren&.to_unicodemath(options: options)}" end protected def mo_tag(paren) (ox_element("mo") << paren) unless validate_paren(paren) end def table_tag_only? (open_paren&.class_name == "lround" && close_paren&.class_name == "rround") || !(open_paren && close_paren) end end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems