It seems like \\ doesn't work correctly here, and I need \newline instead:

$$ \vec{\nabla} \times \vec{A}(\,\vec{r}) = \begin{cases} B_0\hat{z} && \text{if $\vec{r} \in$ some cylinder} \ \vec{0} && \text{ otherwise} \end{cases} $$

  • 2
    $\begingroup$ This seems to be related to this question, see Willie Wong's answer that recommends that you try to avoid nesting math environments. Write \text{if } \vec{r} \text{ lies in some cylinder} instead of \text{if $\vec{r}$ lies in some cylinder}. Note that adding spaces at the beginning and end of the \text environment (whenever appropriate) also results in the correct spacing. $\endgroup$
    – t.b.
    Apr 7, 2012 at 21:46
  • 5
    $\begingroup$ What is very irritating, though, is that your code renders just fine in the preview I get when I edit the source, but that it doesn't work in the posted version. $\endgroup$
    – t.b.
    Apr 7, 2012 at 21:58
  • 2
    $\begingroup$ @t.b.: Yeah, that's what made me mark it as a bug $\endgroup$
    – user541686
    Apr 7, 2012 at 23:06
  • 3
    $\begingroup$ Using $ within \text environment is just... wrong. $\endgroup$
    – Asaf Karagila Mod
    Apr 8, 2012 at 6:18
  • 1
    $\begingroup$ @t.b. apparently two different individuals/teams are responsible for the code in the preview and in the actual presentation... hence sometimes they don't behave exactly the same. $\endgroup$ Apr 9, 2012 at 15:25
  • $\begingroup$ @Willie: thanks for that info. However, it does lead errors. Earlier today I edited a post in which all braces had disappeared once submitted, while the braces are displayed in the preview (and since the preview doesn't doesn't let you tell I happened to overlook one instance). $\endgroup$
    – t.b.
    Apr 9, 2012 at 15:56
  • $\begingroup$ @t.b. I'm not playing apologist. Just stating a fact about why the preview, unfortunately, is not absolutely trustworthy. $\endgroup$ Apr 9, 2012 at 16:00

1 Answer 1


Davide Cervone has generously created an improved parser for us that makes the separation of Markdown and MathJax much more reliable. So far, it's only running client-side, i.e. it's used in the preview, but not in the final rendered version.

A side effect of your bug report is that you've proven that the new parser is indeed better – it handles your case, while the old one doesn't.

Either way, we've now ported the parser to also work during the final rendering of the post on the server. This will be enabled in the next build of the site (probably within the next 24 hours; likely less), after which the behaviors should be identical again.

  • $\begingroup$ It looks like the changes have worked. Here is the original example again: $$\vec{\nabla} \times \vec{A}(\,\vec{r}) = \begin{cases} B_0\hat{z} && \text{if $\vec{r} \in$ some cylinder} \\ \vec{0} && \text{ otherwise} \end{cases}$$ with the nested dollars. $\endgroup$ Apr 13, 2012 at 13:06
  • $\begingroup$ Note that this should also mean that you can use $\rm\LaTeX$ environments without surrounding them with dollar signs. E.g. \begin{equation}E=mc^2\end{equation} produces \begin{equation}E=mc^2\end{equation} even though there are not dollars in this comment anywhere. $\endgroup$ Apr 13, 2012 at 13:08
  • $\begingroup$ do the changes you mention to the code on the server apply to all SE sites? This post seems to indicate that they are still having problems on the chemistry site. $\endgroup$ May 14, 2012 at 13:23
  • 1
    $\begingroup$ @DavideCervone No, the new stuff is currently only running here. But I'd think it's fine to eneable it everywhere soon. $\endgroup$
    – balpha StaffMod
    May 18, 2012 at 7:29
  • $\begingroup$ OK, thanks for the info. That would explain the problem they had over at chemistry. $\endgroup$ May 18, 2012 at 10:31

You must log in to answer this question.

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