Displaying MathML equations in a tiddler

81 views
Skip to first unread message

Milind

unread,
Nov 11, 2011, 2:47:43 PM11/11/11
to TiddlyWiki
Hi,
I have this Math ML xml file that I want to embed in a tiddler
to display the equation:

<?xml-stylesheet type="text/xsl" href="mathml.xsl"?>
<html>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<apply>
<union/>
<apply>
<intersect/>
<ci>A</ci>
<ci>B</ci>
</apply>
<apply>
<intersect/>
<ci>C</ci>
<ci>D</ci>
</apply>
</apply>
</math>
</html>

How can I do that? How can I specify the xml stylesheet?

Milind

Yakov

unread,
Nov 12, 2011, 6:11:47 PM11/12/11
to TiddlyWiki
Hi Milind.

Since I haven't used mathML due to its low support in different
browsers, I'll answer indirectly.

There are 3 basic ways to add formulae into tiddlers:

1. insert a picture. The picture should be somehow generated, and
there's a codecogs [1] service which can do that. Working examples of
it's usage can be found in [2] and [3]; however, there are some
limitation which, if become of concern, can be overcame be either
manual copying the pictures from the service server, or creating some
automated solution, or paying.

2. use mathML. Due to the lack of support of mathML, I haven't dig
deeply, so here are just some links:
* in [4] see AsciiToMath, but there's no docs of how to install
* there's something in [5] that I can't recall
* if you are a coder or want to try, you can look at [6]
* another solution can be at [7], but I haven't tried it as I remember

3. but the most convenient solution is to use js libraries which
convert text into formulae. There's the Plugin: jsMath at [8] which
you should try, I think (I use it for inserting formulae too); it uses
the jsMath library; for the MathJax library there was also a plugin
(PluginMathJax) at [9], but the site have disappeared in a little time
after I discovered it, so I haven't any copies of the plugin (and
don't know anything about the author).

So, my suggestion is to try the Plugin: jsMath which is a convenient
and even somewhat mantained solution.

Regards,
Yakov.

[1] http://www.codecogs.com/latex/about.php
[2] http://twmath.tiddlyspot.com/
[3] http://twequation.tiddlyspot.com/
[4] http://jostylr.com/twasciimathwiki.html
[5] http://math.chapman.edu/~jipsen/asciencepad/asciencepad.html
[6] http://www1.chapman.edu/~jipsen/mathml/asciimath.html
[7] http://www.math.ist.utl.pt/~psoares/MathSVG.html
[8] http://bob.mcelrath.org/tiddlyjsmath.html
[9] http://tiddlywiki.canada-east.ca/#PluginMathJax

wolfgang

unread,
Nov 12, 2011, 6:32:28 PM11/12/11
to TiddlyWiki
> for the MathJax library there was also a plugin
> (PluginMathJax) at [9], but the site have disappeared in a little time
> after I discovered it, so I haven't any copies of the plugin (and
> don't know anything about the author).
>
> [9]http://tiddlywiki.canada-east.ca/#PluginMathJax

Took the google button ;-)

http://tiddlyspace.com/bags/math-template_public/tiddlers/PluginMathJax%20v1.3/revisions.wiki

Yakov

unread,
Nov 13, 2011, 9:00:26 AM11/13/11
to TiddlyWiki
> > [9]http://tiddlywiki.canada-east.ca/#PluginMathJax
>
> Took the google button ;-)
>
> http://tiddlyspace.com/bags/math-template_public/tiddlers/PluginMathJ...

Aha! You found it. Great, when I tried to google, I haven't succeeded.
And now I've found at least a sign of the SyntaxHighlightPlugin [1],
but I can't recall the name of the third one (somewhat like
FunctionExplorerPlugin). Sorry for offtopic, though.

Milind, if you have any problems with Plugin: jsMath, see [2] first as
some issues are summarized there (if you use Opera or Chrome, see the
third post, otherwise look through the thread).

[1] http://fsk141.com/tiddlywiki-syntax-highlighter
[2] http://groups.google.com/group/tiddlywiki/browse_thread/thread/f57bf9ce7473f51

PMario

unread,
Nov 14, 2011, 4:38:18 AM11/14/11
to TiddlyWiki
Hi Yakov,
If you need syntax highlighters, you can use either

http://syntaxhighlighter.tiddlyspace.com/

or

http://codemirror-plugins.tiddlyspace.com/

Documentation at: http://codemirror.tiddlyspace.com/

have fun!
mario

Yakov

unread,
Nov 14, 2011, 6:17:35 AM11/14/11
to TiddlyWiki
Hi Mario,

> http://syntaxhighlighter.tiddlyspace.com/

This is new for me, I'll look into it.
Actually, it seems that you've missed my feedback post at [1]. A short
story is -- I haven't managed to install the plugin..

[1] http://groups.google.com/group/tiddlywiki/browse_thread/thread/892d20be3e554e0c

Jeremy Ruston

unread,
Nov 14, 2011, 7:29:47 AM11/14/11
to tiddl...@googlegroups.com
[Slightly off-topic interjection.]

This thread is exactly the sort of information for which I think we
ought to be able to maintain accurate information on tiddlywiki.com.
I'd wondered in the past about introducing a tiddler for some of the
major application areas of TiddlyWiki (e.g. GettingThingsDone,
Mathematics, Teaching, Learning, etc.), and to bring together links to
relevant examples, articles, adaptations, plugins and techniques.

I've tried to summarise this thread into a tiddler about Mathematics:

http://tiddlywiki-com.tiddlyspace.com/#Mathematics

I'm sure it could be a lot better, if anyone can offer any help?

Best wishes

Jeremy

> --
> You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
> To post to this group, send email to tiddl...@googlegroups.com.
> To unsubscribe from this group, send email to tiddlywiki+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/tiddlywiki?hl=en.
>
>

--
Jeremy Ruston
mailto:jer...@osmosoft.com
http://www.tiddlywiki.com

PMario

unread,
Nov 14, 2011, 11:46:33 AM11/14/11
to TiddlyWiki
On Nov 14, 12:17 pm, Yakov <yakov.litvin.publi...@gmail.com> wrote:
> Actually, it seems that you've missed my feedback post at [1].
Jup, I did.
I'll have a closer look and add some more info to the PluginInfo
tiddler. (soon)

> ... A short
> story is -- I haven't managed to install the plugin..
For TiddlySpace, just include the codemirror-plugins space into your
space.
_And_ have a look at codemirror [2] space for additional info.
(ToolbarCommands, Templates ..)

If you want to import the tiddlers needed into one of your TWs, have a
look at CodeMirror2PluginInfo [1] tiddler. Section "Needed ..." You'll
see what to import. It's all tiddlers tagged "cm2tw"

hope that helps
-m

[1] http://codemirror-plugins.tiddlyspace.com/#CodeMirror2PluginInfo
[2] http://codemirror.tiddlyspace.com

PMario

unread,
Nov 14, 2011, 11:48:41 AM11/14/11
to TiddlyWiki
Hi Milind,
Do you need to use MathML, or is MathJax an option too?
-m
PS: Sorry for the other "slightly off topic" posts :)

Yakov

unread,
Nov 15, 2011, 11:03:26 AM11/15/11
to TiddlyWiki
Hi Jeremy.

> I've tried to summarise this thread into a tiddler about Mathematics:
>
> http://tiddlywiki-com.tiddlyspace.com/#Mathematics
>
> I'm sure it could be a lot better, if anyone can offer any help?

So, what we have..

As for the possibilities to incorporate formulae, I've probably
mentioned all of them. Although I haven't digged into the MathML
possibilities which is not of prime concern as MathML is not that
extensively supported.

Now, what else? I can provide some details regarding the installation
and usage of the plugins (jsMath and MathJax), namely:
* each plugin needs some "fonts" for operation, meaning a user needs
them in either way (here, I describe only jsMath):
** install the fonts on a local computer: download from [1] and
install (in Windows -- unzip, select all, right-click, select
"install")
** download fonts to make them "an attachment": download from [2],
unpack and put those 7 folders ("cmbx10" etc) into a "fonts" subfolder
of the jsMath dirrectory (create "fonts" if it doesn't exist)
* the first way should be used for personal usage: if one places the
"attachment fonts" in a usb-stick with FAT file system, they'll grow
up to 1Gb and will be moved/copied/.. very slowly (see last 3 posts in
[3])
* the first way should be used for web-pages (unless the author
expects each user to download and install the fonts from [1]).
Althoght there's a unicode fallback which means that formulae will be
represented without "attachment", it should look much worse than with
the fonts.
* the rest of installation is rather clear (add a plugin to
TiddlyWiki, put jsMath files in the jsMath folder in the same
dirrectory as TiddlyWiki, try it; if this doesn't work (due to those
use-file-system-security-reasons), see the documentation.

Ah, great! I found that I've made a copy of the TiddlyWikiCE (canada-
east) repository. Even more there's a link to the feedback form so I
wrote something to try to contact the author(s); and now I have
PluginMathJax v1.4.1. I can share it if someone points the most
appropriate way; however, I'd better listen to the author(s)' answer
first. As for the installation notes, I haven't detailed ones as I
ended with usage of jsMath because of some bad representation of
"installed" fonts of MathJax the time I tried to use it.

