Hi Peter,
Thanks for your reply. I had looked through the kantorsite code before and
suspected that that was the problematic statement, but the vote of
confidence from someone knowledgable about MathJax helped me a great deal.
Thanks!
In other news, I think I've answered both of my questions! I've spent the
afternoon learning more of the TW5 internals, refreshing myself on working
with JSON, etc. and I now have a modified version of the MathJax plugin
which supports (a) loading (specially-formatted for now) TeX commands from
one or more tiddlers and includes them in the initial MathJax configuration
script and (b) seems to work (hopefully without any major side effects) for
reveal widgets and basically everything else in the story-river. I'd like
to release it to GitHub once I've tested it a bit more to make sure that
it's not horribly buggy (and to add some convenience features if time
allows).
For those looking for a solution to (b), I simply changed the second
argument of the mutation observer call (i.e., the list of things for it to
monitor) that Peter mentioned to read
"{subtree:true,attributes:true,childList:true}". So far it's working fine
(no performance hit or bugs identified yet) for my relatively small TW5
file, but YMMV. As a bonus, this easy little fix also makes it so that when
editing Tiddlers the preview pane will render MathJax in real time just
like on stackexchange! So I'm a very happy camper.
Thanks again for the help! I will post in this group when I get around to
uploading this to GitHub.
- Dan
On Thursday, October 9, 2014 3:02:33 AM UTC-4, Peter Krautzberger wrote:
>
> Hi,
>
> Peter from the MathJax team here.
>
> > Question 1
>
> As you mentioned, the usual way (from a MathJax point of view) is to store
> your macros in a configuration/extension file and load this alongside any
> other configuration file.
>
> Some pointers from our docs
>
> * You already mentioned
> http://docs.mathjax.org/en/latest/tex.html#defining-tex-macros
> * This explains the file structure:
> http://docs.mathjax.org/en/latest/extension-writing.html#extension-to-define-tex-macros
>
> * This explains how to load it with the CDN copy:
> http://docs.mathjax.org/en/latest/configuration.html#using-a-local-configuration-file-with-the-cdn
> .
> * And https://github.com/mathjax/MathJax-third-party-extensions for more
> examples.
>
> > Question 2
>
> I don't know TW unfortunately but it seems like
>
> line 3699: [...] var
> n=document.getElementsByClassName('story-river')[0];t.observe(n,{subtree:false,attributes:true,childList:true})
>
> [...]
>
> looks like the place that needs modifying. Again, I don't know TW, but
> perhaps all that's needed is to add more DOM nodes that are then observed.
>
> You might want to cross post to the MathJax User Group
> <http://groups.google.com/forum/#!forum/mathjax-users> just in case.
>
> Peter.
>
>
> On Thursday, October 9, 2014 2:21:25 AM UTC+2, Antonio Vargas wrote:
>>
>>
>>
>> *Question 2:*
>>>
>>> Another problem I'm having with the MathJax plugin from kantorsite is
>>> that it fails to render math inside, *e.g.*, a reveal widget
>>>
>>
>> I used the following test and verified that the reveal widget works well
>> with KaTeX plugin in common browsers. Unfortunately, I can use it only in a
>> small percentage of my tiddlers (hundreds of tiddlers with lots of math
>> expressions used at real time in the classroom). But, one day, it will
>> match the power of MathJax (might take some time). I was surprised that
>> mathML didn't work well in chrome.
>>
>>
>> !Equation rendering in a reveal widget.
>>
>> * Tested in Linux with:
>> ** Firefox 32.0.3, Google Chrome 37.0.2062.120 and Opera 12.16.1860
>> * No Windows, no IE.
>>
>> <hr/>
>> TEST 1: ''Chrome'': yes; ''Firefox'': yes; ''Opera'': yes (not
>> perfect)<br/>
>> <$button set="$:/SampleRevealState1" setTo="show">Show ~KaTeX</$button>
>> <$button set="$:/SampleRevealState1" setTo="hide">Hide ~KaTeX</$button>
>>
>> <$reveal type="match" state="$:/SampleRevealState1" text="show">
>>
>> @@font-size:400%;line-height:100%;
>> $$\frac{1}{2}=0,5$$<br/>
>> @@
>>
>> </$reveal>
>>
>> <hr/>
>> TEST 2: ''Chrome'': no; ''Firefox'': no; ''Opera'': no<br/>
>> <$button set="$:/SampleRevealState2" setTo="show">Show ~MathJax</$button>
>> <$button set="$:/SampleRevealState2" setTo="hide">Hide ~MathJax</$button>
>>
>> <$reveal type="match" state="$:/SampleRevealState2" text="show">
>>
>> @@font-size:400%;line-height:100%;
>> $\frac{1}{5}=0,2$<br/>
>> @@
>>
>> </$reveal>
>>
>> <hr/>
>> TEST 3: ''Chrome'': no; ''Firefox'': yes; ''Opera'': yes<br/>
>> <$button set="$:/SampleRevealState3" setTo="show">Show ~MathML</$button>
>> <$button set="$:/SampleRevealState3" setTo="hide">Hide ~MathML</$button>
>>
>>
>> <$reveal type="match" state="$:/SampleRevealState3" text="show">
>>
>> @@font-size:400%;line-height:100%;
>> <math xmlns="http://www.w3.org/1998/Math/MathML">
>> <mfrac>
>> <mn>1</mn>
>> <mn>2</mn>
>> </mfrac>
>> <mo>=</mo>
>> <mfrac>
>> <mrow><mi>x</mi><mo>+</mo><mn>1</mn></mrow>
>> <mrow><mi>y</mi><mo>-</mo><mn>25</mn></mrow>
>> </mfrac>
>> </math>
>> @@
>>
>> </$reveal>
>>
>>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.