Class: Plurimath::Math::Function::Log
Constant Summary
collapse
- FUNCTION =
{
name: "function apply",
first_value: "subscript",
second_value: "supscript",
}
Constants inherited
from Core
Core::ALL_PARAMETERS, Core::REPLACABLES
Instance Attribute Summary
#hide_function_name, #parameter_one, #parameter_two
Instance Method Summary
collapse
#==, #all_values_exist?, #any_value_exist?, #initialize, #to_asciimath_math_zone, #to_latex_math_zone, #to_mathml_math_zone, #to_omml_math_zone, #to_unicodemath_math_zone
Methods inherited from Core
#ascii_fields_to_print, #class_name, #cloned_objects, #common_math_zone_conversion, descendants, #dump_mathml, #dump_nodes, #dump_omml, #dump_ox_nodes, #empty_tag, #extract_class_name_from_text, #extractable?, #filtered_values, #font_style_t_tag, #get, #gsub_spacing, inherited, #insert_t_tag, #invert_unicode_symbols, #is_binary_function?, #is_mrow?, #is_mstyle?, #is_nary_function?, #is_nary_symbol?, #is_ternary_function?, #is_unary?, #latex_fields_to_print, #linebreak?, #mathml_fields_to_print, #mini_sized?, #nary_attr_value, #nary_intent_name, #omml_fields_to_print, #omml_nodes, #omml_parameter, #omml_tag_name, #ox_element, #paren?, #pretty_print_instance_variables, #prime_unicode?, #r_element, #replacable_values, #result, #separate_table, #set, #symbol?, #tag_name, #to_ms_value, #unicodemath_fields_to_print, #unicodemath_parens, #updated_object_values, #validate_function_formula, #validate_mathml_fields, #variable_value, #variables
Instance Method Details
#line_breaking(obj) ⇒ Object
75
76
77
78
79
80
81
82
83
|
# File 'lib/plurimath/math/function/log.rb', line 75
def line_breaking(obj)
parameter_one&.line_breaking(obj)
if obj.value_exist?
log = self.class.new(Utility.filter_values(obj.value), parameter_two)
self.parameter_two = nil
log.hide_function_name = true
obj.update(log)
end
end
|
#to_asciimath(options:) ⇒ Object
15
16
17
18
19
|
# File 'lib/plurimath/math/function/log.rb', line 15
def to_asciimath(options:)
first_value = "_#{wrapped(parameter_one, options: options)}" if parameter_one
second_value = "^#{wrapped(parameter_two, options: options)}" if parameter_two
"log#{first_value}#{second_value}"
end
|
#to_html(options:) ⇒ Object
27
28
29
30
31
|
# File 'lib/plurimath/math/function/log.rb', line 27
def to_html(options:)
first_value = "<sub>#{parameter_one.to_html(options: options)}</sub>" if parameter_one
second_value = "<sup>#{parameter_two.to_html(options: options)}</sup>" if parameter_two
"<i>log</i>#{first_value}#{second_value}"
end
|
#to_latex(options:) ⇒ Object
21
22
23
24
25
|
# File 'lib/plurimath/math/function/log.rb', line 21
def to_latex(options:)
first_value = "_#{latex_wrapped(parameter_one, options: options)}" if parameter_one
second_value = "^#{latex_wrapped(parameter_two, options: options)}" if parameter_two
"\\log#{first_value}#{second_value}"
end
|
#to_mathml_without_math_tag(intent, options:) ⇒ Object
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/plurimath/math/function/log.rb', line 51
def to_mathml_without_math_tag(intent, options:)
first_value = ox_element("mi")
first_value << "log" unless hide_function_name
return first_value unless parameter_one || parameter_two
tag_name = if parameter_two && parameter_one
"subsup"
else
parameter_one ? "sub" : "sup"
end
new_arr = [
first_value,
validate_mathml_fields(parameter_one, intent, options: options),
validate_mathml_fields(parameter_two, intent, options: options),
]
Utility.update_nodes(ox_element("m#{tag_name}"), new_arr)
end
|
#to_omml_without_math_tag(display_style, options:) ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/plurimath/math/function/log.rb', line 33
def to_omml_without_math_tag(display_style, options:)
return r_element("log", rpr_tag: false) unless all_values_exist?
ssubsup = Utility.ox_element("sSubSup", namespace: "m")
ssubsuppr = Utility.ox_element("sSubSupPr", namespace: "m")
ssubsuppr << Utility.pr_element("ctrl", true, namespace: "m")
Utility.update_nodes(
ssubsup,
[
ssubsuppr,
e_parameter,
omml_parameter(parameter_one, display_style, tag_name: "sub", options: options),
omml_parameter(parameter_two, display_style, tag_name: "sup", options: options),
],
)
[ssubsup]
end
|
#to_unicodemath(options:) ⇒ Object
69
70
71
72
73
|
# File 'lib/plurimath/math/function/log.rb', line 69
def to_unicodemath(options:)
first_value = sub_value(options: options) if parameter_one
second_value = sup_value(options: options) if parameter_two
"log#{first_value}#{second_value}"
end
|