mathcha

command module
v0.0.0-...-04c7bcf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2026 License: GPL-3.0 Imports: 12 Imported by: 0

README

mathcha

A mathquill-like interactive math input in a terminal, built with the charm TUI library.

asciicast

Usage

Keybinds:

  • Arrow keys/ Ctrl+b/f/n/p for basic cursor navigation
  • Alt + left/right to start or extend selection
    • in selection mode, parenthesis (/) and divide / keys will wrap the selected block in the corresponding command
  • Tab to go out a block
  • Press \ to enter a \command (e.g. \alpha or \frac), when you're done, hit Space. While entering a command, you can hit Tab to see a list of available commands (there's no autocomplete, you still have to type it out yourself)
  • Enter for a new equation in a new line
  • Ctrl+k to go to previous line, Ctrl+j to go to next line

Supported Symbols and Commands

There is no standard support table or even a goal, if I ever feel like turning this into a serious project, I would start from KaTeX, but that probably won't happen :P.

Take a look at command_def.gofor a list of all recognized latex commands.


I started this project when I was learning parsing, and this remains as a toy project in which I add stuff when I feel like doing so. Feature requests and whatnot is welcome, but I probably won't do anything.

Other interesting stuff I might try in the future:

  • reactive-programming styled rendering
  • undo
  • autocomplete
  • using parsing libraries for a declarative approach
  • go-specific memory optimizations
  • rendering on other, non-TUI platforms (WASM!)

Documentation

Overview

WARNING this file is mostly for testing

Directories

Path Synopsis
The Editor provides the interface for navigating/editing the math equation, that an app can then bind controls to such methods
The Editor provides the interface for navigating/editing the math equation, that an app can then bind controls to such methods
Definitions for known latex commands (basckslash commands) definitions are pulled from mathquill and pie-frameworks' extended version
Definitions for known latex commands (basckslash commands) definitions are pulled from mathquill and pie-frameworks' extended version
Some extended parser.Expr that are useful to the editor
Some extended parser.Expr that are useful to the editor

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL