Install
openclaw skills install tex2docxConvert LaTeX (.tex) academic papers to Word (.docx) with editable OMML equations, native Word tables, embedded figures, IEEE two-column format, and bibliography. Use when a user provides a .tex file and asks for a Word/DOCX version, or when converting academic LaTeX papers to editable Office format.
openclaw skills install tex2docxwinget install pandoc or pandoc.orgpip install python-docx lxml pypandoc_binarypython scripts/tex2docx.py input.tex [output.docx]
If output.docx is omitted, output is input.docx in the same directory.
.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 chdirs 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.
| Feature | Detail |
|---|---|
| Font | Times New Roman (10pt body, 9pt table/figure, 8pt refs) |
| Layout | A4, two-column IEEE conference style |
| Equations | OMML (double-click to edit in Word) |
| Tables | Native Word tables, all borders |
| Figures | PNG/PDF embedded with "Fig." captions |
| References | Hanging indent, [bN] format |
| First indent | 0.25in on body paragraphs |
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.pySelf-contained (660+ lines). Key internal functions:
| Function | Role |
|---|---|
extract_tex() | Parse all structural elements from .tex |
extract_omml() | Pull OMML XML from pandoc output |
build_docx() | Construct final document with all components |
clean() | Strip LaTeX commands to plain text |
add_table() | Build Word table with borders |
add_figure() | Embed image + caption |