Module: Latexmath

Defined in:
lib/latexmath.rb,
lib/latexmath/symbol.rb,
lib/latexmath/version.rb,
lib/latexmath/equation.rb,
lib/latexmath/converter.rb,
lib/latexmath/tokenizer.rb,
lib/latexmath/aggregator.rb,
lib/latexmath/constants/symbols.rb

Defined Under Namespace

Modules: Constants, XML Classes: Aggregator, Converter, EmptyGroupError, Equation, Error, ExtraLeftOrMissingRight, MissingSuperScriptOrSubscript, StopIteration, Symbol, Tokenizer

Constant Summary collapse

MATRICES =
[
  '\\matrix',
  '\\matrix*',
  '\\pmatrix',
  '\\pmatrix*',
  '\\bmatrix',
  '\\bmatrix*',
  '\\Bmatrix',
  '\\Bmatrix*',
  '\\vmatrix',
  '\\vmatrix*',
  '\\Vmatrix',
  '\\Vmatrix*',
  '\\array',
  '\\split',
  '\\substack'
].freeze
SPACES =
['\\,', '\\:', '\\;', '\\\\'].freeze
STYLES =
{
  '\\bf' => 'mathbf'
}.freeze
LIMITS =
['\\lim', '\\sup', '\\inf', '\\max', '\\min'].freeze
COMMANDS =
{
  # command: [params_count, mathml_equivalent, attributes]
  '_' => [2, 'msub', {}],
  '^' => [2, 'msup', {}],
  '_^' => [3, 'msubsup', {}],
  '\\frac' => [2, 'mfrac', {}],
  '\\sqrt' => [1, 'msqrt', {}],
  '\\root' => [2, 'mroot', {}],
  '\\binom' => [2, 'mfrac', { "linethickness": '0' }],
  '\\left' => [
    1,
    'mo',
    [%w[stretchy true], %w[fence true], %w[form prefix]]
  ],
  '\\right' => [
    1,
    'mo',
    [%w[stretchy true], %w[fence true], %w[form postfix]]
  ],
  '\\overline' => [1, 'mover', {}],
  '\\bar' => [1, 'mover', {}],
  '\\underline' => [1, 'munder', {}],
  '\\limits' => [3, 'munderover', {}],
  '\\overrightarrow' => [1, 'mover', {}]
}
VERSION =
'0.1.5'.freeze

Class Method Summary collapse

Class Method Details

.parse(string) ⇒ Object



80
81
82
83
84
85
# File 'lib/latexmath.rb', line 80

def self.parse(string)
  lxm_input = HTMLEntities.new.decode(string)

  # parse
  Equation.new(lxm_input)
end