I thought I knew a thing or two about post formatting, but these posts on the two Mathematics sites surprised me: Vector Convolution? (Mathematics SE) and Vector convolution? (MathOverflow). The first equation in those posts uses MathJax but without the familiar $
or $$
(or on selected sites, \$
) delimiters; instead MathJax seems to detect \begin{equation}
and \end{equation}
now. This very old post seems to suggest that didn't work before, but I assume that was an old version of MathJax. Is this behaviour documented somewhere, and are there more delimiters like this?
1 Answer
Here are the delimiters that I confirmed to work on MathOverflow (it will be a bit different on sites that use \$
instead of $
). I’m not sure if the list is comprehensive; feel free to fix it if anything is missing or inaccurate:
Inline math delimiters
$ ... $
.(Neither
\( ... \)
nor\\( ... \\)
work.)Display math delimiters
$$ ... $$
and\\[ ... \\]
.(The latter is an escaped version of LaTeX’s
\[ ... \]
.)LaTeX-style environments
\begin{<name>} ... \end{<name>}
.Here,
<name>
is any string with balanced braces{ ... }
; it must be the same in\begin
and in\end
, otherwise it is not recognized as a delimiter. (Improperly nested environments such as\begin{equation} ... \begin{align} ... \end{equation}
are recognized as MathJax delimiters, but lead to MathJax error messages.)MathJax predefines common equation environments such as
equation
,align
, ormatrix
; moreover, it supports user-defined environments using the\newenvironment
command. The\begin{<name>} ... \end{<name>}
structure is in any case recognized as a MathJax delimiter even if environment<name>
does not exist, or if it is invalid as an environment name (e.g., if it includes unexpandable control sequences), however such cases lead to MathJax error messages.For single-letter environment names,
\begin X
and\end X
are not recognized as MathJax delimiters, even though they work fine inside already-recognized MathJax expressions (just like in actual LaTeX).Unlike LaTeX, MathJax allows equation environments to be enclosed in other delimiters, such as
$$\begin{align} ... \end{align}$$
. The outer delimiters are redundant.Fun fact: both MathJax and LaTeX allow defining an environment with empty name with
\newenvironment{}{X}{Y}
. This redefines the\end
command, wreaking havoc left and right; it appears that in LaTeX,\newenvironment{<name>}
only checks for the existence of\<name>
, but not for\end<name>
, and happily redefines it if it exists. Sounds like a bug, if you ask me.
-
1In LaTeX you can't do
\newcommand{\end...}
, so there's no need to check whether\end<name>
exists in\newenvironment{<name>}
as environments in their command form are always paired up. You don't, for example, have\something
end with\endsomethingelse
under\newenvironment{something}
. It's always\something
...\endsomething
. Of course, in TeX you can do that.– WernerCommented Feb 4, 2022 at 23:43 -
@Werner The point is that
\end
already exists in LaTeX, it does not need to be defined with\newcommand
. And then, as I wrote in the answer, LaTeX accepts\newenvironment{}{...}{...}
and erroneously overwrites\end
, which completely breaks further environments. Commented Feb 5, 2022 at 7:32 -
There is absolutely no value in doing
\newenvironment{}{X}{Y}
. You can also do\renewenvironment{document}{X}{Y}
and screw things up equally. Some basic/fundamental understanding of a language is required when using (re)definitions.– WernerCommented Feb 5, 2022 at 16:23 -
3I don’t see much value in continuing this increasingly off-topic discussion, but anyway: you are making a strawman argument. A
\renewenvironment
is explicitly saying “I’m redefining an existing environment. I know what I’m doing. And even if I don’t, it’s my fault if this breaks anything.” In contrast, a\newenvironment
pretends to check that the environment is safe to define, and does not conflict with any preexisting macros. It turns out that the check is half-hearted, and may fail to detect some conflicts; that’s a bug. Commented Feb 5, 2022 at 17:11
\begin{equation}
worked as far back as at least 2018 (kinda).\begin{matrix}...\end{matrix}
would be processed even if it is not in math mode delimiters…"\begin{(\w+)}
and\end{(\w+)}
works (as long as both groups are equal), or only certain keywords?