Mathjax, sqrt and brackets

112 views
Skip to first unread message

bub...@gmail.com

unread,
Jan 17, 2015, 10:56:15 AM1/17/15
to mathja...@googlegroups.com
Hi,
I've got a problem with this sample : $\left[\sqrt{x}\right[$.

Top of brackets aren't displayed correctly.

You can test it on http://www.mathjax.org/demos/

On my site, it displays correctly with a bigger font size (18pt).

Have you got an idea for a display with font size = 14pt ??

Thanks for your help

Peter Krautzberger

unread,
Jan 19, 2015, 8:21:59 AM1/19/15
to mathja...@googlegroups.com
Hi,

Could you provide more information? See the User Group guidelines for suggestions on providing enough information (live sample, browser and OS versions etc).

Best regards,
Peter.


--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

MarkFL

unread,
Jan 27, 2015, 5:07:03 PM1/27/15
to mathja...@googlegroups.com, bub...@gmail.com
This appears to me to be a Firefox only issue, just like the issue about which I posted yesterday. I fixed it (and the faint right bracket issue) for Firefox users by adding the following javascript function which can be called as needed:

function MJRightBracket()
{
    if (navigator.userAgent.indexOf("Firefox") != -1)
    {
        MathJax.Hub.Queue(["Typeset", MathJax.Hub], function(){
            var myEles = document.getElementsByClassName("mo"), content;
            for (var i = 0; i < myEles.length; i++)
            {
                content = myEles[i].innerHTML;
                if (content == "[" || content == "]")
                {
                    myEles[i].style.fontWeight = "600";
                }
                else if (content == "\<span style=\"font-family: MathJax_Size1;\"\>\[\<\/span\>" || content == "\<span style=\"font-family: MathJax_Size1;\"\>\]\<\/span\>")
                {
                    myEles[i].firstElementChild.style.fontSize = "95%";
                }
            }
            var myEles = document.getElementsByClassName("mtext");
            for (var i = 0; i < myEles.length; i++)
            {
                content = myEles[i].innerHTML;
                content = content.replace(/\[/g,"\<span style=\"font-weight: 600\"\>\[\<\/span\>");
                content = content.replace(/\]/g,"\<span style=\"font-weight: 600\"\>\]\<\/span\>");
                myEles[i].innerHTML = content;
            }
        });
    }
}

MarkFL

unread,
Jan 27, 2015, 9:47:51 PM1/27/15
to mathja...@googlegroups.com, bub...@gmail.com
This is a better solution:


function MJRightBracket()
{
    if (navigator.userAgent.indexOf("Firefox") != -1)
    {
        MathJax.Hub.Queue(["Typeset", MathJax.Hub], function(){
            var myEles = document.getElementsByClassName("mo"), content;
            for (var i = 0; i < myEles.length; i++)
            {
                content = myEles[i].innerHTML;
                if (content == "[" || content == "]")
                {
                    myEles[i].style.fontWeight = "600";
                }
                else if (content == "\<span style=\"font-family: MathJax_Size1;\"\>\[\<\/span\>" || content == "\<span style=\"font-family: MathJax_Size1;\"\>\]\<\/span\>")
                {
                    myEles[i].firstElementChild.style.display = "inline-block";
                    myEles[i].firstElementChild.style.transform = "scale(1,0.96)";

MarkFL

unread,
Jan 30, 2015, 11:56:42 PM1/30/15
to mathja...@googlegroups.com, bub...@gmail.com
For v2.5, I changed the script to:


function MJRightBracket()
{
    if (navigator.userAgent.indexOf("Firefox") != -1)
    {
        MathJax.Hub.Queue(["Typeset", MathJax.Hub], function(){
            var myEles = document.getElementsByClassName("mo"), content;
            for (var i = 0; i < myEles.length; i++)
            {
                content = myEles[i].innerHTML;
                if (content == "[" || content == "]")
                {
                    myEles[i].style.fontWeight = "600";
                }
                else if (content == "\<span style=\"font-family: MathJax_Main;\"\>\[\<\/span\>" || content == "\<span style=\"font-family: MathJax_Main;\"\>\]\<\/span\>")

                {
                    myEles[i].firstElementChild.style.display = "inline-block";
                    myEles[i].firstElementChild.style.transform = "scale(1.04,1)";

                }
            }
            var myEles = document.getElementsByClassName("mtext");
            for (var i = 0; i < myEles.length; i++)
            {
                content = myEles[i].innerHTML;
                content = content.replace(/\[/g,"\<span style=\"font-weight: 600\"\>\[\<\/span\>");
                content = content.replace(/\]/g,"\<span style=\"font-weight: 600\"\>\]\<\/span\>");
                myEles[i].innerHTML = content;
            }
        });
    }
}

Reply all
Reply to author
Forward
0 new messages