3
$\begingroup$

The code

\require{AMScd}\begin{CD}
0 @>>> \mathbf D(C) \\
0 @>>> M
\end{CD}

produces $$\require{AMScd}\begin{CD} 0 @>>> \mathbf D(C) \\ 0 @>>> M \end{CD}$$

To make sure we're seeing the same thing, when I preview the page, it shows up thus for me, with the arrow in the second row aligned with the $\mathbf D(C)$ in the first row:

Non-aligned behaviour

This happens with Firefox, Safari, and Chrome, with all renderers (at least on Safari—I didn't try them all on each browser), in macOS 13.1.

When compiled using TeX (as opposed to MathJax), the result of the code, mutatis mutandis, has the expected alignment of the two arrows:

Expected aligned behaviour

Including vertical arrows restores the expected behaviour:

\begin{CD}
0 @>>> \mathbf D(C) \\
@| @VVV \\
0 @>>> M
\end{CD}

$$\begin{CD} 0 @>>> \mathbf D(C) \\ @| @VVV \\ 0 @>>> M \end{CD}$$

even if the arrows are ‘empty’:

\begin{CD}
0 @>>> \mathbf D(C) \\
@. @. \\
0 @>>> M
\end{CD}

$$\begin{CD} 0 @>>> \mathbf D(C) \\ @. @. \\ 0 @>>> M \end{CD}$$

As @EmilJeřábek points out, changing \\ to \\\\ also fixes the problem:

\begin{CD}
0 @>>> \mathbf D(C) \\\\
0 @>>> M
\end{CD}

$$\begin{CD} 0 @>>> \mathbf D(C) \\\\ 0 @>>> M \end{CD}$$

I think that this is because \\\\ is interpreted essentially as \\{}\\ ; that is, all that's needed is a non-horizontal row between two ‘horizontal’ rows, even if it's empty.

$\endgroup$
4
  • 1
    $\begingroup$ The root of the problem is that the Markdown parser interprets the \\ (thus simplifies it to \ ) before it is passed to MathJax. If you write \\\\, it works. This is strange, because otherwise the parser leaves \\ unchanged inside MathJax expressions (e.g., in \begin{align}...\end{align}). It’s possible that the exception only applies to specific MathJax environments, and CD is missing on the list. $\endgroup$ Feb 7, 2023 at 7:58
  • 1
    $\begingroup$ No, wait: the HTML source has the correct \\, so perhaps the bug is in MathJax after all. But anyway, it works with \\\\, hence there is some problem with unquoting the \\. $\endgroup$ Feb 7, 2023 at 8:52
  • 1
    $\begingroup$ @EmilJeřábek, thanks for the diagnostics! Interestingly, it's not just about the \\ ; your comment inspired me to test, and adding in an interstitial row of vertical arrows, even if ‘empty’, restores the expected behaviour. (EDIT: In fact, that seems to be what your solution is doing, as indicated by the extra vertical space it introduces: \\\\ seems to be effectively \\{}\\ .) I have edited accordingly. $\endgroup$
    – LSpice
    Feb 8, 2023 at 23:00
  • 1
    $\begingroup$ Oh, I see. So my comments are actually far off. $\endgroup$ Feb 9, 2023 at 7:29

0

You must log in to answer this question.

Browse other questions tagged .