Class: Symbol

Inherits:
Object
  • Object
show all
Defined in:
lib/texlab/macro.rb,
lib/texlab/macro.rb

Instance Method Summary collapse

Instance Method Details

#*(unit) ⇒ Object



49
50
51
# File 'lib/texlab/macro.rb', line 49

def * unit
  "\\unit[\\text{#{to_latex}}]{#{unit}}".latex!.to_latex_math
end

#+(str) ⇒ Object



45
46
47
# File 'lib/texlab/macro.rb', line 45

def + str
  "#{to_latex}#{str}".latex!.to_latex_math
end

#to_latexObject

symbol’s to_latex is the macro with the same name



41
42
43
# File 'lib/texlab/macro.rb', line 41

def to_latex
  $_macros[self] or raise "Undefined macro: #{self}"
end

#with_unitObject



91
92
93
94
95
96
97
98
# File 'lib/texlab/macro.rb', line 91

def with_unit
  raise "No unit defined for #{self}" unless $_units.key? self
  if $_units[self]
    self * "(#{$_units[self]})"
  else
    to_latex
  end
end