$$ \usepackage{amssymb} \newcommand{\N}{\mathbb{N}} \newcommand{\C}{\mathbb{C}} \newcommand{\R}{\mathbb{R}} \newcommand{\Z}{\mathbb{Z}} \newcommand{\ZZ}{\ooalign{Z\cr\hidewidth\kern0.1em\raisebox{-0.5ex}{Z}\hidewidth\cr}} \newcommand{\colim}{\text{colim}} \newcommand{\weaktopo}{\tau_\text{weak}} \newcommand{\strongtopo}{\tau_\text{strong}} \newcommand{\normtopo}{\tau_\text{norm}} \newcommand{\green}[1]{\textcolor{ForestGreen}{#1}} \newcommand{\red}[1]{\textcolor{red}{#1}} \newcommand{\blue}[1]{\textcolor{blue}{#1}} \newcommand{\orange}[1]{\textcolor{orange}{#1}} \newcommand{\tr}{\text{tr}} \newcommand{\id}{\text{id}} \newcommand{\im}{\text{im}\>} \newcommand{\res}{\text{res}} \newcommand{\TopTwo}{\underline{\text{Top}^{(2)}}} \newcommand{\CW}[1]{\underline{#1\text{-CW}}} \newcommand{\ZZ}{% \ooalign{Z\cr\hidewidth\raisebox{-0.5ex}{Z}\hidewidth\cr}% } % specific for this document \newcommand{\cellOne}{\textcolor{green}{1}} \newcommand{\cellTwo}{\textcolor{red}{2}} \newcommand{\cellThree}{\textcolor{brown}{3}} \newcommand{\cellFour}{\textcolor{YellowOrange}{4}} $$

My first program in the AUR


Luca Leon Happel


March 28, 2020

Recently I discovered some more of the incredibly useful features of my favorite text-editor Neovim:

Entering :read !somefunction in Neovim causes the editor to execute the command somefunction and then insert the echoed response into the file you are currently editing at your cursor position.

This got me thinking… Maybe I could use this to make my programming more concise. And after installing figlet I was proven right:

# Use `:read figlet "Example"`
#     and then select the output and comment it out: `:'<,'>norm ^i# `
#  _____                           _
# | ____|_  ____ _ _ __ ___  _ __ | | ___
# |  _| \ \/ / _` | '_ ` _ \| '_ \| |/ _ \
# | |___ >  < (_| | | | | | | |_) | |  __/
# |_____/_/\_\__,_|_| |_| |_| .__/|_|\___|
#                           |_|
echo "It works!"

And after all this thinking I was stuck with an idea, which I had for quite some time already, but never really knew how to implement in vim:

I can use this, to show complex math formulas in programs, as actual math formulas {: text-align: center}

The problem however was, that no package I searched for seemed to provide the ability to render math formulas as ASCII / ANSI / Unicode. And therefor I just set out to create my own program:


The programming was the easy part. Just write a python script that internally parses expressions using SymPy and then pretty prints them. But publishing this program with none more than ~50 lines of code was a real pain.

  1. Publish to GitHub
  2. Create an account on https://aur.archlinux.org
  3. Use my .ssh/config
  4. Generate an ssh key: $ ssh-keygen -f ~/.ssh/aur
  5. Clone your future repository: git clone ssh://[email protected]/your_package_name.git
  6. Put your PKGBUILD in there
  7. Add, Commit, Push
SSH Configuration
$ cat .ssh/config
Host aur.archlinux.org
User aur
PreferredAuthentications publickey
IdentityFile ~/.ssh/aur

And after all this struggle, which even drove me to reddit because I had no clue anymore on what to do, I was able to install my package using the AUR:

yay -S prettymath-git

What does it do?

After having installed prettymath-git, you can do stuff like this:

before prettymath

import math

def normalDistribution(x):
    return 1/sqrt(math.pi)*math.e**(-x**2)

after prettymath (:read !prettymath -u "1/sqrt(pi) * e**(-x**2)"; :norm ^i#)

import math

def normalDistribution(x):
    #    2
    #  -x
    # e
    # ────
    #  √π
    return 1/sqrt(math.pi)*math.e**(-x**2)