Skip to content

moskensoap/latex-formula-editor

Repository files navigation

Overview:

An offline LaTeX formula editor that offers real-time preview with customizable rendering engines (KaTeX/MathJax). It includes features like click-to-insert LaTeX elements, clipboard export, and image export (SVG, PNG, JPG). Designed for both ease of use and offline-first functionality, the editor is lightweight and deployable on local servers.

Features:

  • Real-time Preview: Instantly render LaTeX formulas with KaTeX or MathJax.

  • Click-to-insert: Easily insert LaTeX elements at the cursor.

  • Export Options: Export formulas as SVG, PNG, JPG, or copy formulas as PNG to the clipboard.

  • Minimalistic Interface: Clean and simple UI for focused editing.

  • Cross-Platform: Works locally by opening index.html in any modern browser.

  • Customizable: Lightweight structure for easy modifications.

Demo:

Live demo available at: https://latex.moskensoap.xyz

Running the Editor in Browser:

You can easily run the LaTeX Formula Editor by following these simple steps:

  • Option 1: Clone with Git

    Open a terminal and run the following command:

    git clone https://github.com/moskensoap/latex-formula-editor.git

    Then, navigate to the project folder and open index.html in any modern browser.

  • Option 2: Download ZIP

    Go to the repository page, click "Code" > "Download ZIP", and extract the files. After extracting, simply double-click index.html to open it in your browser.

Running the Editor with Electron

Step 1: Install Dependencies

git clone https://github.com/moskensoap/latex-formula-editor.git
cd latex-formula-editor
npm install

Step 2: Run in Development Mode

npm run start

Step 3: Build for Production

# Build for Windows (64-bit)
npm run build:win64

# Build for Windows (32-bit)
npm run build:win32

# Build for macOS (Intel)
npm run build:mac

# Build for macOS (Apple Silicon)
npm run build:mac-arm

# Build for Linux (64-bit)
npm run build:linux

Step 4: Locate the Executable

cd dist

Find the appropriate executable for your platform in the generated folder (e.g., latexformula-win32-x64) and run the application.

Enjoy!

Docker Deployment:

1. Quick Start (via Docker Hub):

docker run --restart unless-stopped -d -p 8080:80 --name latex-formula-editor moskensoap/latex-formula-editor:latest

Access via:

http://localhost:8080 (local)

http://<your-ip>:8080 (remote)

2. Custom Build (from source):

If you need a custom Docker image, or if the architecture of the provided Docker Hub image does not suit your needs, you can build your own Docker image by following these steps:

  • To start:
cd docker
docker compose up -d
  • To stop:
docker compose down

Access via:

http://localhost:8080 (local)

http://<your-ip>:8080 (remote)

3. OCR (Convert Images to LaTeX):

Powered by LaTeX-OCR by @lukas-blecher.

  • To start:
cd docker/pix2tex
docker compose up -d
  • To stop:
docker compose down

Access via:

http://localhost:8501 (local)

http://<your-ip-address>:8501 (remote)

Rendering Engines & Export Support

This project bundles:

You can update KaTeX or MathJax by replacing the corresponding folders. If folder structure changes, adjust paths in the HTML accordingly.

We are grateful to these excellent open-source projects for making this editor possible.

Feedback & Contributions

We welcome your suggestions, questions, and feature ideas! Feel free to open an issue to start a discussion or report a problem.

About

Offline LaTeX formula editor with preview, KaTeX/MathJax switch, insert tools, and image export.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published