convert document

📁 midhunxavier/article-writing 📅 Jan 1, 1970
1
总安装量
0
周安装量
#49561
全站排名
安装命令
npx skills add https://github.com/midhunxavier/article-writing --skill Convert Document

Skill 文档

Convert Document Skill

Convert documents between LaTeX and DOCX formats. Preserves structure, formatting, citations, and content during conversion.

Overview

This skill enables:

  • LaTeX → DOCX conversion
  • DOCX → LaTeX conversion
  • Preservation of structure and formatting
  • Citation conversion (BibTeX ↔ Word bibliography)
  • Math equation handling
  • Figure and table preservation

Commands

/convert-document <file> [--from latex|docx] [--to latex|docx]

Convert a document between formats.

Parameters:

  • file (required): Source file to convert
  • --from latex|docx (optional): Source format (default: auto-detect from extension)
  • --to latex|docx (optional): Target format (default: opposite of source)

Conversion Capabilities

LaTeX → DOCX

  • Converts .tex to .docx
  • Preserves document structure (sections, subsections)
  • Converts BibTeX citations to Word citations
  • Handles math equations (converts to Word equations)
  • Preserves figures and tables
  • Maintains formatting where possible

DOCX → LaTeX

  • Converts .docx to .tex
  • Preserves formatting and structure
  • Converts Word citations to BibTeX
  • Handles math equations (converts to LaTeX math)
  • Preserves figures and tables
  • Generates proper LaTeX structure

What Gets Preserved

  • Structure: Sections, subsections, paragraphs
  • Citations: BibTeX ↔ Word bibliography
  • Math: LaTeX math ↔ Word equations
  • Figures: Image references and captions
  • Tables: Table structure and content
  • Formatting: Basic formatting (bold, italic, etc.)

Examples

# Convert LaTeX to DOCX
/convert-document main.tex --to docx

# Convert DOCX to LaTeX
/convert-document paper.docx --to latex

# Explicit format specification
/convert-document main.tex --from latex --to docx

Conversion Workflow

  1. Source Analysis: Analyzes source document structure
  2. Format Detection: Detects format if not specified
  3. Content Extraction: Extracts text, citations, math, figures
  4. Format Conversion: Converts to target format
  5. Output Generation: Creates converted file

Citation Conversion

BibTeX → Word Bibliography

  • Extracts BibTeX entries
  • Creates Word bibliography sources
  • Updates citations in document

Word Bibliography → BibTeX

  • Extracts Word bibliography sources
  • Generates BibTeX entries
  • Updates citations to \cite{} format

Math Equation Handling

  • LaTeX math → Word equations (via MathML or image conversion)
  • Word equations → LaTeX math (via MathML parsing)
  • Preserves equation numbering where possible

Limitations

  • Complex LaTeX packages may not convert perfectly
  • Custom TikZ diagrams may need manual adjustment
  • Some formatting nuances may be lost
  • Very large documents may take time

Scripts Used

  • scripts/converter.py – Main conversion script (pandoc-based or python-docx)

Dependencies

  • pandoc (recommended for best results)
  • python-docx (for DOCX handling)
  • LaTeX distribution (for LaTeX processing)

Platform Compatibility

Works on all platforms (Claude Code, Codex, OpenCode, Gemini, Cursor). Command syntax may vary by platform – see platform-specific documentation in docs/.