The texo command is like the echo command for
If kitty graphics are not enabled in your terminal, the default behavior will be to translate the expression to unicode. For example:
% echo 'a_1x^2' | texo
a₁x²Otherwise, the output will be an actual image of the expression, rendered in the terminal:
% echo 'a_1x^2' | texoThe entire program is texo.lhs, a literate Haskell file. The prose is the documentation and the > lines are the source: GHC compiles the file directly (tangle), and pandoc typesets it (weave).
nix build # tangle: ./result/bin/texo
echo '\pi r^2' | nix run . # or run it directlyFor hacking, nix develop drops you into a shell with ghc, latex, dvipng, and pandoc, where:
ghc -O2 texo.lhs -o texo # tangle by hand
pandoc -f markdown+lhs texo.lhs \
--pdf-engine=xelatex -o texo.pdf # weave the essayThe weave needs xelatex because the source is full of Unicode that pdflatex can't handle. The monofont: JuliaMono line in the file's YAML header matters too: the source contains characters like ₐ, ⁿ, and 𝔸, and JuliaMono is one of the few monospace fonts that has glyphs for all of them (brew install --cask font-juliamono).