Class: Numerals::Format::LatexNotation
- Defined in:
- lib/numerals/format/notations/latex.rb
Instance Attribute Summary
Attributes inherited from Notation
Instance Method Summary collapse
Methods inherited from Notation
Constructor Details
This class inherits a constructor from Numerals::Format::Notation
Instance Method Details
#assemble(output, text_parts) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/numerals/format/notations/latex.rb', line 7 def assemble(output, text_parts) # 1.23\overline{456}\times10^{9} if text_parts.special? output << text_parts.special else output << text_parts.sign output << text_parts.integer # or decide here if empty integer part is shown as 0? unless !text_parts.fractional? && !text_parts.repeat? && !format.symbols.show_point output << format.symbols.point end output << text_parts.fractional if text_parts.repeat? output << "\\overline{#{text_parts.repeat}}" end if text_parts.exponent_value != 0 || format.mode.mode == :scientific output << "\\times" output << text_parts.exponent_base output << "^" output << "{#{text_parts.exponent}}" end end end |