-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgen
executable file
·43 lines (30 loc) · 971 Bytes
/
gen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/python3
import sys
import os
os.chdir('./statements/latex')
listFiles = []
if len(sys.argv) == 1:
listFiles = os.listdir('.')
else:
for i in range(1, len(sys.argv)):
listFiles.append(sys.argv[i])
print(listFiles)
for data in listFiles:
name = ''
if data.endswith('.tex'):
name = data[:4]
else:
continue
if os.path.exists('{}.tex'.format(name)):
os.system('xelatex -interaction=batchmode {}.tex'.format(name))
extension = ["{}.aux", "{}.fls", "{}.log", "{}.out", "{}.fdb_latexmk", "{}.synctex.gz"]
for ext in extension:
if os.path.exists(ext.format(name)):
os.remove(ext.format(name))
if os.path.exists('__latexindent_temp.tex'):
os.remove('__latexindent_temp.tex')
if os.path.exists('{}.pdf'.format(name)):
os.replace('{}.pdf'.format(name), '../pdf/{}.pdf'.format(name))
else:
print("Failed to generate pdf")
os.chdir('../../')