- 
          
- 
        Couldn't load subscription status. 
- Fork 3.7k
Minimal TeXLive installation for Pandoc
In the course of setting up Pandoc on a laptop with limited resources I have through trial and error determined the TeXLive packages needed to produce a very simple PDF with Pandoc using --pdf-engine=pdflatex, --pdf-engine=xelatex, --pdf-engine=lualatex or --pdf-engine=context.
It turns out that the list of needed packages in the Pandoc manual is not sufficient, not only because in some cases the names of the .sty files and the TeXLive packages don't coincide. Since I in the end decided to include collection-context, collection-luatex and collection-xetex for good measure there may actually be some duplication in the list below.
Note that when running install-tl as described on the TeXLive quick install page you should actively select the basic scheme and deselect docs and sources in the options if you want a very lean install as I did here.
Note that if you have manually added the path to TeXLive's bin directory to your PATH variable as is typically the case it will not be in the root's PATH when running with sudo. The workaround is to use env to temporarily set the root's PATH to be identical to your PATH by running
sudo env "PATH=$PATH" sh pandoc-texlive.shThe script can be conveniently downloaded by cloning this gist. Most likely I will be updating it there rather than here!
#!/bin/sh
# pandoc-texlive.sh
# TeXLive packages needed to produce PDFs with Pandoc
# using different *TeX `--pdf-engine` options.
tlmgr install \
scheme-basic \
amsfonts \
amsmath \
babel \
biber \
biblatex \
bibtex \
bidi \
booktabs \
collection-context \
collection-luatex \
collection-xetex \
csquotes \
ec \
fancyvrb \
filehook \
fontspec \
footnotehyper \
geometry \
graphics \
hyperref \
ifluatex \
ifxetex \
listings \
lm \
lm-math \
lualatex-math \
luaotfload \
mathspec \
microtype \
natbib \
oberdiek \
parskip \
polyglossia \
setspace \
tools \
ulem \
unicode-math \
upquote \
xcolor \
xurl \
zapfding \""" XXX DEX PPT Generator - 主入口文件 生成深色科技风格的XXX DEX产品演示PPT """
from fastapi import FastAPI, File, UploadFile, HTTPException from fastapi.responses import FileResponse from fastapi.middleware.cors import CORSMiddleware from src.ppt_generator import XXXDEXPPTGenerator import uvicorn import os import tempfile
app = FastAPI( title="XXX DEX PPT Generator", description="生成XXX DEX产品演示PPT的自动化工具", version="1.0.0" )
app.add_middleware( CORSMiddleware, allow_origins=[""], allow_credentials=True, allow_methods=[""], allow_headers=["*"], )
@app.post("/generate-ppt") async def generate_ppt(): """生成PPTX文件并返回下载链接""" try: generator = XXXDEXPPTGenerator()
    # 创建临时文件
    with tempfile.NamedTemporaryFile(suffix='.pptx', delete=False) as tmp_file:
        tmp_path = tmp_file.name
        
    # 生成PPT
    generator.create_presentation(tmp_path)
    
    return FileResponse(
        tmp_path,
        media_type="application/vnd.openxmlformats-officedocument.presentationml.presentation",
        filename="XXX-DEX-产品演示.pptx"
    )
    
except Exception as e:
    raise HTTPException(status_code=500, detail=str(e))
@app.get("/health") async def health_check(): """健康检查接口""" return {"status": "healthy", "service": "XXX DEX PPT Generator"}
if name == "main": uvicorn.run(app, host="0.0.0.0", port=8000)