Translate LaTeX & Overleaf Papers Without Breaking Citations

Equalang

In brief

Translate LaTeX and Overleaf papers without breaking citations or macros: read via compiled PDF, or flatten and lock .tex source with latexpand.

Keywords: LaTeX paper translation; Overleaf translation workflow; latexpand flatten LaTeX; preserve cite and ref keys; translate math macros

Paste a .tex section into a generic translator and hit Recompile in Overleaf. Within seconds, the log fills up with ! Undefined control sequence, half your citations turn into [?], and \ref{eq:loss} stops pointing to Equation 4 because the key got translated into \ref{eq:verlust}.

Before you write a single regex script to fix it, stop and check which job you are actually doing. Almost everyone searching for a LaTeX translation workflow falls into one of two camps, and picking the wrong lane wastes hours.

Your goalBest starting fileMain risk to avoidRecommended route
Read someone else's paperCompiled PDFFighting missing .sty/.cls packages from arXiv tarballsTranslate the PDF directly with formula optimization
Submit your own paper to a journalOverleaf .tex projectBroken \cite{}/\ref{} keys, altered \newcommand macrosFlatten with latexpand, lock preamble, lint with chktex
Share a draft for non-TeX co-author review.tex converted to DOCXManual equation re-typing in WordConvert via pandoc, translate DOCX, port edits back

Path A: Reading Someone Else's Paper? Skip .tex Surgery

If you only want to understand an arXiv preprint or a conference paper, do not download the .tar.gz source archive. Author tarballs frequently omit custom journal .cls files, pin outdated .bbl bibliographies, or assume a specific TeX Live release. Compiling someone else's source just to translate it is pure friction.

Translate the compiled PDF instead. At Equalang, our document translator does not accept raw .tex files, because the compiled PDF is what readers actually need. Upload the PDF, turn on Optimize formula layout in PDFs (+10 credits per page), and read the original alongside the translation. That toggle prevents inline fractions (1/m, 2m) and numbered display equations from flattening into broken plain text.

Original English numbered matrix equations (11) and (12) with inline math variables beside Equalang's formula-optimized Chinese PDF translation
If your goal is reading rather than editing TeX source, translating the compiled PDF with formula optimization keeps numbered equations and inline variables intact without TeX compilation headaches

Two quick shortcuts save even more time for readers:

  • Check open-access editions first: Search the paper's DOI or title on Equalang Plaza. If a CC BY open-access paper is already there, you can sample the first 20% side by side and download the full translated PDF for a fraction of the standard translation cost.
  • Stay inside your reference manager: If you organize papers in Zotero 7–10 on Windows or macOS, install the Equalang Zotero plugin. Right-click any PDF attachment, enable formula optimization in the confirmation dialog, and keep the bilingual PDF attached to the same entry.

For a deeper look at reading arXiv papers in HTML versus bilingual PDF, see our comparison of arXiv HTML, ar5iv, and bilingual PDFs.

Path B: Translating Your Own .tex Manuscript for Submission

When a journal requires compilable .tex source, you cannot bypass the source files. The goal is to separate translatable prose from compiler instructions before any translator touches the text. Run these four steps in order.

1. Flatten Multi-File Overleaf Projects With latexpand

Overleaf manuscripts usually split chapters across ./sections/intro.tex, ./sections/method.tex, and ./tables/ablation.tex via \input{...} or \include{...}. Translating those files one by one invites inconsistent terminology and makes cross-file \label{} verification painful.

First, snapshot your working project in Git (or download a full Overleaf ZIP backup). Then flatten the .tex files into a single buildable file using latexpand, which ships with TeX Live:

git checkout -b translation-work
latexpand --keep-comments ./main.tex > ./main_flat.tex

latexpand inlines \input and \include targets while leaving your .bib file and figure paths untouched. If your comments contain old drafts you do not want translated, drop --keep-comments so latexpand strips them automatically. Verify that ./main_flat.tex compiles cleanly on its own before translating a single sentence.

2. Lock the Preamble and Switch the Compiler Engine

Everything between \documentclass{...} and \begin{document} is compiler configuration, not prose. Never feed the preamble to a translator. If a tool alters \newcommand{\loss}{\mathcal{L}_{\text{KL}}} or translates an option inside \usepackage[...]{...}, compilation dies on line 1.

