Class: Sum
Instance Method Summary collapse
-
#initialize(*some_summands) ⇒ Sum
constructor
A new instance of Sum.
- #latex ⇒ Object
Methods inherited from Latex
#*, #**, #+, #-, #-@, #/, #glue, #is, #my_json, #ne, #of, #to_ltx, #wrap
Constructor Details
#initialize(*some_summands) ⇒ Sum
Returns a new instance of Sum.
153 154 155 |
# File 'lib/annlat/LaRuby.rb', line 153 def initialize(*some_summands) @summands = some_summands.map(&:to_ltx) end |
Instance Method Details
#latex ⇒ Object
157 158 159 160 161 |
# File 'lib/annlat/LaRuby.rb', line 157 def latex str = @summands[0].latex @summands[1..-1].each{|a| a.kind_of?(Negative) ? str += (a.latex) : str += ('+' + a.latex)} str end |