Skip to content

Repository files navigation

TeXicode, short for TeX to Unicode, a CLI that turns TeX math expressions into Unicode art.

Post math in Reddit/Discord/Teams or anywhere that supports code blocks. No more LaTeX screenshots or markdown exponents that don't work. Also useful for inserting single line equations into literally any text field.

Quick tutorial for Reddit
  1. Visit the TeXicode website, copy output to clipboard
  2. Make a new line in Reddit text field (check line spacing, if there is no line spacing above and below the cursor, it means Reddit does not see it as a separate line) Reddit1.png
  3. Add code block Reddit2.png
  4. Paste Reddit3.png If the output from TeXicode is a single line, can be placed inline using Code instead of Code Block

CLI

Install

pipx install TeXicode

Basic Usage

  • txc '\LaTeX' to output Unicode art
    • wrap TeX equation inside single quotes
    • escape expression like f'(x) with f\'(x)
    • \[ \], \( \), $ $, $$ $$, \begin{...} \end{...} is optional
  • options:
    • -h, --help show help message and exit
    • -d, --debug enable debug
    • -m, --markdown treat input as Markdown: find and replace math blocks
    • -f, --file treat input filename
    • -c, --color enable color (black on white)
    • -n, --normal-font use normal font instead of serif
  • unsupported commands will be rendered as ?, or raise an error. If you see these or other rendering flaws, please post an issue, most can be easily fixed.

Rendering Math in Markdown

  • txc -mf foo.md to input a markdown file and replace math blocks with Unicode art.

  • pipe into a markdown renderer like mdflow for complete terminal markdown preview:

Here is example.md rendered with txc -mfc example.md | mdflow, in the JuliaMono font.

Screenshot

Features

  • supports most LaTeX math commands
  • uses Unicode
    • not limited to ASCII characters
    • Unicode italic glyphs are used to differentiate functions from letters, similar to LaTeX
  • works with any good terminal font
    • does not use any legacy glyphs
    • go to src/arts.py, comment/uncomment some parts if your font support legacy glyphs to get even better symbols (actually you can't do that no more i removed the comments...)

About

TeXicode - TeX to Unicode, a Unicode TeX renderer that renders TeX into Unicode by rendering the TeX

Topics

Resources

Stars

62 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages