Keep formulas and subfigure references from breaking in LaTeX translations

After translating a LaTeX source package with OmniDoc, formula and subfigure references may show question marks or have misaligned numbers. This article provides concrete steps for label cross-checking, compilation troubleshooting, and repair, to help you confirm that cross-references in the translated text remain valid.

Key points of this article

  • Before translating, compare the number and names of \label and \ref commands in the source and the translation. If the counts or names don't match, the problem is there.
  • Formula and subfigure references need two compilation passes before their numbers are written. If you only check the PDF after one pass, you can easily miss problems.
  • The undefined and multiply defined warnings in the log are direct clues. Address each one.
  • Use \subref for subfigure references. When you rewrite a caption, keep the subfigure environment and the position of the label.
  • Keep bibliography keys unchanged, or citations will show question marks.

Many people use OmniDoc to translate LaTeX source packages and find that the PDF layout is basically fine, but the body text shows "Eq. (??)" or "Fig. 3(??)", or the subfigure numbers don't match. This problem is usually not caused by the translation damaging the content. Rather, \label and \ref lose their correspondence in the translated text. It is especially common in papers, theses, and technical reports with many equations and subfigures.

This article is for readers who need to work with translated literature in LaTeX. After reading it, you will know how to use label-count comparison, compilation logs, and PDF inspection to quickly determine whether formula and subfigure references are still valid, and how to fix them according to their causes.

OmniDoc supports uploading LaTeX source packages for translation. You can choose to output only the translation or a bilingual side-by-side version, and formulas and layout are preserved. However, the translation is machine-generated, so even with all citations parsed, the terminology and sentence meaning should still be checked against the original text.

How do you check formulas and subfigure references after translation? One-sentence conclusion

First, compare the number of labels in the source and translated text to confirm that no \label was lost, renamed, or moved. Then compile twice and check the log. Finally, verify the numbering in the PDF. Looking at the PDF alone can reveal obvious question marks, but it cannot detect references that point to the wrong target, so both steps are necessary.

Your situationRecommended PracticesCause
I only need to be able to read the translation, not compile it anymore.Compare against the original text and verify the number and names of formulas and subfigure labels.Without recompiling, broken references usually don't show up directly.
Pdf to submit to a journal or supervisorCompile twice, and go through the undefined warnings in the log one by one.Cross-reference numbers must be written in the second compilation pass.
The text uses subfigures (subfigure or subcaption).Separately verify the display of \subref and the order of (a)(b)Subfigure numbers are generated by the subfigure environment, so they are easily lost when the caption is rewritten.
I changed the custom commands in the preamble of the translation.Check whether the \newcommand definitions in the preamble keep their original namesChanging the command name will directly cause the compilation to fail.
The references come from the literature workspace connected to Zotero.Keep the \cite keys unchanged, and rerun bibtex or latexmk when compiling.After the key changes, the references will show question marks.

First, determine which type of problem it is

Different symptoms have different causes, so first find the one that matches yours; this can save you a lot of detours.

SymptomsCommon causesHow do I confirm?
"??"or"(??)"appears in the PDF\ref, \eqref references point to a label that does not exist, or the label has been deletedSearch the log for "undefined" warnings, note the tag name, then look it up in the translation.
The equation number is correct, but the body text refers to a different equation.The \label was moved outside the \caption or equation environment, or the label is duplicated.Check whether the \label is still inside the equation environment, and look for any duplicate label names.
Subfigure shows "Figure 3(??)" or (a)(b) misalignedLabel of \subref lost, or the subfigure environment structure was modifiedCheck whether the .aux file contains label records for the corresponding subfigures
Compilation reports "Undefined control sequence"The custom commands in the preamble have been translated or had their names changed.Based on the line numbers in the error, check each item against the preamble of the original text.
Label ... multiply definedThe translation copied the paragraph, causing the same label to appear twice.Search for this tag name in the translation and find the duplicate positions.

Item-by-item troubleshooting and fixing

