bzr branch
http://golem.ph.utexas.edu/~distler/code/itexToMML/
|
1
by Jacques Distler
Initial commit. |
1 |
INTRODUCTION: |
2 |
||
|
81
by Jacques Distler
New version of MovableType plugin |
3 |
This package contains the distribution for itex2MML. The source code is in the |
|
2
by Jacques Distler
Updated README (duh!). |
4 |
itex-src directory. It should compile on most platforms by simply typing |
5 |
||
6 |
make |
|
7 |
sudo make install |
|
8 |
||
|
4
by Jacques Distler
Update MovableType plugin to support equation numbering and cross-referencing. |
9 |
The resulting itex2MML binary is a stream filter. It takes text with embedded |
10 |
itex equations on STDIN, converts the itex equations to MathML, and outputs |
|
11 |
the resulting text on STDOUT. |
|
12 |
||
|
47
by Jacques Distler
Update README |
13 |
Also included are Ruby bindings. The easiest way to obtain them, with a recent version of Rubygems is |
14 |
||
15 |
gem install itextomml |
|
16 |
||
17 |
Alternatively, if you have GNU make and SWIG 1.3, they can be |
|
18 |
built manually with |
|
|
2
by Jacques Distler
Updated README (duh!). |
19 |
|
20 |
make ruby |
|
21 |
make test_ruby |
|
22 |
sudo make install_ruby |
|
|
1
by Jacques Distler
Initial commit. |
23 |
|
|
81
by Jacques Distler
New version of MovableType plugin |
24 |
The Rubygem provides four public methods |
|
3
by Jacques Distler
Added two new methods to the Ruby bindings. |
25 |
|
|
47
by Jacques Distler
Update README |
26 |
require 'itextomml' |
27 |
itex = Itex2MML::Parser.new |
|
28 |
||
|
3
by Jacques Distler
Added two new methods to the Ruby bindings. |
29 |
itex.html_filter(a_string) |
30 |
converts all itex equations in a_string to MathML, passing the |
|
31 |
rest of a_string unmodified. Returns the converted string. |
|
32 |
||
33 |
itex.filter(a_string) |
|
34 |
converts all itex equations in a_string to MathML. Returns just |
|
35 |
the MathML equation(s), as a string. |
|
36 |
||
37 |
itex.inline_filter(a_string) |
|
38 |
treats a_string as an inline equation (automatically supplies |
|
39 |
the surrounding $...$, so you don't have to) and converts it |
|
40 |
MathML. Returns the MathML inline equation, as a string. |
|
41 |
||
42 |
itex.block_filter(a_string) |
|
43 |
treats a_string as a block equation (automatically supplies |
|
44 |
the surrounding $$...$$, so you don't have to) and converts it |
|
45 |
MathML. Returns the MathML block equation, as a string. |
|
|
58
by Jacques Distler
Nested Extensible Arrows |
46 |
|
47 |
Note that the commandline tool and the Ruby library return MathML named entities in the output. |
|
48 |
On the public web, it is safest to convert these either to utf-8 characters or to NCRs. For that, |
|
|
81
by Jacques Distler
New version of MovableType plugin |
49 |
the itex_stringsupport.rb library included with the Rubygem adds the following methods to the String class |
|
58
by Jacques Distler
Nested Extensible Arrows |
50 |
String#to_ncr |
51 |
String to_utf8 |
|
52 |
String#to_ncr! |
|
53 |
and |
|
54 |
String#to_utf8! |
|
|
81
by Jacques Distler
New version of MovableType plugin |
55 |
|
56 |
For Perl users, there are Perl modules, MathML::itex2MML and MathML::Entities (both available on CPAN), which |
|
57 |
provide exactly the same functionality as described for the Rubygem. |
|
|
3
by Jacques Distler
Added two new methods to the Ruby bindings. |
58 |
|
59 |
Finally, there is a MovableType (2.6 or greater) plugin which provides two |
|
|
1
by Jacques Distler
Initial commit. |
60 |
Text Filtering options: |
|
4
by Jacques Distler
Update MovableType plugin to support equation numbering and cross-referencing. |
61 |
|
|
1
by Jacques Distler
Initial commit. |
62 |
1) itex to MathML |
63 |
2) itex to MathML with parbreaks |
|
64 |
||
|
81
by Jacques Distler
New version of MovableType plugin |
65 |
The plugin relies on the MathML::itex2MML Perl module (which you'll need to install) to do the actual |
|
1
by Jacques Distler
Initial commit. |
66 |
conversion. The first filter is a straight itex2MML translation. The latter |
67 |
uses the "TeX" (and blogger's) convention that two linebreaks in succession |
|
68 |
signify a new paragraph. (The bloggers also like to convert single linebreaks |
|
69 |
to <br />, but that would mess with TeX formula entry, so we don't support it.) |
|
70 |
||
|
4
by Jacques Distler
Update MovableType plugin to support equation numbering and cross-referencing. |
71 |
A second plugin (also included) provides additionalText Filtering options: |
72 |
||
73 |
1) Textile with itex to MathML |
|
74 |
2) Markdown with itex to MathML |
|
75 |
||
76 |
Details describing this plugin are available at: |
|
|
1
by Jacques Distler
Initial commit. |
77 |
|
78 |
http://golem.ph.utexas.edu/~distler/blog/archives/000374.html |
|
79 |
||
|
4
by Jacques Distler
Update MovableType plugin to support equation numbering and cross-referencing. |
80 |
It requires both the itex2MML plugin and the Textile and/or Markdown plugins. |
|
1
by Jacques Distler
Initial commit. |
81 |
|
82 |
See |
|
83 |
http://golem.ph.utexas.edu/~distler/blog/itex2MMLcommands.html |
|
|
4
by Jacques Distler
Update MovableType plugin to support equation numbering and cross-referencing. |
84 |
|
|
1
by Jacques Distler
Initial commit. |
85 |
for more details on composing in itex and using the itex2MML program. |
|
4
by Jacques Distler
Update MovableType plugin to support equation numbering and cross-referencing. |
86 |
The version of itex2MML included here is greatly-enhanced, with |
|
1
by Jacques Distler
Initial commit. |
87 |
many bugfixes and support for a larger subset of LaTeX/AMSLaTeX syntax. |
88 |
||
89 |
Below I've put some simple notes specific to the use of this plugin. |
|
90 |
||
91 |
USAGE NOTES: |
|
92 |
||
93 |
1) Tex equations are delimited by $...$ (inline) or \[...\] (display). |
|
94 |
Alternatively, $$...$$ can also be used to delimit display equations. So, |
|
95 |
just as in a TeX document, be sure you don't have any free-floating $'s |
|
96 |
in your text. If you want to enter something that renders as a $, use |
|
97 |
the unicode entity $. |
|
98 |
||
|
4
by Jacques Distler
Update MovableType plugin to support equation numbering and cross-referencing. |
99 |
2) The itex2MML stream filter does not distinguish between $$...$$ and \[...\]. |
100 |
Both result in display equations. However, the MovableType plugin and Maruku |
|
101 |
||
102 |
http://maruku.rubyforge.org/ |
|
103 |
||
104 |
the Ruby Markdown implementation, do distinguish between them. Both have |
|
105 |
automatic equation-numbering: \[...\] results in a numbered equation. You |
|
106 |
can add an optional label |
|
107 |
||
108 |
\[...\label{foo}...\]
|
|
109 |
||
110 |
and then you can refer to the equation with either (eq:foo) or \eqref{foo}.
|
|
111 |
These are automatically turned into hyperlinks. |
|
112 |
||
|
1
by Jacques Distler
Initial commit. |
113 |
2) If you are using the "itex to MathML with parbreaks" filter, paragraph |
|
4
by Jacques Distler
Update MovableType plugin to support equation numbering and cross-referencing. |
114 |
breaks are inserted automatically, whenever you insert a blank line in your |
115 |
text. If you are using the plain "itex to MathML" filter, you need to put |
|
116 |
in the paragraph (and any other) XHTML tags yourself. |
|
|
1
by Jacques Distler
Initial commit. |
117 |
|
118 |
3) Mozilla only renders MathML when you serve the document as XML (ie |
|
|
4
by Jacques Distler
Update MovableType plugin to support equation numbering and cross-referencing. |
119 |
using the MIME type application/xhtml+xml rather than text/html). You had |
120 |
better be producing 100% valid XHTML if you want to see *anything* when Mozilla |
|
|
1
by Jacques Distler
Initial commit. |
121 |
is operating in that mode. |
122 |
||
123 |
4)The best way to serve up XML to Mozilla, while still catering to |
|
124 |
other browsers is to use mod_rewrite rules in the .htaccess file of your |
|
125 |
blog. See |
|
126 |
http://golem.ph.utexas.edu/~distler/blog/archives/000167.html |
|
127 |
for how to do that. |
|
128 |
||
|
4
by Jacques Distler
Update MovableType plugin to support equation numbering and cross-referencing. |
129 |
PLUGIN INSTALLATION INSTRUCTIONS: |
|
1
by Jacques Distler
Initial commit. |
130 |
|
|
4
by Jacques Distler
Update MovableType plugin to support equation numbering and cross-referencing. |
131 |
1) Put the contents of the plugins directory into your MovableType plugins |
132 |
directory. |
|
|
1
by Jacques Distler
Initial commit. |
133 |
|
134 |
2) If you are running MacOSX or Linux, I've provided a precompiled binary, |
|
135 |
so you can skip to step 3). |
|
136 |
If these don't do the trick for you, or if you prefer to compile your own, |
|
137 |
cd into the itex-src directory and type "make". The result should be an itex2MML |
|
138 |
binary for your architecture. |
|
139 |
||
|
81
by Jacques Distler
New version of MovableType plugin |
140 |
3) Run |
141 |
cpan install MathML::itex2MML |
|
142 |
||
143 |
to install the Perl Module |
|
|
1
by Jacques Distler
Initial commit. |
144 |
|
|
47
by Jacques Distler
Update README |
145 |
Itex2MML is Open Source software, released under a triple license: GPL, MPL and LGPL. |