30 in_read, in_write = os.pipe()
31 os.write(in_write,
"\\documentclass{minimal}\n")
32 os.write(in_write,
"\\usepackage{amsmath}\n")
33 os.write(in_write,
"\\usepackage{mathtools}\n")
34 os.write(in_write,
"\\usepackage{lmodern}\n")
35 os.write(in_write,
"\\begin{document}\n")
38 for f
in latex_formulas:
40 os.write(in_write,
"\\clearpage\n")
42 os.write(in_write,
"\\begin{gather*}" + f +
"\\end{gather*}\n")
44 os.write(in_write,
"\\end{document}\n")
48 subprocess.call([
'latex',
'-output-directory=/tmp'], stdin=in_read)
52 for (handle, path)
in eps_file_list:
53 subprocess.call([
'dvips',
'/tmp/texput.dvi',
'-pp', str(page_num),
'-o',
'/tmp/texput.ps'])
54 subprocess.call([
'ps2eps',
'/tmp/texput.ps',
'-f'])
55 with open(
'/tmp/texput.eps',
'r') as infile: 57 with open(path, 'w')
as outfile:
62 os.remove(
'/tmp/texput.dvi')
67 os.remove(
'/tmp/texput.ps')
72 os.remove(
'/tmp/texput.eps')
82 return '\\text{' + text.replace(
'_',
'\_') +
'}' 85 for (handle, file_name)
in eps_file_list:
def removeEpsListFiles(eps_file_list)
def exportToEpsList(eps_file_list, latex_formulas)