Atlas / Skills / brycewang-stanford / Latex Translation Guide

Latex Translation GuideSAFE

skills/brycewang-stanford/latex-translation-guide

🔬 A curated collection of 23,000+ agent skills for empirical research across 8 social science disciplines. | 精选 23,000+ AI Agent 技能库,覆盖8大社会科学学科的实证研究。CoPaper.AI 20分钟完成一篇可复现的规范实证论文,并支持用户上传 Skills。-- Maintained by CoPaper.AI from Stanford REAP.

Verdict
SAFE
Grade
B
Trust score
89 /100
Version
—
Hosts
1 documented
License
NOASSERTION
Stars
4,537
01

Overview

🔬 A curated collection of 23,000+ agent skills for empirical research across 8 social science disciplines. | 精选 23,000+ AI Agent 技能库,覆盖8大社会科学学科的实证研究。CoPaper.AI 20分钟完成一篇可复现的规范实证论文,并支持用户上传 Skills。-- Maintained by CoPaper.AI from Stanford REAP.

Read from source at commit e1ba289846fdOBSERVED · 2026-10-08
02

Install

Commands as the repository documents them. They are shown, not run.

pip install latextrans
pip install mathtranslate
03

Host compatibility

What the documentation claims. We have not run a compatibility test.

HostStatusNotes
openclawmentioned
04

What it tells the agent

The instruction file, verbatim from the audited commit — this is the text the model reads, and the surface the audit's instruction layer examines. Quoted here so you can judge it without cloning anything.

---
name: latex-translation-guide
description: "Translate LaTeX documents preserving math formulas and structure"
metadata:
  openclaw:
    emoji: "🌐"
    category: "tools"
    subcategory: "ocr-translate"
    keywords: ["LaTeX translation", "document translation", "multilingual", "math preservation", "academic translation"]
    source: "https://github.com/SUSYUSTC/MathTranslate"
---

# LaTeX Document Translation Guide

## Overview

Translating LaTeX academic documents requires preserving mathematical formulas, cross-references, citations, and formatting while converting the text between languages. This guide covers tools and techniques for translating LaTeX papers — from command-line utilities to full document pipelines. Particularly useful for making research accessible across language barriers.

## LaTeXTrans Approach

```bash
# Install LaTeXTrans
pip install latextrans

# Translate a LaTeX file
latextrans translate paper.tex --from en --to zh --output paper_zh.tex
```

### How It Works

1. **Parse**: Extract text segments while preserving LaTeX commands
2. **Protect**: Shield math environments (`$...$`, `\[...\]`, equations)
3. **Translate**: Send text segments to translation API
4. **Reconstruct**: Reassemble with original LaTeX structure

### Python Usage

```python
from latextrans import LatexTranslator

translator = LatexTranslator(
    source_lang="en",
    target_lang="zh",
    engine="google",  # or "deepl", "openai"
)

# Translate a file
translator.translate_file("paper.tex", "paper_zh.tex")

# Translate a string
result = translator.translate(
    r"The loss function $\mathcal{L}(\theta)$ is minimized "
    r"using gradient descent with learning rate $\eta$."
)
# Output preserves $\mathcal{L}(\theta)$ and $\eta$ untouched
```

## MathTranslate Tool

```bash
# Install MathTranslate (specialized for math-heavy papers)
pip install mathtranslate

# Translate arXiv paper directly
translate_arxiv 2301.00001 -o translated.tex

# Translate local file
translate_tex paper.tex -o paper_translated.tex
```

### MathTranslate Features

```python
# Configuration
import mathtranslate

# Set translation backend
mathtranslate.config.set_translator("google")  # free
mathtranslate.config.set_translator("openai")  # higher quality

# Translate with customization
mathtranslate.translate(
    input_file="paper.tex",
    output_file="paper_zh.tex",
    source_lang="en",
    target_lang="zh-CN",
    threads=4,  # parallel translation
)
```

## Manual Translation Tips

### Protecting Math Environments

