from tkinter import *
import matplotlib.pyplot as plt
window = Tk()
entryBox = Entry(window,text='input latex command')
entryBox.grid(row=0,column=0)
s = '$\sum {n} = \frac{n(n+1)}{2}$'
plt.text(.5,.5, s, fontsize=40)
plt.show()
This snippet displays only a part of the expression as follows:
instead of the expected result:
(This is achieved by changing the 7th line as: plt.text(.3,.3, r'$\sum {n} = \frac{n(n+1)}{2}$', fontsize=40)
).
My understanding is that in the first case we are not passing the string as a raw string. How can I get the plot to render correctly when I have the string as a string variable but cannot input it as a string literal?