将 LaTeX(.tex)学术论文转换为 Word(.docx),支持可编辑的 OMML 公式、原生 Word 表格、嵌入图形、IEEE 双栏排版及参考文献
winget install pandoc or pandoc.orgpip install python-docx lxml pypandoc_binarybash
python scripts/tex2docx.py input.tex [output.docx]
If output.docx is omitted, output is input.docx in the same directory.
text
.tex ──→ [pandoc] ──→ OMML equations (13+ Word-editable formulas)
│
└──→ [Custom parser] ──→ Native Word tables ├──→ Final .docx
Embedded figures │ (merged)
Formatted refs │
IEEE layout & font ┘
Runs pandoc via pypandoc. Input file must be in its own directory (with figures/ subfolder if images exist). The script chdir s to the tex directory before running pandoc so image paths resolve correctly.
RegEx-based extraction of:
\begin{table} → Word Table objects (full borders, centered, 8pt TNR)\includegraphics{} + \caption{} → PNG/PDF embeds with italic captions\thebibliography → formatted entries with hanging indent\section{}, \subsection{} → bold headings\title, author, \abstract, \IEEEkeywordsOMML equation paragraphs from pandoc are inserted into the cleanly-built document. Body paragraphs get 0.25in first-line indent. All LaTeX commands ( \textbf, \toprule, \ref, \cite, \begin{itemize}, etc.) are stripped from text content.
FeatureDetailFontTimes New Roman (10pt body, 9pt table/figure, 8pt refs)LayoutA4, two-column IEEE conference styleEquationsOMML (double-click to edit in Word)TablesNative Word tables, all bordersFiguresPNG/PDF embedded with "Fig." captionsReferencesHanging indent, [bN] formatFirst indent0.25in on body paragraphs
bash
python scripts/verify.py output.docx
Reports paragraph/table/image/equation counts and checks for LaTeX residue.
Fully supports Chinese LaTeX documents using the ctex package:
\section*{} (star variant) is supportedw:eastAsia font fallback\title{...} and \author{...} residue paragraphs are filtered$...$) becomes plain text (italic), not OMML — only \begin{equation}, \begin{align}, and \[...\] become editable equations\thebibliography{} environmentscripts/tex2docx.py#Self-contained (660+ lines). Key internal functions:
FunctionRoleextract_tex()Parse all structural elements from .texextract_omml()Pull OMML XML from pandoc outputbuild_docx()Construct final document with all componentsclean()Strip LaTeX commands to plain textadd_table()Build Word table with bordersadd_figure()Embed image + caption