Open magicvinni opened 13 years ago
For the moment I've done this fonction which give the good syntaxe :
function goodsyntax($t){
$r=$t;
while (strpos($r,'${')){
$i=strpos($r,'${');
$r[$i+1]='§';
$n=0;$pos=$i;
while (($n>=0)and($pos<strlen($r))){
if ($r[$pos]=='{') $n++;
if ($r[$pos]=='}') $n--;
$pos++;
}
if ($n==-1) $r[$pos-1]='$';
}
return str_replace('$§','$',$r);
}
But the textbox stays editable, thanks
(in reverse order)
mathquill-rendered-latex
, the e^{i\pi}+1=0
in the
first paragraph of the demo page is an example of this..mathquill('write')
and .mathquill('latex')
might be broken on
mathquill-textboxe
s, I'll look into thatHan
On Sat, Apr 30, 2011 at 7:24 AM, magicvinni < reply@reply.github.com>wrote:
Hello,
I've 2 problems : I've a mathquill-textbox to ask user to enter a text. I record the .mathquill('latex') on the serveur. (exemple : "Un try ${\frac{1}{2}}" . It works !). which is not the good syntax, so when I want to display later the content in a mathquill-textbox it don't word.
Other question : is it possible to display a non-editable mathquill-textbox, just to display the formula ?
Thanks
Reply to this email directly or view it on GitHub: https://github.com/laughinghan/mathquill/issues/32
For your issue 2. .mathquill('latex') broken on 'mathquill-textbox'
Maybe following repairs it? In baseclasses.js the _.latex() -function for MathCommand change:
_.latex = function() {
return this.foldChildren(this.cmd, function(latex, child) {
return latex + '{' + (child.latex() || ' ') + '}';
});
};
to:
_.latex = function() {
return this.foldChildren(this.cmd, function(latex, child) {
if (latex == '$') {
return '$' + (child.latex() || ' ') + '$';
}
return latex + '{' + (child.latex() || ' ') + '}';
});
};
This seems to help.
$('.mathquill-textbox').mathquill('latex')
should be fixed: http://laughinghan.github.com/mathquill/dev/demo.html
Hello,
I've 2 problems : I've a mathquill-textbox to ask user to enter a text. I record the .mathquill('latex') on the serveur. (exemple : "Un try ${\frac{1}{2}}" . It works !). which is not the good syntax, so when I want to display later the content in a mathquill-textbox it don't word.
Other question : is it possible to display a non-editable mathquill-textbox, just to display the formula ?
Thanks