Help wanted with TeX/MathTran bookmarklet for math on web pages

J

Jonathan Fine

If you care about mathematics on the web, this might be for you. I'm the
lead developer of MathTran, a web service that provides TeX for math
formulas as web service. Visit http://www.mathtran.org to get a sense of
what it can do.

My colleague Tim Hunt has written a really neat Javascript bookmarklet that
replaces
$$x^2 + y^2 = 1$$
on web page by an image
<img src="http://www.mathtran.org/ .... ">
that gives the rendered version of this equation.

I want help in developing it further, in part I don't have much experience
in writing Javascript. (It's possible that I can pay for help.) What I'm
wanting to develop is browser extensions, plugins or whatever that give
users a lot of help in displaying and writing mathematics.

If you're interested in this, please reply to this list, or email me
directly.
 
T

Thomas 'PointedEars' Lahn

Jonathan said:
Apologies: I did not give the URL for the bookmarklet.

http://www.mathtran.org/wiki/index.php/MathTran_bookmarklet

While I think it's not a completely bad idea, I doubt the possibility of its
practical application. For a start, as a script-dependent application that
runs client-side it does not degrade gracefully by default, while the
currently available server-side solutions at least work without client-side
script support. It shares with those (like the one used in MediaWiki) the
drawback that the result cannot be interpreted by screen reader software
without OCR.

There's MathML to address these problems, there is Unicode that provides the
code points, and there are Unicode fonts that provide the necessary glyphs;
people should start using MathML and the like or there will never be broad
support for it and we'll be staying forever in these dark ages where you
have to construct an image for a text in order to display it properly.

One should at least generate an image for each symbol and provide it with an
`alt' attribute value.

I also don't like this dependency on your Web site, hard-coded into the
bookmarklet. Once that is gone or moves elsewhere, this bookmarklet will no
produce viable results. And *theoretically*, you could track people and the
Web sites where they are using it.


PointedEars
 
J

Jonathan Fine

Thomas 'PointedEars' Lahn said:
While I think it's not a completely bad idea, I doubt the possibility of its
practical application. For a start, as a script-dependent application that
runs client-side it does not degrade gracefully by default, while the
currently available server-side solutions at least work without client-side
script support. It shares with those (like the one used in MediaWiki) the
drawback that the result cannot be interpreted by screen reader software
without OCR.

Some of this discussion might be off-topic for this group, so if you care
only about Javascript perhaps you should not read on.

I do have confidence that it work in many (perhaps not a majority) of areas.
The key thing for me is that it work with content that I contribute (and you
read) on a third party website. For example, a web-mail site. The
'degradation' is that you get
$$x^2+y^=1$$
instead of a rendered version of this formula.
There's MathML to address these problems, there is Unicode that provides the
code points, and there are Unicode fonts that provide the necessary glyphs;
people should start using MathML and the like or there will never be broad
support for it and we'll be staying forever in these dark ages where you
have to construct an image for a text in order to display it properly.

I won't be able to use MathML when I post a comment to a blog, unless the
blog host supports MathML. The bookmarklet solution will work on most
blogs, and without anything changing on the blog website. There's quite a
lot of interest in MathML and TeX outside this forum, and it's somewhat
off-topic here. So I'm intending to put to post to my blog on this topic
soon.
One should at least generate an image for each symbol and provide it with an
`alt' attribute value.

I agree, and it's something that's talked about on the MathTran home page,
and also on my blog posts.
I also don't like this dependency on your Web site, hard-coded into the
bookmarklet. Once that is gone or moves elsewhere, this bookmarklet will no
produce viable results. And *theoretically*, you could track people and the
Web sites where they are using it.

The software on http://www.mathtran.org that serves the images is open
source. You could, if you wish, set up and run your own MathTran server.
Yes, this solution will make many people 'visitors' to the MathTran website.
But Google offers a similar interface to its Charts API, and I've not heard
anyone object to it on these grounds. But you do have a point. MathTran
needs to formulate and publish privacy and data protection policies.

Here's some URLS:

http://jonathanfine.wordpress.com/2008/01/14/google-charts-mathtran-and-editable-png-files/

http://jonathanfine.wordpress.com/2008/02/27/using-mathtran-in-blogs-and-wikis/
http://www.mathtran.org/download.html
 
J

Jonathan Fine

Topic as subject:

I've made some progress, which is published at:

http://mathtran.cvs.sourceforge.net/mathtran/client/bookmarklet/generate.py?revision=1.2&view=markup

Briefly, I've created a Javascript snippet that replaces
$$<formula>$$
by
<img src="http://www.mathtran.org/...<formula>">
I'm calling it 'doit', and clearly I also need an 'undoit' script.

According to Jess Ruderman, there's a 508 character limit on bookmarklets in
IE 6.0.

http://www.squarefree.com/2005/01/12/internet-explorer-drops-support-for-bookmarklets/

The generate.py file above contains a transformation for compressing
Javascript code, which reduces Tim Hunt's original code from 660 bytes to
495 (phew!), which might be of independent interest.

For example, the compressor http://www.creativyst.com/Prod/3/ cuts it down
to 574 bytes (too big). I also looked at http://compressor.ebiene.de/, and
that cuts it down to 640 bytes.
 
T

Thomas 'PointedEars' Lahn

Jonathan said:
Some of this discussion might be off-topic for this group, so if you care
only about Javascript perhaps you should not read on.

I do have confidence that it work in many (perhaps not a majority) of areas.
The key thing for me is that it work with content that I contribute (and you
read) on a third party website. For example, a web-mail site. The
'degradation' is that you get
$$x^2+y^=1$$
instead of a rendered version of this formula.

A screen reader such as DeskBot reads this as "dollar dollar x caret two
plus y caret equals one dollar dollar". One could only hope for a screen
reader to read "x^2" as "x squared" instead.

I suggest you find a format that degrades more gracefully.


Your reply was not easily legible (see also the unchanged quotation above).
Please find ways to work around the flaws of your posting agent, or find
a better posting agent in the first place. For Windows, I can recommend
Mozilla Thunderbird the most; it requires little configuration to be
compliant and it can also import your OE's settings and files.

http://insideoe.com/
http://mozilla.com/thunderbird/


PointedEars
 
J

Jonathan Fine

Thomas said:
A screen reader such as DeskBot reads this as "dollar dollar x caret two
plus y caret equals one dollar dollar". One could only hope for a screen
reader to read "x^2" as "x squared" instead.

I suggest you find a format that degrades more gracefully.

I don't think there is one. Do you know of anything better than
TeX-encoding for this purpose?

If there was a web service that translated
x^2
into
x squared
then one could write Javascript that replaced
$$x^2$$
on the web page by
x squared
and perhaps bring benefits to user who use on audio rendering.
Your reply was not easily legible (see also the unchanged quotation above).
Please find ways to work around the flaws of your posting agent, or find
a better posting agent in the first place.

Thank you for this nudge. I'm now using Thunderbird.
 
T

Thomas 'PointedEars' Lahn

Jonathan said:
I don't think there is one. Do you know of anything better than
TeX-encoding for this purpose?

If there was a web service that translated
x^2
into
x squared
then one could write Javascript that replaced
$$x^2$$
on the web page by
x squared
and perhaps bring benefits to user who use on audio rendering.

You could replace the dollar characters with something less obtrusive for a
start.
Thank you for this nudge. I'm now using Thunderbird.

Thanks. You may not have found the Edit, Rewrap command yet. I found it
very convenient to add it as a button to the toolbar. You have to be
careful with postings that contain source code, though, for that will be
uglified ;-)


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top