6
$\begingroup$

A couple of times now, I have drafted a question, only for the automatic preview to completely mangle the MathJax. Examples:

  • I expect $\{X\}$ should display as $\{X\}$. Instead I see just $X$, as if I'd written ${X}$. However, if I write $\\{X\\}$, then I do see $\{X\}$.
  • I expect ${X}_{n}$ and ${Y}_{n}$ should display as ${X}_{n}$ and ${Y}_{n}$, but instead I see \${X}{n}and{Y}{n}\$, with the text between the underscores treated as italics. (This is in some sense a minimal example, since ${X}_n$ and ${Y}_n$ and $X_{n}$ and $Y_{n}$ show up as expected, as does simply ${X}_{n}$ on its own line.) To get things to show up correctly, I can escape one or both underscores, for example with ${X}\_{n}$ and ${Y}_{n}$

Some notes:

  • This appears to only be a problem on the main site, not here on meta.
  • Once the question is posted, everything shows up correctly; only the preview before posting is a problem. This has bitten me at least once: Someone else had to fix a question of mine where I double-escaped some braces to get the preview to look right.
  • I do all my editing in Chrome. When I tried to reproduce the problem in Firefox, I was unable. I was also unable to reproduce it in Edge, which is very strange because (if I understand correctly) Edge is built on Chromium. However, a friend was able to reproduce in Chrome on another computer, logged in as himself.

This doesn't appear to be a known issue on meta, but perhaps I missed something. (The most similar I found was Mathjax rendering incorrectly in edit preview., but that error was caused by a plugin and I'm not using any plugins.)

$\endgroup$
8
  • $\begingroup$ I almost exclusively use basically the latest version of Microsoft Edge on a Windows $10$ machine to do my math answers postings. Note I have had issues with the preview not working properly on quite a few occasions, including your specific problem (other examples are where tags and labels aren't handled properly). It seems that the automatic updates of what you are seeing sometimes get out of sync with your most recent changes. I've found that I just save what I have, exit from editing or posting, refresh the screen, and then repost it, with this solving the problem. Note that I have not ... $\endgroup$ Commented Sep 7, 2023 at 20:00
  • $\begingroup$ (cont.) posted anything here because MathJax is used on multiple SE sites, with there being several related posts on the network Meta site that I've seen related to this (I can search for this and provide a few links if you wish, e.g., if you can't find anything yourself). One final thing to note is that, like you, I'm also not using any plugins, i.e., it's just the basic browser itself. $\endgroup$ Commented Sep 7, 2023 at 20:04
  • $\begingroup$ @JohnOmielan Interesting. But just now I discarded my draft question and closed the browser, and when I reopened everything and pasted the question back in, the problem showed up immediately. So I think this is not exactly what you are describing (or maybe it's just worse in Chrome than Edge). Regarding Meta, your comment prompted me to search there, and I found a few related questions (for example meta.stackexchange.com/questions/386776/…), but no answers. $\endgroup$
    – A. Howells
    Commented Sep 7, 2023 at 20:33
  • $\begingroup$ Thanks for your additional information. Since reposting on a clean instance didn't solve the problem, I agree it's likely a somewhat different issue for you. As for your example Meta question that you found, I recall that's one which I've also seen previously. Regarding answers to those questions, my recollection is that most of them didn't have any. $\endgroup$ Commented Sep 7, 2023 at 20:40
  • $\begingroup$ I'm using Chromium and Chrome across a myriad of platforms and have no problems. $\endgroup$
    – Asaf Karagila Mod
    Commented Sep 7, 2023 at 22:34
  • 2
    $\begingroup$ The problem is seen during question preview both on main site and meta site. I use the site on Android mobile device with Firefox. Surprisingly the answer preview works fine and that's one of the reasons I didn't notice it so far. $\endgroup$
    – Paramanand Singh Mod
    Commented Sep 8, 2023 at 1:33
  • 2
    $\begingroup$ This bug occurs reproducibly for me with an updated Firefox (Firefox 121.0 on Linux) in the preview pane for both questions and answers: $\{X\}$ is typeset improperly as just $X$ (with no curly braces). This is not limited to Chrome. $\endgroup$
    – D.W.
    Commented Jan 15 at 7:57
  • 1
    $\begingroup$ We have looked into this and have tried to recreate this issue across multiple browsers and weren't able to do so. If you have more details on the steps to reproduce this we can give this another go. $\endgroup$
    – Emerson StaffMod
    Commented Jul 11 at 15:55

1 Answer 1

0
$\begingroup$

This (very kludgy) answer is based on the comments that followed the originally posted question.

According to one of the comments, the problem shows when you are posting a question, but not when you are posting an answer. The issue is, what happens if you pretend that you are posting a self-answer, as you are posting the question?

If the bug is still present in the self-answer, then the kludgy workaround in this response will not work. If the bug is not still present in the self-answer, then the kludgy workaround will work.


Simply, temporarily pretend that you are also posting a self-answer, copy the entire posted question into the answer box, and see if it renders as desired. If so, then it seems reasonable to assume that the posted question will render correctly after it is posted.

So, once you verify the rendering, simply delete the self-answer and uncheck the answer your own question checkbox.

$\endgroup$

You must log in to answer this question.

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