52

Recently, the TeX.SE question "\[\mu\] is printing the Greek letter mu on a separate single line" got onto the Hot Network Questions list.

Like many questions on TeX.SE, it contains some TeX markup in its title. Unfortunately, on sites that have MathJax enabled, this markup gets parsed and rendered as math:

Screenshot

I propose that either:

  • the entire Hot Network Questions sidebar should be excluded from MathJax parsing by styling it with the tex2jax_ignore class, or

  • at least, any hot questions from TeX.SE should be so excluded from MathJax parsing.

Or I suppose we could always implement this feature request, which asks for all questions with TeX in the title to be excluded from Hot Network Questions entirely. That might be throwing out the baby with the bathwater, though.


Ps. This issue is partially masked by another bug, which causes MathJax not to be rendered in many elements that are hidden by default and revealed using jQuery .show(), such as all but the first five questions in the Hot Network Questions sidebar. The SOUP user script contains a generic fix for that bug, so users who have it installed will see this issue more frequently, but it occurs even without SOUP whenever a question with TeX markup in the title happens to show up among the top five hot questions that are always visible by default.

10
  • Another example of this bug
    – user11153
    Commented Nov 27, 2014 at 11:03
  • And another example
    – alexwlchan
    Commented Dec 3, 2014 at 13:27
  • This was done a while ago, just marking as status-completed.
    – Oded StaffMod
    Commented Apr 15, 2015 at 11:31
  • @Oded: Could you please post a short answer describing how this was fixed? Commented Apr 15, 2015 at 15:12
  • 1
    It appears I misunderstood the issue here. Need to dig deeper and see if this was indeed fixed.
    – Oded StaffMod
    Commented Apr 16, 2015 at 11:06
  • Is this still open? I don't use SOUP, and on space.SE HNQ got wrongly mathified display of a question from unix.SE that used $ for awk syntax. Commented Oct 16, 2015 at 11:59
  • @dave_thompson_085: Yes, this bug is still open (current example).
    – Heinzi
    Commented Mar 4, 2016 at 12:35
  • Here's another example showing that this is still an issue, and the related question.
    – Aux
    Commented Sep 14, 2016 at 2:29
  • 7
    @Oded year and half later, any chance for re-digging to try and fix the bug? More and more people see this all around Stack Exchange and it does not look very good. Commented Sep 14, 2016 at 12:39
  • 1
    And yet another example (which really confused the heck out of me at first as to what it was supposed to say).
    – TNT
    Commented Sep 21, 2016 at 16:18

3 Answers 3

11

Hey so I was looking into this today, and it looks like this was fixed nearly two years ago and we just never said anything over here.

The Blame

30
+50

The problem of inadvertent MathJax rendering is not limited to titles from tex.stackexchange.com. While browsing earthscience.stackexchange.com, I ran across this mis-rendered Hot Network Question, whose title should have been

If ICANN only charges $0.18 per domain name, why am I paying $10?

Screenshot of inadvertent MathJax

Someone implemented a workaround by changing "$0.18" to "18¢". However, the following title is harder to change:

Whats does "${-#*i}" != "$-" mean in /etc/profile

enter image description here

I suspect that the solution is to make each Hot Network Question that comes from a site that does not have MathJax enabled have its <div> labelled with class="tex2jax_ignore". (There is still the awkward problem that different sites can have different MathJax delimiters.)

14

The just released SOUP v1.12 user script includes the following client-side work-around for this issue:

MathJax.Hub.Register.MessageHook( "Begin PreProcess", function (message) {
    $('#hot-network-questions a[href*="//tex.stackexchange.com/"]' +
      ':not(.tex2jax_ignore)').addClass('tex2jax_ignore');
} );

Basically, this code adds the tex2jax_ignore class to any links to TeX.SE within the hot network questions sidebar.

The tricky bit about this fix is that it needs to be executed after the document has loaded, but before the initial MathJax preprocessing pass. SOUP accomplishes this by injecting it as a MathJax configuration script, which registers a hook function that is called by MathJax just before each preprocessing pass.


Ps. As of SOUP v1.14, this fix is now applied to all hot network question titles, except for those from sites known to use MathJax (with standard delimiters). This change was made after the problem was observed to occur also with questions from sites other than TeX.SE.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .