Open colorizer opened 3 years ago
The same issue persists for mathjax. It must be a markdown issue.
Yeah that's a markdown renderer's issue, or to be precise, a syntax conflict problem between TeX and Markdown,
Characters | TeX | Markdown |
---|---|---|
_ |
Subscript | Emphasis |
\ |
Command identifier (?) | Escapes |
A simple workaround for this is wrapping the related TeX blocks with HTML <div>
or <span>
(for inline equations) tag, which prevents markdown renderer and no need to add extra escapes in our TeX equations, i.e.:
<div>
$$
\equation \\
\equation
$$
</div>
inline equations <span>$x_{1_2}$</span>
Thanks. That works neatly!
It seems that only <div>
works. <span>
doesn't have any effect. For example, <span>$\displaystyle{j\in \left\{ 2, 3, 4 \right\} }$</span>
doesn't work but using the same with div works.
I can't reproduce that, because the example you paste seems got a TeX syntax error while I'm testing.
FYI, to test if <div>
or <span>
works, just view-source the rendered HTML code, if the TeX equations within these two tags is same as the raw text in Markdown, then it works; if not, then it doesn't work.
It seems that <span>
doesn't work in my case.
I have been using Hugo 0.75.1 as it was the one available in my distro. May be, I should try to update it somehow. Also, I don't know why you are getting an error with tex as it renders fine for me when \
is escaped as in
$\displaystyle{j\in \left\\{ 2, 3, 4 \right\\} }$
Try running it without the \displaystyle{}
may be?
Thanks for telling me how <div>
and <span>
works. I'll let you know if the update solves the issue :)
Sorry, my mistake, I didn't notice that...
\{
and \}
are highlighted on my editor too. I found these on CommonMark Spec:
Perhaps <div>
works because it's a html-blocks according to the spec definition, since <div>
doesn't work either if we put it "inline".
Hi, can shortcode similar to this theme be implemented? It seems that escaping is not required here, even for inline math.
I also encountered this issue. I try to type {}
in mathjax, but either $\{ \}$
or <span>$\{ \}$</span>
work. this case also happened in block math: <div>$$\{ \}$$</div>
, it just didn't render the right {}
brackets .
For instance, I write some code like this:
<span>$\boldsymbol{\theta}=\{\boldsymbol{W}\_{\boldsymbol{e}}, \boldsymbol{W}\_{\boldsymbol{m}}, \boldsymbol{b}\_{\boldsymbol{m}}, \boldsymbol{W}, \boldsymbol{b}, \boldsymbol{v}\}$</span>
and return like this: without any brackets.
KateX needs me to escape the
\\
in the end of each matrix row. Can there be a workaround that doesn't need me to escape the backslash? It works in mmark (currently using default goldmark) but mmark is having issues with_
and it is already being deprecated by hugo.The following code works.
The following doesn't.
Thanks!