NL2LaTeX Snippets

approvedunreviewed

by antodellarte

Natural language to LaTeX conversion engine. Supports math snippets, tables, charts and more.

โ†“ 49 downloadsUpdated 16d agoMIT

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

1. Marker Auto-Conversion (Recommended)

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:

ConstructEnglish ExampleItalian ExampleOutput
Integralsintegral of x from A to Bintegrale di x da A a B\int_{A}^{B} x \, dx
Derivativesderivative of x with respect to yderivata di x rispetto a y\frac{d}{dy}(x)
Limitslimit of x as y approaches 0limite di x per y che tende a 0\lim_{y \to 0} x
Sumssum of x from n = 1 to 10sommatoria di x da n = 1 a 10\sum_{n=1}^{10} x
Rootssquare root of x, 3rd root of xradice quadrata di x, radice di ordine 3 di x\sqrt{x}, \sqrt[3]{x}
Powersx squared, x cubed, x to the power of nx al quadrato, x al cubo, x elevato a n(x)^2, (x)^3, (x)^{n}
Greek Lettersalpha, beta, gamma, omega...alfa, beta, gamma, omega...\alpha, \beta, \gamma, \omega
Logic/Relationsx implies y, for all x, x and yx implica y, per ogni x, x e logico yx \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.

For plugin developers

Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.