Wolfgang Jeltsch wrote:
TeX is not so great for mathematics and especially not for conversion into
MathML (which would be needed for HTML output). The TeX math language
provides rather little semantic information. As input language for the
concrete software named TeX this is mostly okay since the concrete rendering
algorithm of TeX doesn’t need certain information (for example, about
implicit bracketing).
However, even for rendering with TeX, you sometimes have to ressort to ugly
tricks since TeX sometimes misinterprets what you wrote. Knuth gives some
examples in chapter 18 of The TeXbook. For conversion into MathML, a TeX
source generally doesn’t have enough information since even presentation
MathML code contains much more structure than ordinary TeX source code does.
So using TeX as a general language for math is a very bad idea, in my opinion.
The problem is that there is no good language which provides enough
structural information for conversion into MathML and is at the same time
simple to write and read. Maybe, both requirements contradict.
I want for long to write math formulas in a paper in Haskell. Actually,
lhs2TeX can do such transformations but it is quite limited in handling
of parentheses and does not support more complicated transformations
(transforming prefix notation in infix notation or vice versa with
minimal parentheses).
I would like to write
sumFor [0..n] (\i -> i^2)
(with sumFor xs f = sum $ map f xs)
which is rendered as
\sum_{i=0}^{n} i^2
or
integrate 1000 (a,b) (\t -> f t)
to be rendered as
\int_a^b f(t) \dif t
I imagine some rule based configuration that is implemented using
haskell-src, that handles all identifiers, say, with prefix "parameter"
as wildcards:
sumFor [parameterA..parameterB] (\parameterI -> parameterS)
=> \sum_{parameterI=parameterA}^{parameterB} parameterS
Unfortunately a tool for this transformation still has to be written,
but wouldn't that be really cool? The tool might be even relatively
simple, but the configuration is certainly non-trivial and it would have
to be hard-wired into cabal in order to provide identical rendering on
all systems and output formats (TeX or MathML).
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe