# File lib/math_ml/latex.rb, line 710 def initialize add_commands("\\"=>:backslash) add_commands("entity", "stackrel", "frac", "sqrt", "mbox") add_multi_command(:hat_etc, 'hat', 'breve', 'grave', 'acute', 'dot', 'ddot', 'tilde', 'bar', 'vec', 'check', 'widehat', 'overline', 'widetilde', 'overbrace') add_multi_command(:underbrace_etc, 'underbrace', 'underline') add_multi_command(:quad_etc, " ", "quad", "qquad", ",", ":", ";", "!") add_multi_command(:it_etc, "it", "rm", "bf") add_multi_command(:mathit_etc, "mathit", "mathrm", "mathbf", "bm", "mathbb", "mathscr", "mathfrak") add_sym_cmd(Builtin::Symbol::MAP) add_delimiter(Builtin::Symbol::DELIMITERS) super end
# File lib/math_ml/latex.rb, line 724 def cmd_backslash @ds ? nil : XMLElement.new("br", "xmlns"=>"http://www.w3.org/1999/xhtml") end
# File lib/math_ml/latex.rb, line 738 def cmd_entity param = @scanner.scan_block ? @scanner[1] : @scanner.scan(/./) raise ParseError.new("Need parameter.") unless param unless @unsecure_entity || @entities[param] param =@scanner.matched[/\A\{#{RE::SPACE}*(.*\})\z/, 1] if @scanner.matched=~RE::BLOCK @scanner.pos = @scanner.pos-(param.size) raise ParseError.new("Unregistered entity.") end Operator.new << entitize(param) end
# File lib/math_ml/latex.rb, line 804 def cmd_frac n = parse_any; d = parse_any Frac.new(n, d) end
# File lib/math_ml/latex.rb, line 728 def cmd_hat_etc com = @scanner[1] Over.new(parse_any, Operator.new << entitize(OVERS[com])) end
# File lib/math_ml/latex.rb, line 773 def cmd_it_etc case @scanner[1] when 'it' @font = Font::NORMAL when 'rm' @font = Font::ROMAN when 'bf' @font = Font::BOLD end nil end
# File lib/math_ml/latex.rb, line 785 def cmd_mathit_etc case @scanner[1] when 'mathit' parse_mathfont(Font::NORMAL) when 'mathrm' parse_mathfont(Font::ROMAN) when 'mathbf' parse_mathfont(Font::BOLD) when 'bm' parse_mathfont(Font::BOLD_ITALIC) when 'mathbb' parse_mathfont(Font::BLACKBOLD) when 'mathscr' parse_mathfont(Font::SCRIPT) when 'mathfrak' parse_mathfont(Font::FRAKTUR) end end
# File lib/math_ml/latex.rb, line 820 def cmd_mbox @scanner.scan_any Text.new << (@scanner.matched =~ RE::BLOCK ? @scanner[1] : @scanner.matched) end
# File lib/math_ml/latex.rb, line 754 def cmd_quad_etc case @scanner[1] when ' ' Space.new("1em") when 'quad' Space.new("1em") when 'qquad' Space.new("2em") when ',' Space.new("0.167em") when ':' Space.new("0.222em") when ';' Space.new("0.278em") when '!' Space.new("-0.167em") end end
# File lib/math_ml/latex.rb, line 809 def cmd_sqrt if @scanner.scan_option i = parse_into(@scanner[1], Array.new) i = i.size==1 ? i[0] : (Row.new << i) b = parse_any Root.new(i, b) else Sqrt.new << parse_any end end
Generated with the Darkfish Rdoc Generator 2.