4
$\begingroup$

I was writing an answer to a question on the main site, and using spoiler blocks as part of the answer. Several of the spoiler blocks include MathJaX with $$ and the align environment.

In the editor preview, all the maths is shifted off to the left. In the rendered output, it's centre-aligned as maths in $$ usually is. Here's a screenshot showing the difference:

enter image description here

Here's the source for that block (all squashed onto a single line for the needs of spoiler formatting):

>!$$\begin{align*}I\mathbf{x} &= \mathbf{x} \\H\mathbf{x} &= \alpha\left(\mathbf{n} \times \mathbf{x}\right) \\H^2\mathbf{x} &= \alpha\left(\mathbf{n} \times \alpha\left(\mathbf{n} \times \mathbf{x}\right)\right) \\&= \alpha^2 \left(\mathbf{n} \times \left(\mathbf{n} \times \mathbf{x}\right)\right)  \\H^3\mathbf{x} &= -\alpha^3 \left(\mathbf{n} \times \mathbf{x}\right) \\H^4\mathbf{x} &= -\alpha^4 \left(\mathbf{n} \times \left(\mathbf{n} \times \mathbf{x}\right)\right)\end{align*}$$

I would expect the two renders to match; i.e., for it to be centre-aligned in the preview.

I'm using Safari 8.0.3 on the latest build of OS X Yosemite.

$\endgroup$
  • $\begingroup$ (This comment defines \xx and \nn so one can test the code given above. For whatever reason, I couldn't get \cross to work.) $\newcommand{\xx}{\mathbf{x}}\newcommand{\nn}{\mathbf{n}}$ $\endgroup$ – apnorton Jan 1 '15 at 17:35
  • $\begingroup$ @anorton: Oops, I forgot to copy the definitions over. I've updated the snippet so that you don't need those definitions. Thanks for pointing it out. $\endgroup$ – alexwlchan Jan 1 '15 at 18:30
  • $\begingroup$ Maybe you know or maybe you don't, but \vec is a pre-existing command. It's usually not a great idea to overwrite those, since it can mess up with other people's answers on the page (depending on the order of the answers, for example). $\endgroup$ – Asaf Karagila Jan 1 '15 at 18:52
  • $\begingroup$ @AsafKaragila: I did know that, but didn't consider it when writing that answer. I've swapped it out for \myvec instead. $\endgroup$ – alexwlchan Jan 1 '15 at 19:00

You must log in to answer this question.

Browse other questions tagged .