-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompile.py
More file actions
37 lines (31 loc) · 1012 Bytes
/
compile.py
File metadata and controls
37 lines (31 loc) · 1012 Bytes
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
import subprocess, sys
from enum import Enum
class CommandType(Enum):
PDF = 'pdflatex',
BIB = 'bib',
MULTIBIB = 'multibib'
OUTPUT_DIRECTORY = 'output'
PDF_COMMAND = 'pdflatex'
BIB_COMMAND = 'bibtex'
commands = {
CommandType.PDF : [PDF_COMMAND, '-output-directory', OUTPUT_DIRECTORY, f'{sys.argv[1]}.tex'],
CommandType.BIB : [BIB_COMMAND, f'{OUTPUT_DIRECTORY}/{sys.argv[1]}.aux'],
# CommandType.MULTIBIB : [BIB_COMMAND, f'{OUTPUT_DIRECTORY}/{sys.argv[2]}.aux'] -- Uncomment if multibib is used (e.g., with ACM)
}
full_compile_sequence = [
CommandType.PDF,
CommandType.BIB,
# CommandType.MULTIBIB, -- Uncomment if multibib is used (e.g., with ACM)
CommandType.PDF,
CommandType.PDF
]
for c in full_compile_sequence:
print(c)
subprocess.call(commands[c], shell=True)
"""
Compile with:
python .\compile.py [main tex/bib name] ([multibib name]).
Example:
python .\compile.py main -- without multibib
python .\compile.py main PS -- with multibib
"""