Class: AsciiMath::LatexBuilder
- Inherits:
-
Object
- Object
- AsciiMath::LatexBuilder
- Defined in:
- lib/asciimath/latex.rb
Constant Summary collapse
- DEFAULT_DISPLAY_SYMBOL_TABLE =
{ :plus => ?+, :minus => ?-, :ast => ?*, :slash => ?/, :eq => ?=, :ne => "\\neq", :assign => ":=", :lt => ?<, :mlt => "\\ll", :gt => ?>, :mgt => "\\gg", :sub => "\\text{–}", :sup => "\\text{^}", :implies => "\\Rightarrow", :iff => "\\Leftrightarrow", :if => "\\operatorname{if}", :and => "\\operatorname{and}", :or => "\\operatorname{or}", :lparen => ?(, :rparen => ?), :lbracket => ?[, :rbracket => ?], :lbrace => "\\{", :rbrace => "\\}", :lvert => "\\lVert", :rvert => "\\rVert", :vbar => ?|, nil => ?., :integral => "\\int", :dx => "dx", :dy => "dy", :dz => "dz", :dt => "dt", :contourintegral => "\\oint", :Lim => "\\operatorname{Lim}", :Sin => "\\operatorname{Sin}", :Cos => "\\operatorname{Cos}", :Tan => "\\operatorname{Tan}", :Sinh => "\\operatorname{Sinh}", :Cosh => "\\operatorname{Cosh}", :Tanh => "\\operatorname{Tanh}", :Cot => "\\operatorname{Cot}", :Sec => "\\operatorname{Sec}", :Csc => "\\operatorname{Csc}", :sech => "\\operatorname{sech}", :csch => "\\operatorname{csch}", :Abs => "\\operatorname{Abs}", :Log => "\\operatorname{Log}", :Ln => "\\operatorname{Ln}", :lcm => "\\operatorname{lcm}", :lub => "\\operatorname{lub}", :glb => "\\operatorname{glb}", :partial => "\\del", :prime => ?', :tilde => "\\tilde", :nbsp => "\\;", :lceiling => "\\lceil", :rceiling => "\\rceil", :dstruck_captial_c => "\\mathbb{C}", :dstruck_captial_n => "\\mathbb{N}", :dstruck_captial_q => "\\mathbb{Q}", :dstruck_captial_r => "\\mathbb{R}", :dstruck_captial_z => "\\mathbb{Z}", :f => "f", :g => "g", :to => "\\rightarrow", :ellipsis => "\\ldots", :bold => "\\mathbf", :double_struck => "\\mathbb", :italic => "\\mathit", :bold_italic => "\\mathbf", :script => "\\mathscr", :bold_script => "\\mathscr", :monospace => "\\mathtt", :fraktur => "\\mathfrak", :bold_fraktur => "\\mathfrak", :sans_serif => "\\mathsf", :bold_sans_serif => "\\mathsf", :sans_serif_italic => "\\mathsf", :sans_serif_bold_italic => "\\mathsf", :roman => "\\mathrm", }.freeze
Instance Attribute Summary collapse
-
#symbol_table ⇒ Object
readonly
Returns the value of attribute symbol_table.
Instance Method Summary collapse
- #append_expression(expression) ⇒ Object
-
#initialize(symbol_table = nil) ⇒ LatexBuilder
constructor
A new instance of LatexBuilder.
- #to_s ⇒ Object
Constructor Details
#initialize(symbol_table = nil) ⇒ LatexBuilder
Returns a new instance of LatexBuilder.
7 8 9 10 |
# File 'lib/asciimath/latex.rb', line 7 def initialize(symbol_table = nil) @latex = '' @symbol_table = symbol_table.nil? ? DEFAULT_DISPLAY_SYMBOL_TABLE : symbol_table end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object (private)
287 288 289 |
# File 'lib/asciimath/latex.rb', line 287 def method_missing(meth, *args, &block) macro(meth, *args, &block) end |
Instance Attribute Details
#symbol_table ⇒ Object (readonly)
Returns the value of attribute symbol_table.
5 6 7 |
# File 'lib/asciimath/latex.rb', line 5 def symbol_table @symbol_table end |
Instance Method Details
#append_expression(expression) ⇒ Object
16 17 18 19 |
# File 'lib/asciimath/latex.rb', line 16 def append_expression(expression) append(expression) self end |
#to_s ⇒ Object
12 13 14 |
# File 'lib/asciimath/latex.rb', line 12 def to_s @latex end |