title: Compile Latex document by python
body: <p>I have been struggling with compiling latex document and creating pdf.</p>
  
  <p>I have successfully created .tex file by python. I want to make it even more automated by compiling .tex in python.</p>
  
  <p>The code I have tried is:</p>
  
  <pre><code>import os 
  os.system("filename.tex")
  </code></pre>
  
  <p>I put this codes at the end of my python code.</p>
  
  <p>But it only opens the software Texmaker, not compiling it to pdf.</p>
  
  <p>If you could give me any hint I will be so grateful!!</p>