我在Windows10上使用python3.7和PyCharm,我有一个Tex文件,我想用pdflatex生成一个pdf。
pdfl = PDFLaTeX.from_texfile('test.tex')
pdf, log, completed_process = pdfl.create_pdf(keep_pdf_file=True, keep_log_file=True)我一直收到以下错误: FileNotFoundError: Errno 2,没有这样的文件或目录:FileNotFoundError,该程序试图在临时文件夹中的用户文件夹中找到特定的file.pdf。(Texlive和TexStudio也被安装和工作。)
我做错了什么?
谢谢。
发布于 2022-06-08 21:58:35
只需指定.tex文件的位置即可。
def tex_pdf():
current_path = os.path.dirname(os.path.dirname(__file__))
media_folder = os.path.join(current_path, 'media/')
with open(f'{media_folder}tex/sometexfile.tex', 'w') as file:
file.write('\\documentclass{article}\n')
file.write('\\begin{document}\n')
file.write('Hello Palo Alto!\n')
file.write('\\end{document}\n')
pdfl = PDFLaTeX.from_texfile(f'{media_folder}tex/sometexfile.tex')
pdf = pdfl.create_pdf(keep_pdf_file=True, keep_log_file=False)https://stackoverflow.com/questions/71991645
复制相似问题