And also, I documented the pecularities of writing latex in markdown that then gets translated to HTML and rendered by ketex.
At a 10000 foot level:
inline math mode with $ works fine, display math mode with $$ works fine too.
Markdown in its specification has backslash as an escape for certain characters. Of interest, backslash itself (\), parenthese ((, )), and square brackets ([, ]) needs to be escaped. This necessitates things like \\( which renders as \( in HTML, which is a left delimiter for inline math for ketex
Display mode with environments with line breaks require particular attention to whitespace. Firstly, latex \\ in bmatrix or align environment translates to \\\\, but a space is also necessary after \\\\ in order to not accidently escape the next character.
As well, the closing of the environment must either be on the same line, or in a newline but with the previous line not having any trailing spaces. To illustrate, of the following 3 very similar looking markdown snippets, only the first is properly displayed: (whitespace denoted via ␣)
We can also further obfuscate latex by writing everything in one line, e.g the following is successful:
\begin{bmatrix}1 & 2 & 3\\\\7 & 14 & 21␣\end{bmatrix} - but the problem is if we wish to nest align with bmatrix environments, everything in 1 line is very messy, so the considerations for line breaks above are necessary.
I fixed one page (the whitney tensor product page) see attached for evidence whitney_tensor_product_page.pdf
And also, I documented the pecularities of writing latex in markdown that then gets translated to HTML and rendered by ketex.
At a 10000 foot level:
$
works fine, display math mode with$$
works fine too.\
), parenthese ((
,)
), and square brackets ([
,]
) needs to be escaped. This necessitates things like\\(
which renders as\(
in HTML, which is a left delimiter for inline math for ketex\\
inbmatrix
oralign
environment translates to\\\\
, but a space is also necessary after\\\\
in order to not accidently escape the next character. As well, the closing of the environment must either be on the same line, or in a newline but with the previous line not having any trailing spaces. To illustrate, of the following 3 very similar looking markdown snippets, only the first is properly displayed: (whitespace denoted via␣
)(successful):
(unsuccessful, no trailing whitespace after
\\\\
):(unsuccessful, due to whitespace at the end of the 3rd line - this breaks the parser looking for the
\end{bmatrix}
environment):We can also further obfuscate latex by writing everything in one line, e.g the following is successful:
\begin{bmatrix}1 & 2 & 3\\\\7 & 14 & 21␣\end{bmatrix}
- but the problem is if we wish to nestalign
withbmatrix
environments, everything in 1 line is very messy, so the considerations for line breaks above are necessary.