extjs - Sencha Touch and MathJax -
i trying display math-equations in sencha view component (extends: ext.container), using ext.label component , mathjax js. (as suggested answering other question: display math symbols in ext.js / sencha touch)
this initialization of view component:
ext.define('tiquiz3.view.question', { extend: 'ext.container', ... requires: ['ext.label', ...], config: { fullscreen: true, ... layout: { type: 'vbox', align: 'stretch' } }, initialize: function() { this.callparent(); ... var questionlabel = { xtype: 'label', style: { 'border':'1px solid black', 'background':'white' }, margin: 10, padding: 10, html: "<div>es sei $l = \{011, 01, 11, 100\}$ \"uber dem alphabet $\sigma = \{0,1\}$.</div>", flex: 1 }; ... this.add([...,questionlabel,...]); }
i have included local copy of mathjax in app.json file:
"js": [ { "path": "touch/sencha-touch.js", "x-bootstrap": true }, { "path": "bootstrap.js", "x-bootstrap": true }, { "path": "resources/mathjax/mathjax.js?config=tex-ams-mml_htmlormml", "update": "delta" }, { "path": "app.js", "bundle": true, /* indicates class dependencies concatenated file when build */ "update": "delta" } ],
mathjax indicates loaded successfully.
but output of label not display math properly. instead looks this:
es sei $l = {011, 01, 11, 100}$ "uber dem alphabet $sigma = {0,1}$.
is displaying math mathjax , html possible using sencha label component?
any advice appreciated!
thanks, thomas
ok, peter, brought me solution.
the problem indeed rendering of content after onload-event of page.
for these cases mathjax holds method invoke typesetting manually @ later time. did adding following afterpainted-listener rendered view component:
listeners : { order : 'after', painted : function() { mathjax.hub.queue(["typeset",mathjax.hub]); } }
note that, peter pointed out, in order upper work 1 has configure $ accepted math delimiter mathjax - not default behaviour.
thanks advice!
Comments
Post a Comment