Faint right square bracket

25 views
Skip to first unread message

MarkFL

unread,
Jan 26, 2015, 11:59:42 PM1/26/15
to mathja...@googlegroups.com
Hello MathJax community,

I help administrate a math help forum (vBulletin 4.2.2 PL 4), and we use your product for the rendering of LaTeX. One minor issue I have noticed is that when our users express a closed interval using square brackets, the vertical bar of the right bracket is much fainter than that of the left bracket. I have addressed this issue by running a javascript function on each page as follows:

function MJRightBracket()
{
    MathJax.Hub.Queue(["Typeset", MathJax.Hub], function(){
        var myEles = document.getElementsByClassName("mo"), content;
        for (var i = 0; i < myEles.length; i++)
        {
            if (myEles[i].innerHTML == "[" || myEles[i].innerHTML == "]")
            {
                myEles[i].style.fontWeight = "600";
            }
        }
        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;
        }
    });
}

My question is:

Is there a more efficient way to deal with this issue?

Best Regards,

Mark.

MarkFL

unread,
Jan 27, 2015, 2:42:33 PM1/27/15
to mathja...@googlegroups.com
Hello again,

My apologies for not doing my homework...I have since discovered this is an issue specific to Firefox it seems, and not with MathJax. So, I have edited my script as follows:

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++)
            {
                if (myEles[i].innerHTML == "[" || myEles[i].innerHTML == "]")
                {
                    myEles[i].style.fontWeight = "600";
                }
            }
            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;
            }
        });
    }
}

Perhaps this may help others. :D

Peter Krautzberger

unread,
Jan 28, 2015, 3:04:31 AM1/28/15
to mathja...@googlegroups.com
Hi,

Oops, I had started writing a response yesterday but not send it off. First, this sounds like a bug so it would be great to have a live sample to look at (live page, or jsbin, codepen etc); it's hard to say much without one.

Second, since you've narrowed it down to Firefox, I'm wondering if it's related to https://github.com/mathjax/MathJax/issues/1009, i.e., some form of clipping going on.

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 28, 2015, 11:46:38 AM1/28/15
to mathja...@googlegroups.com
Hello Peter,

Thanks for your response. :D

I would say the easiest way to see this Firefox issue in action is to load Firefox and go to your live preview:

http://www.mathjax.org/demos/

and type in $[a,b]$

You should see a faint right bracket. The script I put into place seems to work well, and requires no action on the part of our users. I have asked for feedback from our users to see if any other browser have this issue, as I have only checked Chrome, Firefox and IE, and found that of those 3 browsers, only Firefox exhibits this behavior. If I find that any other browsers are reported to have any issues, I will let you know.

Best Regards,

Mark.


Peter Krautzberger

unread,
Jan 28, 2015, 11:49:13 AM1/28/15
to mathja...@googlegroups.com
Hi Mark,

Thanks for following up. I'm not able to reproduce this on the demos page so this seems more subtle. 

Do you have the MathJax or STIX fonts installed locally?

Best regards,
Peter.

MarkFL

unread,
Jan 28, 2015, 12:31:48 PM1/28/15
to mathja...@googlegroups.com
Hello Peter,

Yes, I have both fonts installed locally. If it is helpful, here are the configuration scripts we run:

<script type="text/x-mathjax-config">
      MathJax.Hub.Config({
          TeX: {extensions: ["autoload-all.js"],
                noErrors: {style: {"display": "block !important",
                                   "margin": "1em 0em 1em 2em",
                                   "border": "none",
                                   "text-decoration": "underline"}
                          },
                Macros: {pd: ["{\\frac{\\partial#1}{\\partial#2}}",2],
                         d: ["{\\frac{d#1}{d#2}}",2],
                         E: ["\\times 10^{#1}",1],
                         csch: ["\\mathop{\\rm csch}\\nolimits"],
                         arccsc: ["\\mathop{\\rm arccsc}\\nolimits"],
                         arcsec: ["\\mathop{\\rm arcsec}\\nolimits"],
                         arccot: ["\\mathop{\\rm arccot}\\nolimits"],
                         sech: ["\\mathop{\\rm sech}\\nolimits"],
                         arsinh: ["\\mathop{\\rm arsinh}\\nolimits"],
                         arcosh: ["\\mathop{\\rm arcosh}\\nolimits"],
                         artanh: ["\\mathop{\\rm artanh}\\nolimits"],
                         arcsch: ["\\mathop{\\rm arcsch}\\nolimits"],
                         arsech: ["\\mathop{\\rm arsech}\\nolimits"],
                         arcoth: ["\\mathop{\\rm arcoth}\\nolimits"],
                        }
          },
          extensions: ["tex2jax.js"],
          jax: ["input/TeX", "output/HTML-CSS"],
         
          "HTML-CSS": { linebreaks: { automatic: true, width: "90% container"} } ,
          "SVG": { linebreaks: { automatic: true, width: "90% container" } } ,
                                 
          displayAlign: "left", displayIndent: "2em", displayErrorAlign: "left",
          tex2jax: {inlineMath: [ ['$','$'], ['\\(','\\)'] ],
              displayMath: [ ['$$','$$'], ['\\\[','\\\]'] ],
              processEscapes: true}
   
    });
    MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
      MathJax.InputJax.TeX.prefilterHooks.Add(function (data) {
        if (data.display) {
          var next = data.script.nextSibling;
          while (next && next.nodeName.toLowerCase() === "#text") {next = next.nextSibling}
          if (next && next.nodeName.toLowerCase() === "br") {next.parentNode.removeChild(next)}
        }
      });
    });
</script>

<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML-full"></script>

Best Regards,

Mark.

Peter Krautzberger

unread,
Jan 28, 2015, 12:33:31 PM1/28/15
to mathja...@googlegroups.com
Hi Mark,

Thanks for the additional information. Which browser versions and which OS versions have you encountered this bug on?

Thanks,
Peter.

--

MarkFL

unread,
Jan 28, 2015, 12:55:01 PM1/28/15
to mathja...@googlegroups.com
Hello Peter,

I use Windows 7 Home Premium (64 bit) and Firefox 35.0.

Thanks for your attention,

Mark.

Peter Krautzberger

unread,
Jan 28, 2015, 2:15:47 PM1/28/15
to mathja...@googlegroups.com
Hi Mark,

Alright, I can see it on Windows and I've filed https://github.com/mathjax/MathJax/issues/1026

Thanks again for reporting the issue!
Peter.

--

MarkFL

unread,
Jan 28, 2015, 4:57:40 PM1/28/15
to mathja...@googlegroups.com
Okay Peter, thank you for all your efforts!

Best Regards,

Mark.
Reply all
Reply to author
Forward
0 new messages