Skip to content

Rendering LaTeX from a source (how to escape the backslashes?) #10793

@VoidZeroe

Description

@VoidZeroe

Describe the bug

I built an app that displays calculations both inline and in blocks, after specifying delimiters, the app that worked properly with version 4.44 no longer works after updating to 5.20, tried for all versions>5 and the result was the same.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

delimiters=[{"left": "$$", "right": "$$", "display": True },
            {"left": "$", "right": "$", "display": False }, 
               ]
import gradio as gr
with gr.Blocks() as demo:
    gr.Markdown("""This is an example of inline math: $E = mc^2$. You can also use inline mode for small fractions like $\frac{a}{b}$.

Now, here is a displayed equation:

$$F = G \frac{m_1 m_2}{r^2}$$ """)
demo.launch(debug=True, share=False, server_port=8080)

Screenshot

the text gets printed without rendering

Logs

No Errors

System Info

Gradio Environment Information:
------------------------------
Operating System: Darwin
gradio version: 5.20.1
gradio_client version: 1.7.2

------------------------------------------------
gradio dependencies in your environment:

aiofiles: 23.2.1
anyio: 4.8.0
audioop-lts: 0.2.1
fastapi: 0.115.11
ffmpy: 0.5.0
gradio-client==1.7.2 is not installed.
groovy: 0.1.2
httpx: 0.28.1
huggingface-hub: 0.29.3
jinja2: 3.1.6
markupsafe: 2.1.5
numpy: 2.2.3
orjson: 3.10.15
packaging: 24.2
pandas: 2.2.3
pillow: 11.1.0
pydantic: 2.10.6
pydub: 0.25.1
python-multipart: 0.0.20
pyyaml: 6.0.2
ruff: 0.9.10
safehttpx: 0.1.6
semantic-version: 2.10.0
starlette: 0.46.1
tomlkit: 0.13.2
typer: 0.15.2
typing-extensions: 4.12.2
urllib3: 2.3.0
uvicorn: 0.34.0
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.


gradio_client dependencies in your environment:

fsspec: 2025.3.0
httpx: 0.28.1
huggingface-hub: 0.29.3
packaging: 24.2
typing-extensions: 4.12.2
websockets: 15.0.1

Severity

Blocking usage of gradio

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions