Rendering LateX markdown in textbox by delimiting with $ fails, only works with $$
Closed this issue · 1 comments
Describe the bug
Latex code delimited by a single $ is left unaltered after rendering in textbox. Instead, when flanked by $$, it is rendered correctly, i.e. on a line of its own. I assume this to be a bug, because I found references in previous discussions to delimiting LateX by $, and common markdown engines, such as RStudio, accept both: $ for inline rendering, and $$ for a line of its own.
The consequence of having to flank all LateX by $$ is that every LateX expression is rendered on a new line of its own. For example, "The letter
The letter
y
is often used for the dependent variable
Have you searched existing issues? 🔎
- I have searched and found no existing issues
Reproduction
import gradio as gr
import random
def random_response(message, history):
return random.choice([
"The letter $$y$$ is often used to represent the dependent variable",
"The letter $y$ is often used to represent the dependent variable"])
app = gr.ChatInterface(fn=random_response, type = "messages", title = "Linear Models")
app.launch()
Screenshot
Logs
No response
System Info
Gradio Environment Information:
------------------------------
Operating System: Windows
gradio version: 5.5.0
gradio_client version: 1.4.2
------------------------------------------------
gradio dependencies in your environment:
aiofiles: 23.2.1
anyio: 4.4.0
audioop-lts is not installed.
fastapi: 0.115.5
ffmpy: 0.3.2
gradio-client==1.4.2 is not installed.
httpx: 0.27.0
huggingface-hub: 0.26.2
jinja2: 3.1.4
markupsafe: 2.1.5
numpy: 1.26.4
orjson: 3.10.3
packaging: 24.0
pandas: 2.2.2
pillow: 10.3.0
pydantic: 2.7.2
pydub: 0.25.1
python-multipart==0.0.12 is not installed.
pyyaml: 6.0.1
ruff: 0.4.8
safehttpx: 0.1.1
semantic-version: 2.10.0
starlette: 0.41.2
tomlkit==0.12.0 is not installed.
typer: 0.12.3
typing-extensions: 4.12.1
urllib3: 2.2.1
uvicorn: 0.30.1
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.
gradio_client dependencies in your environment:
fsspec: 2024.5.0
httpx: 0.27.0
huggingface-hub: 0.26.2
packaging: 24.0
typing-extensions: 4.12.1
websockets: 11.0.3
Severity
Blocking usage of gradio
Hi @roberto-viviani you can change the default latex delimiters by setting the latex_delimiters
attribute of gr.Chatbot
and passing it in the chatbot
parameter of gr.ChatInterface
. See: