NL2LaTeX Snippets

by antodellarte
5
4
3
2
1
Score: 50/100

Description

Natural language to LaTeX conversion engine for Obsidian.

Reviews

No reviews yet.

Stats

0
stars
42
downloads
0
forks
9
days
8
days
8
days
0
total PRs
0
open PRs
0
closed PRs
0
merged PRs
0
total issues
0
open issues
0
closed issues
21
commits

Latest Version

9 days ago

Changelog

Changelog

[1.0.4] - 2026-09-26

Added

  • Extended the natural-language LaTeX parser with mathematical constructs in Italian and English.
  • Added support for matrices with composite elements, row/column vectors, scalar and vector products.
  • Added symbols and constructs for sets, lateral limits, higher order derivatives, multiple integrals and vector operators.
  • Added non-existence symbol \\nexists.

Fixed

  • Fixed parsing of fractions, roots, powers, functions and nested parentheses.
  • Corrected the handling of fraction separators and decimal numbers with comma.
  • Improved distinction between ambiguous Italian syntax, including per, a and fratto.
  • Corrected the management of integration variables, bounds and matrices with arithmetic expressions.

Validation

  • Added and ran parser regression suite.
  • npm test: 13 tests passed.
  • npm run build: passed.

README file from

Github

NL2LaTeX

Build and Check GitHub release Obsidian Plugin License

NL2LaTeX Snippets Demo

🌍 Choose Language / Scegli la lingua:

📖 Table of Contents

NL2LaTeX is an Obsidian plugin that allows you to write complex mathematical expressions in natural language (English and Italian) and convert them into formatted LaTeX code on the fly.

✨ Features

  • Natural Language Parsing: Automatically understands spoken math like "integral of x", "limit as x approaches 0", or "square root of x".

  • Bilingual Support (EN/IT): Mix and match English and Italian seamlessly (e.g., "integral of x squared" or "integrale di x al quadrato").

  • Auto-Conversion Markers: Type your math between customizable markers (default ;;) and watch it turn into LaTeX the moment you close them.

  • Custom Regex Snippets: Build your own personal dictionary of shortcuts using JavaScript Regular Expressions.

  • Configurable Output: Choose whether to wrap the generated LaTeX in inline ($...$), block ($$...$$), or no delimiters.

🚀 How to Use

By default, the plugin listens for the ;; markers. Type your natural language expression between them. As soon as you type the closing ;;, it converts automatically.

Input:

;; integral of x squared from 0 to pi ;;

Output:

$\int_{0}^{\pi} (x)^2 \, dx$

2. Selection Conversion

Select any standard text in your note, open the Command Palette (Ctrl/Cmd + P), and run NL2LaTeX: Convert selection to LaTeX. You can also assign a custom hotkey to this command in Obsidian's settings.

🧮 Supported Constructs

The parser understands standard math vocabulary and groups them logically. Here are some examples of what you can type:

Construct English Example Italian Example Output
Integrals integral of x from A to B integrale di x da A a B \int_{A}^{B} x \, dx
Derivatives derivative of x with respect to y derivata di x rispetto a y \frac{d}{dy}(x)
Limits limit of x as y approaches 0 limite di x per y che tende a 0 \lim_{y \to 0} x
Sums sum of x from n = 1 to 10 sommatoria di x da n = 1 a 10 \sum_{n=1}^{10} x
Roots square root of x, 3rd root of x radice quadrata di x, radice di ordine 3 di x \sqrt{x}, \sqrt[3]{x}
Powers x squared, x cubed, x to the power of n x al quadrato, x al cubo, x elevato a n (x)^2, (x)^3, (x)^{n}
Greek Letters alpha, beta, gamma, omega... alfa, beta, gamma, omega... \alpha, \beta, \gamma, \omega
Logic/Relations x implies y, for all x, x and y x implica y, per ogni x, x e logico y x \implies y, \forall x, x \land y

Note: You can combine operators naturally, like sin of x plus cos of y divided by 2.

⚙️ Custom Regex Snippets

If you use specific notations frequently, you can add your own Regex rules in the plugin settings. These snippets are processed before the natural language engine.

Example:

  • Label: Vectors

  • Pattern: vector (?:of )?([a-zA-Z0-9]+)

  • Replacement: \vec{$1}

Now, typing vector of v will instantly convert to \vec{v}.

📥 Installation

Manual Installation (from Releases)

  1. Go to the Releases page of this repository.

  2. Download the main.js and manifest.json files from the latest release.

  3. Create a folder named nl2latex-obsidian inside your vault's .obsidian/plugins/ directory.

  4. Place both downloaded files into that folder.

  5. Reload Obsidian and enable the plugin in Settings > Community Plugins.

🛠️ Building from Source

If you want to compile the plugin yourself or contribute to the development, follow these steps:

  1. Prerequisites: Ensure you have Node.js and npm installed on your machine.

  2. Clone the repository:

   git clone https://github.com/antodellarte/nl2latex-obsidian.git
   cd nl2latex-obsidian
  1. Install dependencies:
   npm install
  1. Compile the plugin:
npm run build
  1. Result: The compilation will create a build/ folder containing the ready-to-use main.js and manifest.json files. Copy this folder into your Obsidian vault under .obsidian/plugins/ to test your local build.

🤝 Contributions and License

Any bug reports or Pull Requests are welcome! The project is distributed under the MIT license.

🇮🇹 Guida in Italiano

📖 Indice

NL2LaTeX è un plugin Obsidian che consente di scrivere espressioni matematiche complesse in linguaggio naturale (inglese e italiano) e convertirle al volo in codice LaTeX formattato.

✨ Caratteristiche Principali

  • Supporto Bilingue Nativo: Il motore di conversione comprende sia l'italiano che l'inglese, permettendoti anche di mescolarli (es. "integrale di x squared").

  • Conversione al volo: Digita la tua formula tra due marcatori personalizzabili (di default ;;) e il plugin la trasformerà in LaTeX non appena digiti il marcatore di chiusura.

  • Snippet Regex Personalizzati: Crea scorciatoie su misura utilizzando le espressioni regolari (RegEx) direttamente dalle impostazioni del plugin.

  • Stile Flessibile: Scegli se racchiudere l'output in blocchi inline ($...$), blocchi isolati ($$...$$) o senza alcun delimitatore.

🚀 Utilizzo

1. Conversione Automatica (Consigliata)

Usa i marcatori di conversione rapida. Digita l'espressione in linguaggio naturale e chiudi con i marcatori.

Cosa scrivi:

;; integrale di x al quadrato da 0 a pi greco ;;

Cosa ottieni:

$\int_{0}^{\pi} (x)^2 \, dx$

2. Conversione da Selezione

Evidenzia un testo qualsiasi, apri il riquadro dei comandi di Obsidian (Ctrl/Cmd + P) e cerca NL2LaTeX: Convert selection to LaTeX. Puoi anche assegnare una scorciatoia da tastiera personalizzata a questo comando.

⚙️ Snippet Personalizzati

Nelle impostazioni del plugin puoi aggiungere regole personalizzate che hanno la priorità sul motore di traduzione standard.

Ad esempio, se vuoi una scorciatoia veloce per i vettori:

  • Etichetta: Vettore

  • Pattern Regex: vettore (?:di )?([a-zA-Z0-9]+)

  • Sostituzione: \vec{$1}

In questo modo, scrivendo vettore di v oppure vettore x, il testo verrà convertito rispettivamente in \vec{v} e \vec{x}.

📥 Installazione manuale (da Releases)

  1. Visita la pagina Releases di questo repository.

  2. Scarica i file main.js e manifest.json dall'ultima versione disponibile.

  3. Crea una cartella chiamata nl2latex-obsidian dentro il percorso .obsidian/plugins/ del tuo vault.

  4. Inserisci i due file scaricati all'interno della cartella.

  5. Riavvia Obsidian e attiva il plugin da Impostazioni > Plugin della community.

🛠️ Compilando da source

Se vuoi compilare autonomamente il plugin o contribuire allo sviluppo, segui questi passaggi:

  1. Requisiti: Assicurati che Node.js e npm siano installati correttamente sul tuo dispositivo.

  2. Clona la repository:

   git clone https://github.com/antodellarte/nl2latex-obsidian.git
   cd nl2latex-obsidian
  1. Installa le dependencies:
   npm install
  1. Compila il plugin:
npm run build
  1. Risultato: Il compilatore creerà una cartella build/ contenete i file main.js e manifest.json pronti all'uso. Copia questa cartella nel tuo vault Obsidian in .obsidian/plugins/ per testare la tua build locale.

🤝 Contributi e Licenza

Eventuali segnalazioni di bug o Pull Request sono i benvenuti! Il progetto è distribuito sotto licenza MIT.