import gradio as gr import re def show_latex(latex_input): # Use regex to find all occurrences of \begin{...} and \end{...} and wrap them with $$ latex_input = wrap_begin_end_with_dollars(latex_input) # Convert inline LaTeX ($...$) to block LaTeX ($$...$$) latex_input = re.sub(r'(?