From: W. Trevor King Date: Tue, 14 Sep 2010 06:41:35 +0000 (-0400) Subject: Added math notes _doc/math.shtml. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=81eacef2f67cc048a3fb1f4bf7578fa260dcfee6;p=parallel_computing.git Added math notes _doc/math.shtml. --- diff --git a/_doc/math.shtml b/_doc/math.shtml new file mode 100644 index 0000000..939d74d --- /dev/null +++ b/_doc/math.shtml @@ -0,0 +1,97 @@ + + +

Math Markup

+ +

Use Unicode instead of entities

+ + + + + + + + + + + + +
SymbolEntity LaTeX Unicode
— — --- ? EM DASH, U+2014
– – -- ? EN DASH, U+2013
è è ? LATIN SMALL LETTER E WITH GRAVE, U+00E8
Γ Γ \Gamma GREEL CAPITAL LETTER GAMMA, U+0393
Ω Ω \Omega GREEL CAPITAL LETTER OMEGA, U+03A9
π π \pi GREEK SMALL LETTER PI, U+03C0
∫ ∫ \int INTEGRAL, U+222B
〈 ? \langle LEFT-POINTING ANGLE BRACKET, U+2329
〉 ? \rangle RIGHT-POINTING ANGLE BRACKET, U+232A
+ +

Gucharmap is a useful +utility for looking up unicode symbols.

+ +

Compiling itex to MathML

+ +

Using itex2MML:

+ +
+$ cat index.shtml.itex2MML | itex2MML --forbid-markup --unicode-entities > index.shtml
+
+ +

Or in bulk +with math.sh. --unicode-entities +is an addition I've made to the original itex2MML to make +it play more nicely +with lxml. Pull my altered +repository with

+ +
+$ bzr clone bzr+ssh://einstein/home/einstein/wking/public_html/code/bzr/itexToMML
+
+ +

blahtex(ml)

+ +

An alternative to itex2MML +is blahtex(ml) which +is very similar. In my very haphazard initial testing, I ran into +some problems with equation lists that itex2MML seemed to handle +better. It's easy to try both and pick whichever one you like better. +I was missing a dependency needed for the full-file +filter blahtexml, so I only tested the +single-block blahtex form.

+ +
+$ echo '...' | blahtex --mathml --mathml-encoding raw --spacing relaxed --displaymath
+
+ +

or for multi-line source

+ +
+$ cat << EOF | /tmp/blahtexml-0.8/blahtex --mathml --mathml-encoding raw --spacing relaxed --displaymath  
+>     I = \int_{-1}^{1} dx \int_{-1}^{1} dy
+>         \begin{cases}
+>           1 & \text{if $x^2+y^2 \leq 1$} \\
+>           0 & \text{if $x^2+y^2 \gt 1}
+>         \end{cases}
+> EOF
+
+ +

The output will look something like

+ +
+<blahtex>
+<mathml>
+<markup>
+...
+</markup>
+</mathml>
+</blahtex>
+
+ +

Pull the ... section out and paste it (and your source +LaTeX) into

+ +
+<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
+  <!--annotation encoding="LaTeX">                                             
+    ...source LaTeX...
+  </annotation-->
+  ...blahtex output...
+</math>
+
+ +

I've commented <!--...--> the annotation section +because w3m displays both, +presumably because it doesn't know about MathML.

+ +