***

Mario, I'll try [4] again after some time (now the lack of it is
really pressing :) ).

***

Milind,

like Mario said, it's interesting to hear if MathML is really needed.

[1] http://www.math.union.edu/~dpvc/jsMath/download/jsMath-fonts.html
[2] http://sourceforge.net/projects/jsmath/files/jsMath%20Image%20Fonts/
[3] https://groups.google.com/group/tiddlywiki/browse_thread/thread/72a1d4bdc6f0742e/7a33f8783b51572b
[4] http://codemirror-plugins.tiddlyspace.com/#CodeMirror2PluginInfo

Milind

unread,
Nov 15, 2011, 3:29:03 PM11/15/11
to TiddlyWiki
Sorry for the delayed response and thanks to everybody for taking time
to post on the thread. I have tried MAthJax but I could not get it to
work offline. I am looking at jsMath but I prefer MathML since it
seems easier to understand and remember and since it is XML based I
think it will be easier to search equations in tiddlers by making your
own text parser and make it cross platform to port equations. I know
all browsers do not support it but Firefox supports it quite well and
I think that is enough for me to stick with it, I am sure if any
browser wants to support equations they will finally adopt MathML.
Firefox displays the above XML file quite nicely given the mathml.xsl
and associated files is properly accessible. But it just doesn't work
inside a tiddler. The reason I am sure is the stylesheet specification
statement which lies outside the html tags. So is there any existing
way to make it work?
> [3]https://groups.google.com/group/tiddlywiki/browse_thread/thread/72a1d...
> [4]http://codemirror-plugins.tiddlyspace.com/#CodeMirror2PluginInfo

Yakov

unread,
Nov 16, 2011, 11:16:34 AM11/16/11
to TiddlyWiki
> I have tried MAthJax but I could not get it to work offline.

This should be probably because of the same issue that caused problems
with jsMath. For details, see [1] (for Opera and Chrome, see the third
post).

> I am looking at jsMath but I prefer MathML since it
> seems easier to understand and remember and since it is XML based I
> think it will be easier to search equations in tiddlers by making your
> own text parser and make it cross platform to port equations.

Well, at least MathML is much more bulky to to write.. and TeX is
somewhat standart for formulae.. so it seems to be not very practicle.

> Firefox displays the above XML file quite nicely given the mathml.xsl
> and associated files is properly accessible. But it just doesn't work
> inside a tiddler. The reason I am sure is the stylesheet specification
> statement which lies outside the html tags. So is there any existing
> way to make it work?

Well, you can try to put the specifications into the MarkUpPreHead
tiddler but Amaya tool shows that some other specifications are used

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" /
>
<title>New</title>
<meta name="generator" content="Amaya, see http://www.w3.org/Amaya/"
/>
</head>

<body>
<p>Text</p>

<p><math xmlns="http://www.w3.org/1998/Math/MathML">
<msup>
<mi>a</mi>
<mn>2</mn>
</msup>
<mo>=</mo>
<msup>
<mi>b</mi>
<mn>2</mn>
</msup>
<mo>+</mo>
<msup>
<mi>c</mi>
<mn>2</mn>
</msup>
</math></p>

<p>more text.</p>
</body>
</html>

so this is to try (as I know, in TW you are not able to put the "<?xml
[...]" thing without changing the TW file manually and things inside
the "head" element could be also a problem. But you can look into the
links about MathML I provided before. If you succeed, let us know as
well.

[1] http://groups.google.com/group/tiddlywiki/browse_thread/thread/f57bf9ce7473f51
Reply all
Reply to author
Forward
0 new messages