Spaces:
Running
Running
Siyuan Hu
commited on
Commit
ยท
5e9efe4
1
Parent(s):
c41b46e
fix(debug): expand TEXINPUTS to include project + parent (recursive); copy template *.sty next to tex; stronger local-font overrides
Browse files
app.py
CHANGED
|
@@ -455,8 +455,13 @@ def _compile_poster_pdf(OUTPUT_DIR: Path, logs):
|
|
| 455 |
|
| 456 |
import os as _os
|
| 457 |
_env = _os.environ.copy()
|
| 458 |
-
# Ensure TeX can find local theme/fonts
|
| 459 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 460 |
proc = _sp.run(cmd, cwd=str(proj_dir), stdout=_sp.PIPE, stderr=_sp.STDOUT, text=True, env=_env)
|
| 461 |
if proc.stdout:
|
| 462 |
logs.append(proc.stdout[-4000:])
|
|
@@ -521,7 +526,12 @@ def _compile_tex_to_pdf(tex_path: Path, logs):
|
|
| 521 |
return None
|
| 522 |
import os as _os
|
| 523 |
_env = _os.environ.copy()
|
| 524 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 525 |
proc = _sp.run(cmd, cwd=str(proj_dir), stdout=_sp.PIPE, stderr=_sp.STDOUT, text=True, env=_env)
|
| 526 |
if proc.stdout:
|
| 527 |
logs.append(proc.stdout[-4000:])
|
|
@@ -697,6 +707,15 @@ def debug_compile_output_zip():
|
|
| 697 |
logs.append("๐ Copied template/*.sty โ zip_proj/")
|
| 698 |
except Exception as e:
|
| 699 |
logs.append(f"โ ๏ธ Copy sty failed: {e}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 700 |
# Append overrides into theme file(s)
|
| 701 |
for sty in work_zip_dir.rglob("beamerthemegemini.sty"):
|
| 702 |
with open(sty, "a", encoding="utf-8") as fh:
|
|
|
|
| 455 |
|
| 456 |
import os as _os
|
| 457 |
_env = _os.environ.copy()
|
| 458 |
+
# Ensure TeX can find local theme/fonts across project tree
|
| 459 |
+
texinputs = _env.get("TEXINPUTS", "")
|
| 460 |
+
search = _os.pathsep.join([
|
| 461 |
+
str(proj_dir), str(proj_dir) + "//",
|
| 462 |
+
str(proj_dir.parent), str(proj_dir.parent) + "//",
|
| 463 |
+
])
|
| 464 |
+
_env["TEXINPUTS"] = search + _os.pathsep + texinputs
|
| 465 |
proc = _sp.run(cmd, cwd=str(proj_dir), stdout=_sp.PIPE, stderr=_sp.STDOUT, text=True, env=_env)
|
| 466 |
if proc.stdout:
|
| 467 |
logs.append(proc.stdout[-4000:])
|
|
|
|
| 526 |
return None
|
| 527 |
import os as _os
|
| 528 |
_env = _os.environ.copy()
|
| 529 |
+
texinputs = _env.get("TEXINPUTS", "")
|
| 530 |
+
search = _os.pathsep.join([
|
| 531 |
+
str(proj_dir), str(proj_dir) + "//",
|
| 532 |
+
str(proj_dir.parent), str(proj_dir.parent) + "//",
|
| 533 |
+
])
|
| 534 |
+
_env["TEXINPUTS"] = search + _os.pathsep + texinputs
|
| 535 |
proc = _sp.run(cmd, cwd=str(proj_dir), stdout=_sp.PIPE, stderr=_sp.STDOUT, text=True, env=_env)
|
| 536 |
if proc.stdout:
|
| 537 |
logs.append(proc.stdout[-4000:])
|
|
|
|
| 707 |
logs.append("๐ Copied template/*.sty โ zip_proj/")
|
| 708 |
except Exception as e:
|
| 709 |
logs.append(f"โ ๏ธ Copy sty failed: {e}")
|
| 710 |
+
# Copy repository theme .sty files into both root and the .tex dir so they take precedence
|
| 711 |
+
try:
|
| 712 |
+
tmpl_dir = ROOT / "template"
|
| 713 |
+
for sty in tmpl_dir.glob("*.sty"):
|
| 714 |
+
shutil.copy2(sty, work_zip_dir / sty.name)
|
| 715 |
+
shutil.copy2(sty, tex_path.parent / sty.name)
|
| 716 |
+
logs.append("๐ Copied template/*.sty โ zip_proj/ and tex dir")
|
| 717 |
+
except Exception as e:
|
| 718 |
+
logs.append(f"โ ๏ธ Copy sty failed: {e}")
|
| 719 |
# Append overrides into theme file(s)
|
| 720 |
for sty in work_zip_dir.rglob("beamerthemegemini.sty"):
|
| 721 |
with open(sty, "a", encoding="utf-8") as fh:
|