hugo-theme-minima
hugo-theme-minima copied to clipboard
multiline math was not displayed correctly
hi, I want to migrate my blog to minima but I found something unexpected.
$$
\begin{aligned}
T(n) & = c_1 n + c_2 (n - 1) + c_3 (n - 1) + c_4 \sum_{j = 2}^n t_j \\
& + c_5 \sum_{j = 2}^n (t_j - 1) + c_6 \sum_{j = 2}^n (t_j - 1) + c_7 (n - 1)
\end{aligned}
$$
Above math equations were displayed in a single line, and \\
was ignored.
So would you fix this, or there is another way to type a newline?
I found that \\\\
can make a linebreak.
It's not cool......
I'm not very familiar with this syntax. But could you please provide steps on how to reproduce this locally?
aligned
is used to display multiline math equations, and \\
is used to make a linebreak. For example,
$$
\begin{aligned}
a \\
b
\end{aligned}
$$
This should be rendered as something like
a
b
But now it is
ab
This means that \\
does not make a linebreak correctly. I found that \\\\
can make a linebreak, so there may be extra interpreting step before math render engine (or framework that deals with math).
\\\\
works but is annoying, because I have to use \\\\
to make math display correct on my website, but at the same time it make two linebreak in other place.
It is an issue I hadn't solved since I started using Hugo. It is likely that the markdown engine Hugo uses takes every heading \
as an escape character :(
ok 😃
At least we have a solution \\\\
.
i found these https://github.com/xsro/xsro.github.io/blob/hugo/layouts/partials/extend_head.html#L1-L24
I have one idea, I'll try to make a pull... but first I need to update the theme for my site :smile:
\cr
might be the most compatible solution by far, also works with other math frameworks.
$$
\begin{aligned}
a \cr
b
\end{aligned}
$$
is also rendered as:
$$ \begin{aligned} a \cr b \end{aligned} $$
About one year ago GitHub does the same thing when I type math equations. \
was always escaped until one day they fixed this problem, along with the problem of rendering \{
directly into {
before Katex was able to touch the code, consequently making many equations incorrectly shown, and I now recommend using \newline
and \lbrace
instead. If the issue is fixed someday, tex codes using \\\\
due to the current FEATURE will not be shown as you expect, but those things would be shown properly under most circumstances.
i found these https://github.com/xsro/xsro.github.io/blob/hugo/layouts/partials/extend_head.html#L1-L24
I have one idea, I'll try to make a pull... but first I need to update the theme for my site :smile:
Seems interesting. However, this script could only be used when Hugo has such FEATURE, is that so?
It is an issue I hadn't solved since I started using Hugo. It is likely that the markdown engine Hugo uses takes every heading
\
as an escape character :(
Perhaps it is caused by the backslashLineBreak
being true in blackfriday. I shall check it later today.
Katex itself supports \\
. In many other places such equations are shown correctly using Katex.
Ref: (both written in zh_CN)
https://hugocn.netlify.app/configuration.html#%E9%85%8D%E7%BD%AE%E6%B8%B2%E6%9F%93%E5%BC%95%E6%93%8Eblackfriday%EF%BC%89
https://byteprince.com/posts/2d4e6e67/
i found these https://github.com/xsro/xsro.github.io/blob/hugo/layouts/partials/extend_head.html#L1-L24 I have one idea, I'll try to make a pull... but first I need to update the theme for my site 😄
Seems interesting. However, this script could only be used when Hugo has such FEATURE, is that so?
Sadly I guess so 😪