title: How to print the content of variables inside math expression using Latex and Sympy in Matplotlib?
body: <p>I am working on a software that solve an engineering problem. The software should printout the calculation for the user in a pretty mathematical expression format. I used Matplotlib,Latex and Sympy in PyQt and succeeded to do everything I wanted except for displaying the values of the variables in the form of a fracture (please see the picture below to understand what I mean). Also, I would like to know how to control the font size and style of the latex text(see the picture). below is a part of the code.</p>
  
  <p>See this picture</p>
  
  <p><img src="https://i.stack.imgur.com/8M9xK.png" alt=""></p>
  
  <pre><code>def Calculate(self):
      plt.rc('mathtext', fontset='cm')
  
      self.right_column_stiffness = int(self.lineEdit_3.text())
      self.left_column_stiffness = int(self.lineEdit_4.text())
      self.beam_load = int(self.lineEdit_4.text())
  
      w=self.beam_load*(1000/12)
      g=386.1
      self.mass = w/g
  
      formula=r'm=\frac{w}{g}='
  
      self.result_figure.text(.05, .85, r'${}$'.format(formula+latex(w)), fontsize=20)
      [enter image description here][1]        
      self.result_canvas.draw()
  </code></pre>