Spaces:
Running
Running
Push Bot
commited on
Commit
·
41973f9
1
Parent(s):
6afc0b4
Switch to XeLaTeX: apt-install TeX Live (xelatex/luatex/latexmk + extras); remove Tectonic install in postBuild
Browse files- app.py +18 -37
- packages.txt +6 -0
- postBuild +0 -3
app.py
CHANGED
|
@@ -429,29 +429,19 @@ def _compile_poster_pdf(OUTPUT_DIR: Path, logs):
|
|
| 429 |
def _has(bin_name):
|
| 430 |
return _sh.which(bin_name) is not None
|
| 431 |
|
| 432 |
-
|
| 433 |
-
if
|
| 434 |
-
cmd = [
|
| 435 |
-
logs.append("▶ Compiling with
|
| 436 |
elif _has("lualatex"):
|
| 437 |
-
cmd = ["lualatex", "-interaction=nonstopmode", tex_path.name]
|
| 438 |
logs.append("▶ Compiling with lualatex …")
|
| 439 |
-
elif _has("xelatex"):
|
| 440 |
-
cmd = ["xelatex", "-interaction=nonstopmode", tex_path.name]
|
| 441 |
-
logs.append("▶ Compiling with xelatex …")
|
| 442 |
elif _has("latexmk"):
|
| 443 |
-
cmd = ["latexmk", "-pdf", "-interaction=nonstopmode", tex_path.name]
|
| 444 |
-
logs.append("▶ Compiling with latexmk …")
|
| 445 |
else:
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
import importlib
|
| 449 |
-
importlib.import_module("tectonic")
|
| 450 |
-
cmd = [sys.executable, "-m", "tectonic", tex_path.name]
|
| 451 |
-
logs.append("▶ Compiling with python -m tectonic …")
|
| 452 |
-
except Exception:
|
| 453 |
-
logs.append("⚠️ No TeX engine found (tectonic/lualatex/xelatex/latexmk) and 'tectonic' module missing. Skipping PDF compile.")
|
| 454 |
-
return None
|
| 455 |
|
| 456 |
import os as _os
|
| 457 |
_env = _os.environ.copy()
|
|
@@ -502,28 +492,19 @@ def _compile_tex_to_pdf(tex_path: Path, logs):
|
|
| 502 |
import shutil as _sh, subprocess as _sp
|
| 503 |
def _has(bin_name):
|
| 504 |
return _sh.which(bin_name) is not None
|
| 505 |
-
|
| 506 |
-
if
|
| 507 |
-
cmd = [
|
| 508 |
-
logs.append("▶ Compiling with
|
| 509 |
elif _has("lualatex"):
|
| 510 |
-
cmd = ["lualatex", "-interaction=nonstopmode", tex_path.name]
|
| 511 |
logs.append("▶ Compiling with lualatex …")
|
| 512 |
-
elif _has("xelatex"):
|
| 513 |
-
cmd = ["xelatex", "-interaction=nonstopmode", tex_path.name]
|
| 514 |
-
logs.append("▶ Compiling with xelatex …")
|
| 515 |
elif _has("latexmk"):
|
| 516 |
-
cmd = ["latexmk", "-pdf", "-interaction=nonstopmode", tex_path.name]
|
| 517 |
-
logs.append("▶ Compiling with latexmk …")
|
| 518 |
else:
|
| 519 |
-
|
| 520 |
-
|
| 521 |
-
importlib.import_module("tectonic")
|
| 522 |
-
cmd = [sys.executable, "-m", "tectonic", tex_path.name]
|
| 523 |
-
logs.append("▶ Compiling with python -m tectonic …")
|
| 524 |
-
except Exception:
|
| 525 |
-
logs.append("⚠️ No TeX engine found.")
|
| 526 |
-
return None
|
| 527 |
import os as _os
|
| 528 |
_env = _os.environ.copy()
|
| 529 |
texinputs = _env.get("TEXINPUTS", "")
|
|
|
|
| 429 |
def _has(bin_name):
|
| 430 |
return _sh.which(bin_name) is not None
|
| 431 |
|
| 432 |
+
# Prefer XeLaTeX (Overleaf-like), then LuaLaTeX, then latexmk (forced XeLaTeX)
|
| 433 |
+
if _has("xelatex"):
|
| 434 |
+
cmd = ["xelatex", "-interaction=nonstopmode", "-file-line-error", tex_path.name]
|
| 435 |
+
logs.append("▶ Compiling with xelatex …")
|
| 436 |
elif _has("lualatex"):
|
| 437 |
+
cmd = ["lualatex", "-interaction=nonstopmode", "-file-line-error", tex_path.name]
|
| 438 |
logs.append("▶ Compiling with lualatex …")
|
|
|
|
|
|
|
|
|
|
| 439 |
elif _has("latexmk"):
|
| 440 |
+
cmd = ["latexmk", "-xelatex", "-pdf", "-interaction=nonstopmode", tex_path.name]
|
| 441 |
+
logs.append("▶ Compiling with latexmk (-xelatex) …")
|
| 442 |
else:
|
| 443 |
+
logs.append("⚠️ No TeX engine found (xelatex/lualatex/latexmk). Skipping PDF compile.")
|
| 444 |
+
return None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 445 |
|
| 446 |
import os as _os
|
| 447 |
_env = _os.environ.copy()
|
|
|
|
| 492 |
import shutil as _sh, subprocess as _sp
|
| 493 |
def _has(bin_name):
|
| 494 |
return _sh.which(bin_name) is not None
|
| 495 |
+
# Prefer XeLaTeX (Overleaf-like), then LuaLaTeX, then latexmk (forced XeLaTeX)
|
| 496 |
+
if _has("xelatex"):
|
| 497 |
+
cmd = ["xelatex", "-interaction=nonstopmode", "-file-line-error", tex_path.name]
|
| 498 |
+
logs.append("▶ Compiling with xelatex …")
|
| 499 |
elif _has("lualatex"):
|
| 500 |
+
cmd = ["lualatex", "-interaction=nonstopmode", "-file-line-error", tex_path.name]
|
| 501 |
logs.append("▶ Compiling with lualatex …")
|
|
|
|
|
|
|
|
|
|
| 502 |
elif _has("latexmk"):
|
| 503 |
+
cmd = ["latexmk", "-xelatex", "-pdf", "-interaction=nonstopmode", tex_path.name]
|
| 504 |
+
logs.append("▶ Compiling with latexmk (-xelatex) …")
|
| 505 |
else:
|
| 506 |
+
logs.append("⚠️ No TeX engine found (xelatex/lualatex/latexmk).")
|
| 507 |
+
return None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 508 |
import os as _os
|
| 509 |
_env = _os.environ.copy()
|
| 510 |
texinputs = _env.get("TEXINPUTS", "")
|
packages.txt
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
texlive-xetex
|
| 2 |
+
texlive-luatex
|
| 3 |
+
texlive-latex-extra
|
| 4 |
+
texlive-pictures
|
| 5 |
+
texlive-fonts-recommended
|
| 6 |
+
latexmk
|
postBuild
CHANGED
|
@@ -9,7 +9,4 @@ else
|
|
| 9 |
echo "[postBuild] apt-get not available; skipping font install"
|
| 10 |
fi
|
| 11 |
|
| 12 |
-
echo "[postBuild] Installing Tectonic"
|
| 13 |
-
bash install_tectonic.sh || echo "[postBuild] Tectonic install script returned non-zero; continuing."
|
| 14 |
-
|
| 15 |
echo "[postBuild] Done"
|
|
|
|
| 9 |
echo "[postBuild] apt-get not available; skipping font install"
|
| 10 |
fi
|
| 11 |
|
|
|
|
|
|
|
|
|
|
| 12 |
echo "[postBuild] Done"
|