CaiJimmy / hugo-theme-stack

Card-style Hugo theme designed for bloggers
https://stack.jimmycai.com
GNU General Public License v3.0
5.06k stars 1.66k forks source link

Multiline equations with `align` are not displayed correctly #872

Closed giovanniberti closed 1 year ago

giovanniberti commented 1 year ago

What happened?

Hi! Thank you for the awesome theme :)

I think I found a bug when layouting multiline equations with the align* environment.

For example with this Markdown:

$$
\begin{align*}
2x + 1 &= 0 \\
2x + 1 &= 0 
\end{align*}
$$

I get this:

Schermata del 2023-09-01 22-09-48

While from KaTeX I get this: Schermata del 2023-09-01 22-10-19

Hugo version

hugo v0.116.1+extended

Theme version

3.19.0

What browsers are you seeing the problem on?

Firefox, Chrome

More information about the browser

Linux, Firefox 116, Chrome 109, Not tested on other browsers

Relevant log output

No response

Link to Minimal Reproducible Example

https://github.com/giovanniberti/hugo-theme-stack/tree/align-bug

giovanniberti commented 1 year ago

Btw, with the following raw shortcode

{{ .Inner }}

and Markdown

{{< raw >}}
$$
\begin{align*}
2x + 1 &= 0 \\
2x + 1 &= 0 
\end{align*}
$$
{{< /raw >}}

I managed to get the desired result. Would be nice to not to use a workaround though :)

CaiJimmy commented 1 year ago

The reason is because Markdown is escaping backslash.

Instead of \\, use \\\\.

image image

Your shortcode works because {{< >}} skips Markdown rendering: image