If you don't want to make that extra text file, you may be able to pipe the generated string into the latex program, though you'd have to do more research on how both latex and subprocess works to see if that's feasible. Note that we're not calling texworks.exe, which is essentially a text editor - we're directly calling latex.exe, the actual program which converts tex files.Īs long as input_file.tex exists within the same folder as the Python script, you should get the output pdf. then wait for LaTeX to finish before returning from the function. So, if I did create_pdf("my_input_file.tex", "my_output_file.pdf"), this will cause Windows to run the following command on the command line: latex -output-format=pdf -job-name=my_output_file.pdf my_input_file.tex Should it not work at times, you can simply type r to force a refresh. SumatraPDF is available for Windows and does auto-refresh the view. If you need that, you should switch your viewer. 'latex', # Or maybe 'C:\\Program Files\\MikTex\\miktex\\bin\\latex.exe Adobe Reader and/or Adobe Acrobat are notorious for not supporting auto-refreshing the view of a PDF which changed on disk. Installation notes: Install Winshell after installing MiKTeX. Before you use spell-check in Texmaker, you may need to install a dictionary see section 1.3 of the Texmaker user manual. You want to call the latex program, providing the filename and desired output filename: import subprocessĭef create_pdf(input_filename, output_filename): After you have installed Texmaker, go to the QuickBuild section of the Conguration menu and choose pdatex+pdfview.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |