Skip to content

Commit fe4e2ee

Browse files
committed
fix(utils.py): tex file compile error
pdf is generated but return non-zero status fix it by set `check=False`
1 parent cd8bc74 commit fe4e2ee

1 file changed

Lines changed: 19 additions & 5 deletions

File tree

vrdu/utils.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,27 @@ def compile_latex(file: str):
142142
Returns:
143143
None
144144
"""
145-
path_name = os.path.dirname(file)
146145
file_name = os.path.basename(file)
147-
script_path = os.path.expanduser("compile_latex.sh")
146+
148147
subprocess.run(
149-
["bash", script_path, path_name, file_name], check=True, timeout=1000
148+
["pdflatex", "-interaction=nonstopmode", file_name],
149+
timeout=1000,
150+
stdout=subprocess.DEVNULL,
150151
)
151152

153+
subprocess.run(
154+
["pdflatex", "-interaction=nonstopmode", file_name],
155+
timeout=1000,
156+
stdout=subprocess.DEVNULL,
157+
)
158+
159+
if file_name == "paper_colored.tex":
160+
subprocess.run(
161+
["pdflatex", "-interaction=nonstopmode", "-synctex=1", file_name],
162+
timeout=1000,
163+
stdout=subprocess.DEVNULL,
164+
)
165+
152166

153167
def pdf2jpg(pdf_path: str, output_directory: str) -> None:
154168
"""
@@ -346,11 +360,11 @@ def extract_title_name(title) -> str:
346360
def colorize(text: str, category_name: str) -> str:
347361
"""
348362
Given a piece of text and a category name, colorizes the text based on the category.
349-
363+
350364
Args:
351365
text (str): The text to be colorized.
352366
category_name (str): The category name to determine the colorization.
353-
367+
354368
Returns:
355369
str: The colorized text based on the category.
356370
"""

0 commit comments

Comments
 (0)