Instead, edit the preamble manually to match your target language:

  • Translating into Chinese, Japanese, or Korean: Switch Overleaf's compiler from pdfLaTeX to XeLaTeX or LuaLaTeX under Menu → Settings → Compiler. Add \usepackage{xeCJK} (or \usepackage[UTF8]{ctex} for Chinese documents) right before \begin{document}. Leaving pdfLaTeX active triggers ! Package inputenc Error: Unicode character ... not set up for use with LaTeX.
  • Translating from Chinese into English: Replace ctexart or ctexrep with article or the target journal's .cls file. Remove \usepackage{xeCJK} if the journal submission system enforces pdfLaTeX.

3. Protect Immutable Keys, Paths, and Math Macros

Once your preamble is locked, work only on the body inside \begin{document} ... \end{document}. Every LaTeX paper mixes natural prose with rigid identifiers that must match your .bib database, file tree, or macro table character for character.

LaTeX constructExampleTranslate it?What breaks if altered
Citation keys\cite{vaswani2017attention}, \citep{...}NeverRenders [?] and Citation undefined
Labels & cross-refs\label{eq:kl}, \ref{fig:arch}, \eqref{eq:kl}NeverRenders ?? and broken hyperref jumps
File & figure paths\includegraphics{./figs/overview.pdf}NeverFatal File not found compile error
Custom macro calls\loss, \R, \ieNever! Undefined control sequence
Math environments$x_i$, \begin{align}...\end{align}Only \text{...} proseBroken delimiters or invalid math tokens
Captions & headings\section{...}, \caption{...}Yes (prose only)Keep nested \label{...} untouched

Keep one subtle detail in mind for tables and captions: translate the human-readable words inside \caption{...} and table cells, but leave column separators (&), line breaks (\\), \multicolumn, \toprule, and any \label{...} sitting inside the caption completely intact.

After translating the body into ./main_translated.tex, do not trust your eyes alone to verify every citation and cross-reference key. Extract and compare all keys between the original and translated files in five seconds:

grep -oE '\\(cite[a-z]*|label|ref|eqref|autoref)\{[^}]+\}' ./main_flat.tex | sort -u > ./keys_orig.txt
grep -oE '\\(cite[a-z]*|label|ref|eqref|autoref)\{[^}]+\}' ./main_translated.tex | sort -u > ./keys_trans.txt
comm -3 ./keys_orig.txt ./keys_trans.txt

An empty output from comm -3 means every citation, label, and reference key survived untouched. Any line printed tells you the exact key that was mutated or dropped.

4. Compile, Catch Silent [?] Warnings, and Run chktex

Overleaf often finishes building a PDF even when citations or references fail—it simply prints [?] or ?? in the margin and hides the warning inside the raw log. Always scan the .log output (or run pdflatex / xelatex locally) for these exact warnings:

grep -E "LaTeX Warning: (Reference|Citation)|Undefined control sequence" ./main_translated.log

Next, run chktex to catch stray punctuation, broken spacing before \ref{}, or mismatched braces introduced during translation:

chktex -q ./main_translated.tex

Finally, if you are handing the translated .tex file to a co-author for revision—or checking that you did not accidentally drop an equation block—generate a structural diff with latexdiff:

latexdiff ./main_flat.tex ./main_translated.tex > ./diff.tex

For journal submissions that require splitting files back out, keep the clean single-file ./main_translated.tex unless the venue explicitly demands separate chapter files—most editorial systems actually prefer a flattened .tex upload.

Frequently Asked Questions

Should I translate my .bib file along with the .tex manuscript?

No. Keep .bib entries in their original bibliographic language, and never alter entry keys like vaswani2017attention. If a journal requires English translations of non-English paper titles, add a note field or bracketed translation inside title only where the style guide asks for it.

Why does pdfLaTeX throw ! Package inputenc Error even after translating into English?

Stray full-width punctuation left over from Chinese or Japanese editing (,, 。, (, ), ;) or invisible non-breaking spaces will choke pdfLaTeX. Find every non-ASCII character in your translated .tex file with one command:

grep --color='auto' -P -n "[^\x00-\x7F]" ./main_translated.tex

Replace the flagged punctuation with standard ASCII equivalents and recompile.

What if my paper defines custom \newcommand macros that expand into prose?

Macros like \newcommand{\methodname}{FastAlign} are actually helpful during translation because keeping \methodname untouched guarantees consistent naming across the entire paper. Just verify after translation whether the expanded phrase needs capitalization or pluralization adjustments in the target language.

Sources