Originally created by @jukofyork on GitHub (Jan 7, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/410
Some Latex seems to get rendered but most doesn't seem to work, eg:
```
\begin{aligned} \text{Predict:} & x_{k} = f(x_{k-1}) + w_k \\ \text{Update:} & y_{k} = h(x_{k}) + v_k \ \end{aligned}
```
or any use of `$...$` for expressions.
Hi, Thanks for creating this issue! The issue stems from LLMs not generating LaTeX in a correct format. You can also observe the same problem with ChatGPT like such:
I'll try to see if there are any quick fixes to handle those edge cases, but I'll close this as not planned for now, Thanks!
<!-- gh-comment-id:1879949218 -->
@tjbck commented on GitHub (Jan 7, 2024):
Hi, Thanks for creating this issue! The issue stems from LLMs not generating LaTeX in a correct format. You can also observe the same problem with ChatGPT like such:
<img width="696" alt="image" src="https://github.com/ollama-webui/ollama-webui/assets/25473318/63bb2112-25ce-4c21-b265-f69e2dcd98dc">
<img width="432" alt="image" src="https://github.com/ollama-webui/ollama-webui/assets/25473318/2f44bd57-f5de-4196-a1bb-35bf13ae4404">
I'll try to see if there are any quick fixes to handle those edge cases, but I'll close this as not planned for now, Thanks!
Just updated the UI rendering logic, I can't guarantee that the UI will render LaTeX 100% of the time as per the reason mentioned above, but it should cover more edge cases than before, Thanks!
<!-- gh-comment-id:1879952214 -->
@tjbck commented on GitHub (Jan 7, 2024):
Just updated the UI rendering logic, I can't guarantee that the UI will render LaTeX 100% of the time as per the reason mentioned above, but it should cover more edge cases than before, Thanks!
Still it sometimes can't render latex properly, even when the expressions are in $$.
<!-- gh-comment-id:2198577804 -->
@YangSJ1 commented on GitHub (Jun 30, 2024):
Still it sometimes can't render latex properly, even when the expressions are in $$.
It also seems able to use \\( <expression \\) for inline expressions or:
\\[ <expression> \\]
BUT only if you double escape the \ symbols!
I haven't found a way yet to get it to display $ <expression> $ though, and sometimes it will try to indent the non-inline version and that seems to screw up too...
I found this out by asking GPT-4o to try lots of different versions, but sadly however much I tried; I couldn't find a system message that actually encourages models to use this format and they will nearly always just revert to the broken format until you remind them 😦
<!-- gh-comment-id:2198607100 -->
@jukofyork commented on GitHub (Jun 30, 2024):
I've figured out this so far:
If the model outputs like this:
```
$$
<expression>
$$
```
or this:
```
\[
<expression>
\]
```
It won't display correctly.
But it can display:
```
$$ <expression> $$
```
It also seems able to use `\\( <expression \\)` for inline expressions or:
```
\\[ <expression> \\]
```
BUT only if you **double escape** the `\` symbols!
I haven't found a way yet to get it to display `$ <expression> $` though, and sometimes it will try to indent the non-inline version and that seems to screw up too...
I found this out by asking `GPT-4o` to try lots of different versions, but sadly however much I tried; I couldn't find a system message that actually encourages models to use this format and they will nearly always just revert to the broken format until you remind them 😦
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @jukofyork on GitHub (Jan 7, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/410
Some Latex seems to get rendered but most doesn't seem to work, eg:
or any use of
$...$for expressions.@tjbck commented on GitHub (Jan 7, 2024):
Hi, Thanks for creating this issue! The issue stems from LLMs not generating LaTeX in a correct format. You can also observe the same problem with ChatGPT like such:
I'll try to see if there are any quick fixes to handle those edge cases, but I'll close this as not planned for now, Thanks!
@tjbck commented on GitHub (Jan 7, 2024):
Just updated the UI rendering logic, I can't guarantee that the UI will render LaTeX 100% of the time as per the reason mentioned above, but it should cover more edge cases than before, Thanks!
@YangSJ1 commented on GitHub (Jun 30, 2024):
Still it sometimes can't render latex properly, even when the expressions are in $$.
@jukofyork commented on GitHub (Jun 30, 2024):
I've figured out this so far:
If the model outputs like this:
or this:
It won't display correctly.
But it can display:
It also seems able to use
\\( <expression \\)for inline expressions or:BUT only if you double escape the
\symbols!I haven't found a way yet to get it to display
$ <expression> $though, and sometimes it will try to indent the non-inline version and that seems to screw up too...I found this out by asking
GPT-4oto try lots of different versions, but sadly however much I tried; I couldn't find a system message that actually encourages models to use this format and they will nearly always just revert to the broken format until you remind them 😦