This repository is a fork-based engineering adaptation. The original README content is kept below.
Original repository: NiuTrans/LaTeXTrans
Main changes in this fork:
- Switched model invocation to LangChain + OpenAI Responses API.
- Replaced TOML-based runtime config with
.env-based configuration. - Refactored into frontend-backend separation and introduced database-backed task management.
- Added task runtime persistence, artifact management, and MinIO uploads for outputs.
- Integrated with babeldoc, can directly translate pdf
.env config example reference .env.example
Build the image from the repository root:
docker build -t latex-trans-prod .The runtime image includes the LaTeX toolchain needed by this fork for PDF compilation:
latexmkpdflatexxelatexlualatex- CJK support packages and Noto CJK fonts for Chinese/Japanese rendering
Run the backend API and bundled frontend together on port 8000:
docker run --rm -p 8000:8000 --env-file .env latex-trans-prodIf you want the container to also start the discovery Huey consumer, make sure these env vars are present in .env:
DISCOVERY_HUEY_ENABLED=true
REDIS_URL=redis://host.docker.internal:6379/1The container entrypoint now uses ./start.sh, which:
- Starts the FastAPI API server
- Starts the discovery Huey consumer when
DISCOVERY_HUEY_ENABLED=true
Optional consumer tuning env vars:
DISCOVERY_HUEY_WORKERS=2
DISCOVERY_HUEY_WORKER_TYPE=threadAfter the container starts:
- Frontend UI:
http://127.0.0.1:8000/ - Backend API:
http://127.0.0.1:8000/api - OpenAPI docs:
http://127.0.0.1:8000/api/docs
For discovery periodic jobs and async manual triggers, you need both the API server and the Huey consumer.
Recommended .env entries:
DISCOVERY_HUEY_ENABLED=true
REDIS_URL=redis://127.0.0.1:6379/1Start the API server from the repo root:
.venv/bin/uvicorn backend.app.main:app --host 0.0.0.0 --port 8000Start the discovery consumer in another terminal:
.venv/bin/huey_consumer -w 2 -k thread backend.app.workers.discovery_schedule.hueyVerbose mode:
.venv/bin/huey_consumer -w 2 -k thread -v backend.app.workers.discovery_schedule.hueyBehavior notes:
POST /api/admin/discovery/syncwithDISCOVERY_HUEY_ENABLED=truewill enqueue the run to Huey.- If
DISCOVERY_HUEY_ENABLED=false, manual discovery sync falls back to inline execution. - The periodic scheduler also runs inside the same Huey consumer process.
β’ π Introduction β’ π οΈ Installation Guide β’ βοΈ Configuration Guide β’ π Usage β’ πΌοΈ Translation Examples
End-to-end translation from arXiv paper ID to translated PDF. LaTeXTrans have the following Features :
- π Preserve the integrity of formulas, layout, and cross-references
- π Ensure consistency in terminology translation
- π Support end-to-end conversion from original TeX source (automatically downloaded based on the arXiv paper id provided) to translated PDF
With LaTeXTrans, researchers and students can obtain higher-quality arXiv paper translations without worrying about formatting confusion or missing content, thus reading and understanding arXiv papers more efficiently.
LaTeXTrans is a structured LaTeX document translation system based on multi-agent collaboration. It directly translates LaTeX code and generates translated PDFs with high fidelity to the original layout. Unlike traditional document translation methods (e.g., PDF translation), which often break formulas and formatting, LaTeXTrans leverages LLM to translate preprocessed LaTeX sources and employs a workflow composed of six agentsβParser, Translator, Validator, Summarizer, Terminology Extractor, and Generator to achieve the features. The figure below illustrates the system architecture of LaTeXTrans.
git clone https://github.com/PolarisZZM/LaTeXTrans.git
cd LaTeXTrans
pip install -r requirements.txtIf you need to compile LaTeX files (e.g., generate PDF output), install MikTex or TeXLive !
If you use the Docker image from this fork, the container already ships with the required TeX Live, XeLaTeX/LuaLaTeX support, and CJK fonts.
Important
For MikTex, installation please be sure to select "install on the fly", in addition, you need to install additional Strawberry Perl support compilation.
Please edit the configuration file before use:
config/default.toml
Set the language model's API key and base URL in default.toml :
model = " " # model name (For example, deepseek-chat)
api_key = " " # your_api_key_here
base_url = " " # base url of the API (For example, https://api.deepseek.com/v1/chat/completions)Note
The following example shows the recommended base_url for different models:
| Model | base_url |
|---|---|
| deepseek-chat | https://api.deepseek.com/v1/chat/completions |
| gpt-4o | https://api.openai.com/v1/chat/completions |
| gemini-2.5-pro | https://generativelanguage.googleapis.com/v1beta/openai/chat/completions |
Simply provide an arXiv paper ID to complete translation:
python main.py --arxiv ${xxxx}
# For example,
# python main.py --arxiv 2508.18791This command will:
- Download the LaTeX source code from arXiv and extract it
- Execute a workflow consisting of parsing, translation, refactoring and compilation
- Save the translated LaTeX project file of the paper and the PDF of the compiled translation in the outputs folder
Note
Although LaTeXTrans supports translation from any language to any language, the current version has only made relatively complete compilation adaptations for translation from English to Chinese. When translating to other languages, the final output pdf may contain errors. We welcome you to raise an issue to describe the problem you have encountered, and we will solve it case by case.
The following are three real translation examples generated by LaTeXTrans, with the original text on the left and translation results on the right.
| Original | Translation |
![]() |
![]() |
| Original | Translation |
![]() |
![]() |
| Original | Translation |
![]() |
![]() |
| Original | Translation |
![]() |
![]() |
π See examples/ folder for more cases, including complete translation PDFs for each case.
@article{zhu2025latextrans,
title={LaTeXTrans: Structured LaTeX Translation with Multi-Agent Coordination},
author={Zhu, Ziming and Wang, Chenglong and Xing, Shunjie and Huo, Yifu and Tian, Fengning and Du, Quan and Yang, Di and Zhang, Chunliang and Xiao, Tong and Zhu, Jingbo},
journal={arXiv preprint arXiv:2508.18791},
year={2025}
}















