| Path: | README |
| Last Update: | 2010-04-13 09:01:14 -0400 |
| Author: | William Morgan (mailto: wmorgan-ritex@masanjin.net) |
| Copyright: | Copyright 2005—2010 William Morgan |
| License: | GNU GPL version 2 |
Ritex converts expressions from WebTeX into MathML. WebTeX is an adaptation of TeX math syntax for web display. Ritex supports most TeX math syntax, and supports macros.
For example, Ritex turns
\alpha^\beta
into
<math xmlns="http://www.w3.org/1998/Math/MathML">
<msup>
<mi>α</mi>
<mi>β</mi>
</msup>
</math>
To install, use RubyGems: gem install ritex. For examples and git instructions, see the home page: masanjin.net/ritex/
See the blog: all-thing.net/label/ritex/.
require 'rubygems'
require 'ritex'
p = Ritex::Parser.new
ARGF.each { |l| puts p.parse(l) }
## or ...
ARGF.each do |l|
begin
puts p.parse(l)
rescue Racc::ParseError
$stderr.puts "invalid input"
end
end
See the documentation for Ritex::Parser for gory details.
To be pedantic, Ritex is a WebTeX to MathML converter. WebTeX is an adapation of the TeX math syntax which is designed for web page display. WebTeX documentation can be found at:
http://stuff.mit.edu/afs/athena/software/webeq/currenthome/docs/webtex/toc.html
If you’re familiar with TeX math syntax, it’s mostly the same, but there are several important differences in WebTeX. Notably:
These differences are explained in the WebTeX documentation.
Ritex also supports many of itex2MML’s various extensions to WebTeX, mainly consisting of additional aliases (e.g. infinity for infty) and markup (e.g. underoverset).
itex2MML is another option for converting LaTeX-like math into MathML. It has Ruby bindings. Compared against itex2MML version 1.3.7 (3/7/2009), Ritex has several differences: