mirror of
https://github.com/3b1b/manim.git
synced 2025-08-02 19:46:21 +08:00
Have LatexError show line of error and the next line
This is where undefined control sequence errors will show up.
This commit is contained in:
@ -113,14 +113,15 @@ def create_tex_svg(full_tex: str, svg_file: str, compiler: str) -> None:
|
||||
log.error(
|
||||
"LaTeX Error! Not a worry, it happens to the best of us."
|
||||
)
|
||||
error_str = ""
|
||||
with open(root + ".log", "r", encoding="utf-8") as log_file:
|
||||
error_match_obj = re.search(r"(?<=\n! ).*", log_file.read())
|
||||
error_match_obj = re.search(r"(?<=\n! ).*\n.*\n", log_file.read())
|
||||
if error_match_obj:
|
||||
error_str = error_match_obj.group()
|
||||
log.debug(
|
||||
"The error could be: `%s`",
|
||||
error_match_obj.group()
|
||||
f"The error could be:\n`{error_str}`",
|
||||
)
|
||||
raise LatexError()
|
||||
raise LatexError(error_str)
|
||||
|
||||
# dvi to svg
|
||||
os.system(" ".join((
|
||||
|
Reference in New Issue
Block a user