The env align is not rendered by KaTeX #10102

Closed
opened 2025-11-02 08:58:12 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @cosing on GitHub (Jan 14, 2023).

Description

line 1

$$\begin{align*}
Y= &-28.482\times 10^6 Fantasy+  7.232×10^6 \times TopDirector\\
   &+ 7.846\times 10^6 Origin + 11.818×10^6 \times Sci Fi
\end{align*}$$

line 2

$$\begin{align*}
Y= &-28.482\times 10^6 Fantasy+  7.232×10^6 \times TopDirector\\
   &+ 7.846\times 10^6 Origin + 11.818×10^6 \times Sci Fi
\end{align*}
$$

line 3

Correctly presented in github or KaTeX:

line 1

$$\begin{align*}
Y= &-28.482\times 10^6 Fantasy+ 7.232×10^6 \times TopDirector\
&+ 7.846\times 10^6 Origin + 11.818×10^6 \times Sci Fi
\end{align*}$$

line 2

$$\begin{align*}
Y= &-28.482\times 10^6 Fantasy+ 7.232×10^6 \times TopDirector\
&+ 7.846\times 10^6 Origin + 11.818×10^6 \times Sci Fi
\end{align*}



line 3

but on [gitea](https://try.gitea.io/cocosing/alignlssue20230114/issues/1)

### Gitea Version

1.19.0+dev-299-g20e3ffd20

### Can you reproduce the bug on the Gitea demo site?

Yes

### Log Gist

_No response_

### Screenshots

_No response_

### Git Version

_No response_

### Operating System

_No response_

### How are you running Gitea?

use https://try.gitea.io/

### Database

None
Originally created by @cosing on GitHub (Jan 14, 2023). ### Description ```md line 1 $$\begin{align*} Y= &-28.482\times 10^6 Fantasy+ 7.232×10^6 \times TopDirector\\ &+ 7.846\times 10^6 Origin + 11.818×10^6 \times Sci Fi \end{align*}$$ line 2 $$\begin{align*} Y= &-28.482\times 10^6 Fantasy+ 7.232×10^6 \times TopDirector\\ &+ 7.846\times 10^6 Origin + 11.818×10^6 \times Sci Fi \end{align*} $$ line 3 ``` Correctly presented in github or [KaTeX](https://katex.org/?data=%7B%22displayMode%22%3Atrue%2C%22leqno%22%3Afalse%2C%22fleqn%22%3Afalse%2C%22throwOnError%22%3Atrue%2C%22errorColor%22%3A%22%23cc0000%22%2C%22strict%22%3A%22warn%22%2C%22output%22%3A%22htmlAndMathml%22%2C%22trust%22%3Afalse%2C%22macros%22%3A%7B%22%5C%5Cf%22%3A%22%231f(%232)%22%7D%2C%22code%22%3A%22%5Cn%5C%5Cbegin%7Balign*%7D%5CnY%3D%20%26-28.482%5C%5Ctimes%2010%5E6%20Fantasy%2B%20%207.232%C3%9710%5E6%20%5C%5Ctimes%20TopDirector%5C%5C%5C%5C%5Cn%20%20%20%26%2B%207.846%5C%5Ctimes%2010%5E6%20Origin%20%2B%2011.818%C3%9710%5E6%20%5C%5Ctimes%20Sci%20Fi%5Cn%5C%5Cend%7Balign*%7D%5Cn%22%7D): line 1 $$\begin{align*} Y= &-28.482\times 10^6 Fantasy+ 7.232×10^6 \times TopDirector\\ &+ 7.846\times 10^6 Origin + 11.818×10^6 \times Sci Fi \end{align*}$$ line 2 $$\begin{align*} Y= &-28.482\times 10^6 Fantasy+ 7.232×10^6 \times TopDirector\\ &+ 7.846\times 10^6 Origin + 11.818×10^6 \times Sci Fi \end{align*} $$ line 3 but on [gitea](https://try.gitea.io/cocosing/alignlssue20230114/issues/1) ### Gitea Version 1.19.0+dev-299-g20e3ffd20 ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? use https://try.gitea.io/ ### Database None
GiteaMirror added the type/bug label 2025-11-02 08:58:12 -06:00
Author
Owner

@zeripath commented on GitHub (Jan 15, 2023):

ok so there are a few problems here.

The error display has clearly been broken somewhere as there should be an error displayed with this.

Once you get that - we need to pass whether there is a display mode or not - clearly that was removed too...

@zeripath commented on GitHub (Jan 15, 2023): ok so there are a few problems here. The error display has clearly been broken somewhere as there should be an error displayed with this. Once you get that - we need to pass whether there is a display mode or not - clearly that was removed too...
Author
Owner

@zeripath commented on GitHub (Jan 15, 2023):

OK I don't understand what could be happening to make the error display disappear - I suspect it's something to do with the cllipboard? @silverwind any ideas? -- AH THERE IS A BUG IN displayError IT SHOULD BE target.classlist.remove NOT target.remove

Now, the issue appears to be that KaTeX isn't setting its setting to display mode once it sees the $ and so the environment doesn't work. My original PR did the parsing of the `$` etc before passing to KaTeX render which would have made this work but clearly that is not good.

It's likely that this represents a bug in KaTeX - but we can just forcibly set the displayMode.

@zeripath commented on GitHub (Jan 15, 2023): OK I don't understand what could be happening to make the error display disappear - I suspect it's something to do with the cllipboard? @silverwind any ideas? -- **AH THERE IS A BUG IN displayError IT SHOULD BE target.classlist.remove NOT target.remove** Now, the issue appears to be that KaTeX isn't setting its setting to display mode once it sees the $$ and so the environment doesn't work. My original PR did the parsing of the `$$` etc before passing to KaTeX render which would have made this work but clearly that is not good. It's likely that this represents a bug in KaTeX - but we can just forcibly set the displayMode.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#10102