diff --git a/src/formatitko/formatitko.py b/src/formatitko/formatitko.py index 3e764ba..c48c3d8 100755 --- a/src/formatitko/formatitko.py +++ b/src/formatitko/formatitko.py @@ -2,9 +2,11 @@ import argparse import sys +import os import tempfile import subprocess import shutil +from pathlib import Path # Import local files from .util import import_md @@ -112,7 +114,12 @@ def main(): else: filename = args.output_tex outdir = tempfile.TemporaryDirectory(prefix="formatitko") - subprocess.run(["pdfcsplain", "-halt-on-error", "-output-directory="+outdir.name, "-jobname=formatitko", filename], check=True) + + env = os.environ.copy() + d = Path("/".join(__file__.split("/")[:-1])) + env["TEXINPUTS"]=".:"+str(d/"tex")+":"+env.get("TEXINPUTS", "") + + subprocess.run(["luatex", "-halt-on-error", "-output-directory="+outdir.name, "-jobname=formatitko", filename], check=True, env=env) shutil.move(outdir.name+"/formatitko.pdf", args.output_pdf) if args.deps is not None: