Skip to content

Instantly share code, notes, and snippets.

@gmarull
gmarull / example-tex2svg.py
Last active October 25, 2025 13:12
Render TeX to SVG in Python using matplotlib and display with PyQt
import sys
from PyQt5.QtWidgets import QApplication
from PyQt5.QtSvg import QSvgWidget
from io import BytesIO
import matplotlib.pyplot as plt
# matplotlib: force computer modern font set
plt.rc('mathtext', fontset='cm')