HeTeX.hx
An ASCII-rendered LaTeX preview plugin for Helix
- Stars: 12
- Last commit:
- Created:
An ASCII-rendered LaTeX preview plugin for Helix
⚠️ Warning: This plugin is experimental. It may not work on all systems.
This plugin relies on libtexprintf providing utftex which is a great program converting small LaTeX expressions into ASCII.
This plugin embeds the binary and calls it via FFI. I'd like to switch over to the components to render rather than echo at some point but at this point they are very verbose (and difficult to write!) and I'm not positive the api will stay the same. If someone wants to merge a patch it'd be very welcome.
It is worth noting that as of this version, the command calls the helix sh command and echos it to create the dialog. It uses the ' character and trims them from the utftex output, so from what I can tell it is impossible to break out of the command and execute malicious shell code. However despite this I'm leaving this as a warning to be wary.
Also I'm on Linux and have not been able to test on other platforms. I think that this may be pretty hard to run on windows since you have to build libtexprintf. This may not run on Windows as is.

This is a helix plugin made using steel. To install, you can use the forge command line tool,
which also requires having a rust toolchain installed. In addition, there are a few dependencies for libtexprintf
C toolchain
autoconf
automake
make
pkg-config
m4
libtool
libclang (may be libclang-dev or similar)
If you are on NixOS, you can enter the dev environment provided instead
nix-shell https://github.com/daynardn/HeTeX.hx/archive/main.tar.gz
Then you can either clone the repo and then from the root run:
forge install
Or you can do:
forge pkg install --git https://github.com/daynardn/HeTeX.hx.git.
This will build and install the library.
Add the plugin in your ~/.config/helix/init.scm:
(require "hetex/hetex.scm")
To run the parser on the current selection
:hetex-run
or
(hetex-run)
Any contribtuions are welcome. There's a few things I want to target but I currently cannot, if anyone wants to work on them, feel free.
I wrote this plugin but there's a few things that helped
I used this as a base for writing the plugin
Really hard to find program that helped a ton
This is the vim plugin I got the idea from. Initally I tried to convert this but it was too many lines
Also, all of this is only possible due to the hard work of mattwparas. Thank you!
README from daynardn/HeTeX.hx · GNU General Public License v3.0