Skip to content

Commit

Permalink
Merge pull request 3b1b#734 from zombie110year/master
Browse files Browse the repository at this point in the history
latex can't recognize path seperator \\ in windows
  • Loading branch information
eulertour committed May 15, 2020
2 parents ca0b7a6 + 946367a commit aff2d21
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions manimlib/utils/tex_file_writing.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
import hashlib

from pathlib import Path

from manimlib.constants import TEX_TEXT_TO_REPLACE
from manimlib.constants import TEX_USE_CTEX
import manimlib.constants as consts
Expand Down Expand Up @@ -39,12 +41,15 @@ def generate_tex_file(expression, template_tex_file_body):

def tex_to_dvi(tex_file):
result = tex_file.replace(".tex", ".dvi" if not TEX_USE_CTEX else ".xdv")
result = Path(result).as_posix()
tex_file = Path(tex_file).as_posix()
tex_dir = Path(consts.TEX_DIR).as_posix()
if not os.path.exists(result):
commands = [
"latex",
"-interaction=batchmode",
"-halt-on-error",
"-output-directory=\"{}\"".format(consts.TEX_DIR),
"-output-directory=\"{}\"".format(tex_dir),
"\"{}\"".format(tex_file),
">",
os.devnull
Expand All @@ -53,7 +58,7 @@ def tex_to_dvi(tex_file):
"-no-pdf",
"-interaction=batchmode",
"-halt-on-error",
"-output-directory=\"{}\"".format(consts.TEX_DIR),
"-output-directory=\"{}\"".format(tex_dir),
"\"{}\"".format(tex_file),
">",
os.devnull
Expand All @@ -76,6 +81,8 @@ def dvi_to_svg(dvi_file, regen_if_exists=False):
where in the dvi
"""
result = dvi_file.replace(".dvi" if not TEX_USE_CTEX else ".xdv", ".svg")
result = Path(result).as_posix()
dvi_file = Path(dvi_file).as_posix()
if not os.path.exists(result):
commands = [
"dvisvgm",
Expand Down

0 comments on commit aff2d21

Please sign in to comment.