Excalidraw currently doesnโt support , which sucks. The workaround is to generate an SVG for whatever math you want to render, and paste that in.
You can use this script to generate the SVG:
import matplotlib.pyplot as plt
# use svg backend
plt.switch_backend('svg')
# enable latex rendering
plt.rcParams['text.usetex'] = True
# create figure
fig, ax = plt.subplots(figsize=(4, 2))
ax.axis('off') # no axes
latex_str = r"$\nabla \mathcal J(\theta)$"
ax.text(0.5, 0.5, latex_str, fontsize=20, ha='center', va='center')
fig.savefig("latex.svg", format="svg", bbox_inches='tight', transparent=True)
Et voilร :