I suggest proceeding in the following order: first carry out the low-cost checks, then deal with the more complex structural issues.

  1. Save the source code of both the original and the translation, and compare them file by file, including the main file, each chapter file, and the preamble.
  2. Count labels: search for \label{ in both the original and the translation, and record the number and the name of each label. Label names such as eq:loss and fig:overview must remain in their original English form and must not be translated into Chinese.
  3. Count references: search for \ref, \eqref, \subref, and \cref. The counts should match the original. If the translation has fewer references, a passage has usually been deleted or altered.
  4. Check label placement: \label should follow immediately within \caption, or be located inside the equation or subfigure environment. If it has been moved to the end of a paragraph or outside the environment, the numbering may point to the wrong object.
  5. Compile twice. The first pass generates the auxiliary files, and the second pass writes the numbers into the reference locations. Then check the log for any remaining "LaTeX Warning: Reference ... undefined" and "multiply defined" messages.
  6. Check the PDF: find each place in the body text where equations and subfigures are mentioned, and confirm that the numbering matches the corresponding formula or figure caption.
  7. If the output is a bilingual side-by-side version, compare the numbering positions in the translated PDF with those in the original PDF; the numbers should correspond one to one.
  8. After the fixes, compile once more to confirm the warnings have disappeared, and save the corrected source code.

After uploading your LaTeX source package to omnidoc.top and downloading the translation, you can verify it directly by following the steps above. If you need to continue editing the LaTeX content on the web, you can use the UniDoc web editor at app.unidoc.top.

How to Fix Broken Official Citations

When a formula reference breaks, the cause is usually the position or the name of the \label. First, find the label name reported as undefined in the log, and search for it in the translated text. If the label is missing, restore it from the original text into the corresponding equation environment. If the label name was changed to Chinese, change it back to the original English name, and update all matching \ref and \eqref accordingly.

How to fix subgraph references

Key points for subfigure references are \subref and the subfigure environment. When using packages such as subcaption, subfigure labels should be placed in the corresponding subfigure, and the body text should refer to them with \subref. If the translation changes "(a)" and "(b)" into full-width brackets or handwritten text, the numbering format will change. When fixing this, keep the original subfigure structure, translate only the caption explanatory text, and do not modify the environments or labels.

How to Avoid Recurrence Next Time

  • Before translating, back up the original source package so you can compare against it at any point during the fixes.
  • Do not translate the arguments of \label, \ref, or \cite. Label names must always stay in English and use ASCII characters.
  • Do not rename custom commands in the preamble. Translate only the body text and the text inside captions.
  • After every change, compile twice and check the log. Do not rely only on whether the PDF looks correct.
  • Keep the reference keys unchanged. If you use a Zotero-linked bibliography workspace, check after importing that the keys still match the keys used in the body text.
  • After modifying a figure or table, check every place in the body text where it is referenced and confirm that the numbering still corresponds.

❓ Frequently Asked Questions (FAQ)

1. After compilation there are no question marks—will references still go wrong?

Yes. Sometimes the numbers are written in correctly, but the object they point to has shifted, for example when subfigure and whole-figure numbers get mixed up. A PDF showing no question marks only tells you that the labels resolve; it does not tell you that they point to the right content. So you still need to check, one by one, that the numbers mentioned in the body text match the figure captions and equations.

2. Can the tags in the translation be changed to Chinese?

Not recommended. Keep label names in English: references are more stable, and it also avoids encoding issues with compilers and packages in different environments. Chinese content should only appear in the caption and the body text.

3. Which reference command is used for a whole figure versus a subfigure?

Use \ref for whole figures and \subref for subfigures when using packages such as subcaption. The two have different label placements, so mixing them up will cause the numbering to display incorrectly.

4. Do I need to rerun bibtex after translation?

Yes. If the reference keys stay the same, simply rerun bibtex or latexmk to update the bibliography. If a key has changed, the citations will show question marks, so you need to fix the key before compiling.

📝 Summary

After translating a LaTeX paper, broken equation and subfigure references can usually be traced by comparing labels, compiling twice, and checking the log. As long as the label names and preamble commands stay unchanged, the fix is not complicated. Once the check is complete, review the numbering in the PDF once more before you submit the translation.

Open OmniDoc and translate your entire document.

Updated 2026-11-29