CLI program for converting natural language text to LaTeX
Project description
llamatex
Convert natural language descriptions to LaTeX equations in your terminal, in under a second!
Features
llamatex offers two primary modes of operation:
- Single Instruction Mode: Generate LaTeX for a single equation description.
- Clipboard Mode: Send LaTeX code from highlighted text into your clipboard.
- Markdown File Editing Mode: Automatically replace natural language descriptions with LaTeX equations in a markdown file.
For equations that can be rendered in a single line, smoltex opens a new window displaying the rendered equation.
Installation
pip install llamatex
For local generation support:
pip install llamatex[local]
Alternatively, you can build from source using poetry.
poetry install
Usage
Single Instruction mode
llamatex render -p "equation for the area of a circle"
Output:
Latex string: A = \pi r^2
>> completion time: 856.4 ms
Clipboard mode
[!WARNING]
llamatexclipboard mode currently only supports MacOS
llamatex uses pynput to listen to your inputs and control the keyboard. To allow clipboard mode, allow your terminal/IDE to be added to Assessibility in System Settings.
Run llamatex in clipboard mode using the following command:
llamatex run
Markdown File Editing Mode
- Create a markdown file (e.g.,
equations.md) with placeholders:
# Important Equations
1. Area of a circle:
{"area of a circle"}
2. Einstein's mass-energy equivalence:
{"einstein's famous equation"}
- Run
llmatex:
llamatex render -f equations.md
- The file will be updated with LaTeX equations:
# Important Equations
1. Area of a circle:
$A = \pi r^2$
2. Einstein's mass-energy equivalence:
$E = mc^2$
Use the hotkey Cmd+Shift+L (on macOS) to process the selected text. Press esc to exit the program.
Configuration
API Setup
- Get a free API key from Groq console.
- Set the environment variable
export GROQ_API_KEY=your-api-key-here
Available models:
- llama3:
llama3-8b,llama3-70b,llama3.1-8b,llama3.1-70b - gemma:
gemma-7b,gemma2-9b - mixtral:
mixtral-8x7b - Phi3 (local only):
phi-3-mini
Server selection
Choose between groq (default) or llama-cpp (for local generation) using the -s or --server option:
llamatex render -p "pythagorean theorem" -s llama-cpp
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llmatex-0.1.0.tar.gz.
File metadata
- Download URL: llmatex-0.1.0.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.13 Darwin/22.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3beb59a21af62616859c53a8d299fda1d976c793c3b1aa0f1b5fe00f35c51785
|
|
| MD5 |
0c33e6fcb0eb64790540ba6137155b4b
|
|
| BLAKE2b-256 |
90ec8d45fb0e295f71f22e1736d43b925030e6e3ed3125cf018e12999b4a411f
|
File details
Details for the file llmatex-0.1.0-py3-none-any.whl.
File metadata
- Download URL: llmatex-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.13 Darwin/22.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39d969753ac8a288305de66b440817c83db422ff3fa1e043a2d5812606d9c113
|
|
| MD5 |
18a60a4c216d0c7b376599da014e351c
|
|
| BLAKE2b-256 |
88a0d3174bca49145d215e5107ae1f7b98f27be9c84e03549faf613ab6042ca7
|