Skip to content

shaqtsui/prettify-math

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prettify math is a emacs minor mode to prettify math formulas.

Note this project current only support mac & linux, NOT windows as a bug in jsonrpc.

./prettify-math-demo.gif

It’s base on mathjax, refer mathjax for math formula related stuffs. Default math formula delimiters:

`inline asciimath
``block asciimath
$inline latex
$$block latex

Prerequisite

nodejs - used to run mathjax, if not available simple installation refer: Installing Node.js

Installation

via straight.el

(straight-use-package '(prettify-math :host nil :repo "https://github.com/shaqtsui/prettify-math" :files (:defaults "mathjax-jsonrpc.js")))

or from melpa

  1. add melpa in init.el if not available
    (require 'package)
    (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
    (package-initialize)
        
  2. command: M-x package-refresh-contents RET M-x package-install RET prettify-math RET

Usage

Enable in current buffer: M-x prettify-math-mode RET, or globally: M-x global-prettify-math-mode RET.

Customization

Customize prettify-math-default-scale for formula scale

Set delimiter before this module loaded.

Code example in init.el:

(setq prettify-math-delimiters-alist
  '(("$" tex)
    ("$$" tex block)
    (("\\(" . "\\)") tex block)
    ("`" asciimath)
    ("``" asciimath block)))
(require 'prettify-math)

Compare with existing similar packges

Existing similar packages:

why prettify-math:

  • on-fly image generate, no disk temp file
  • Responsive style(foreground/background color, size) base on surrunding text.
  • JIT render instead of AOT render, which can support large files.
  • Not only to support latex math expression, but also asciimath expression, in future other may supported.
  • prettify-math implemented as minor mode, make it works in all major modes.

About

emacs minor mode to view latex math, asicii math on fly

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published