Home

Awesome

Logseq LaTeX Formula OCR Plugin

Convert LaTeX formula images from clipboard to LaTeX code in Logseq using Transformers.

Use cases:

(For me it was useful because I hate copying formulas by hand and I hate pasting screenshots of formulas into Logseq😅)

Commands

Notes:

Installation Options

  1. Manual + Hugging Face

    • Requirements: Node.js, Yarn, Parcel, Hugging Face User Access Token
    • Clone repo: git clone https://github.com/olmobaldoni/logseq-formula-ocr-plugin.git
    • Install dependencies: cd logseq-formula-ocr-plugin && yarn && yarn build
    • Enable developer mode: Logseq > Settings > Advanced > Developer mode
    • Import Plugin: Logseq > Plugins > Load unpacked plugin and point to the cloned repo
  2. Marketplace + Hugging Face

  3. Marketplace + Docker (Recommended)

    • Requirements: Docker
    • Search for LaTeX Formula OCR in the Logseq marketplace and install directly
    • Pull image: docker pull olmobaldoni/nougat-ocr-api:latest
    • Run container: docker run -d -p 80:80 olmobaldoni/nougat-ocr-api:latest

Note: For more information on how to use the local API visit: https://github.com/olmobaldoni/LaTex-Formula-OCR-API

Settings

  1. Hugging Face
    • In Hugging Face: Settings > Access Tokens > New Token > Name+Role(read) > Generate a token
    • In Logseq: Plugins Settings > LaTex Formula OCR > Hugging Face User Access Token and paste the token.
  2. Local API
    • In Logseq: Plugins Settings > LaTex Formula OCR > Use Local API to switch between Hugging Face and local

Settings

Demo

Demo 1

Demo 2

Known Issues

Hugging Face API may truncate responses (see Issuee #2 and Issue #487)

Note: <ins> Docker method recommended for full functionality </ins>

Credits

This plugin is based on nougat-latex-base, a fine-tuning of facebook/nougat-base with im2latex-100k, and made by NormXU.

In addition, this plugin was also inspired by xxchan and its plugin logseq-ocr

License

MIT