Skip to content
John H. Latour edited this page Oct 17, 2024 · 3 revisions

LaTeX to Word Conversion Project

Overview

This project automates the conversion of LaTeX equations into Microsoft Word documents. It leverages a combination of Python and VBA macros to process LaTeX code and render it as OMath objects in Word.

The system reads LaTeX Equations from a Word document, sends them to a Python script for processing, and re-inserts the converted equations back into the document. This allows for quick and efficient mathematical document editing in Word.

Features

  • Convert LaTeX Math: Converts basic LaTeX equations (e.g., fractions, summations, integrals) into professional Word equations.
  • Symbol Replacement: Automatically replaces LaTeX-specific symbols (like \cdot, \div, etc.) with Unicode equivalents.
  • Preserves Fractions: Ensures up-down fraction formatting (\frac{}) in the resulting Word document.
  • Handles Nested Fractions: Can process nested fractions and complex mathematical expressions.
  • Greek Letters & Special Symbols: Includes support for common Greek letters and special characters used in equations.

Usage

Setup

  1. Install Python and Required Libraries: Make sure you have Python installed. The following Python libraries are required:

    • pylatexenc
    • python-docx

    You can install them using:

    `pip install pylatexenc python-docx`
    
  2. Install VBA Macro:

Open your Word document. Navigate to Developer > Visual Basic. Copy the provided VBA code from this repository and paste it into the ThisDocument section in the Visual Basic Editor.

  1. Link to Python Script: Update the paths in the VBA code to match your local environment where the Python script is saved.
Clone this wiki locally