```python
import re

def extract_and_protect(latex_text: str) -> tuple:
    """Extract math environments before translation."""
    math_pattern = r'(\$\$[\s\S]*?\$\$|\$[^$]+\$|\\begin\{equation\}[\s\S]*?\\end\{equation\}|\\begin\{align\}[\s\S]*?\\end\{align\})'

    placeholders = {}
    counter = [0]

    def replace_math(match):
        key = f"__MATH_{counter[0]}__"
        placeholders[key] = match.group(0)
        counter[0] += 1
        return key

    protected = re.sub(math_pattern, replace_math, latex_text)
    return protected, placeholders


def restore_math(translated: str, placeholders: dict) -> str:
    """Restore math environments after translation."""
    for key, value in placeholders.items():
        translated = translated.replace(key, value)
    return translated
```

### Commands to Protect

```latex
% Always protect these:
\ref{...}      % Cross-references
\cite{...}     % Citations
\label{...}    % Labels
\eqref{...}    % Equation references
\url{...}      % URLs
\texttt{...}   % Code/monospace

% Math environments to protect:
$...$          % Inline math
$$...$$        % Display math
\[...\]        % Display math
\begin{equation}...\end{equation}
\begin{align}...\end{align}
\begin{theorem}...\end{theorem}  % Custom environments
```

## Bilingual Output

```latex
% Create side-by-side bilingual document
\usepackage{paracol}

\begin{paracol}{2}
\switchcolumn[0]
The transformer architecture has become...

\switchcolumn[1]
Transformer架构已经成为...

\switchcolumn[0]
Self-attention computes $\text{Attention}(Q,K,V) = \text{softmax}(\frac{QK^T}{\sqrt{d_k}})V$

\switchcolumn[1]
自注意力计算 $\text{Attention}(Q,K,V) = \text{softmax}(\frac{QK^T}{\sqrt{d_k}})V$
\end{paracol}
```

## Translation Backends

| Backend | Quality | Cost | Speed |
|---------|---------|------|-------|
| Google Translate | Good | Free | Fast |
| DeepL | Better | Freemium | Fast |
| OpenAI GPT-4 | Best | Paid | Slower |
| Claude | Best | Paid | Slower |

## References

- [LaTeXTrans](https://github.com/SUSYUSTC/MathTranslate)
- [PDFMathTranslate](https://github.com/Byaidu/PDFMathTranslate)
- [arXiv LaTeX Cleaner](https://github.com/google-research/arxiv-latex-cleaner)
05

Trust audit

SAFEgrade B · trust 89/100 Nothing in the source contradicts what it says it does. Grade A is reserved for packages that have also passed the behavioural sandbox.

LayerWhat it checksResult
L0Provenance & inventoryPASS
L1Static analysis of the codeNA
L2Instruction surface (what it tells the agent)PASS
L3Class-specific surfacePASS
L4Behavioural (sandbox)SKIPPED

What the source does

Filesystem
none-observed
Network
none-observed
Shell
none-observed
Dependencies
pinned
Secrets in source
none-found

Findings (0)

No findings outside the package's declared scope.

Gates applied: no_behavioural_pass.

Audited 2026-10-08 · audit v0.4.1 · source sha e1ba289846fdfull audit observations/trust-audit/skill/brycewang-stanford__latex-translation-guide.json · Report an issue / request a re-scan
06

Audit history

Every audit this skill has had.

DateSourceVerdictGradeScoreChange
2026-10-08e1ba289846fdSAFEB89first audit
07

Questions

What does the Latex Translation Guide skill do?

🔬 A curated collection of 23,000+ agent skills for empirical research across 8 social science disciplines. | 精选 23,000+ AI Agent 技能库,覆盖8大社会科学学科的实证研究。CoPaper.AI 20分钟完成一篇可复现的规范实证论文,并支持用户上传 Skills。-- Maintained by CoPaper.AI from Stanford REAP.

Is Latex Translation Guide safe to install?

The audit found nothing in the source that contradicts what it says it does, and graded it B (89/100). Grade A is held back for packages that have also passed a sandboxed behavioural run, which is why a clean skill reads B.

What can Latex Translation Guide access on my machine?

The audit observed no filesystem, network or shell use at all in its source.

Which assistants does Latex Translation Guide work with?

Its documentation mentions openclaw. That is what the text claims, not a compatibility test we ran.

How current is this page?

The grade is for one exact copy of the source (e1ba289846fd), read on 2026-10-08. The repository is watched, and a new audit runs when it changes — this is the first audit.

Advertisement