I want my program to read a mathematical expression from standard input and print a bitmap with the expression formatted similarly to how Latex does this. Input is limited to simple expressions, that is, consisting of arithmetic operators, subscripts, superscripts and fraction bars.
For now, the program can interpret an expression and store it as a tree. The only problem I do not know how to solve is how to divide a plane into sections/boxes in order to print the expression on a bitmap properly. The biggest problem is with subscripts, superscripts (downscaling and placing symbols higher or lower), fraction bars and the fact that it has to work well recursively for example abcd
I would be grateful for an answer. I have tried to find a similar problem on the web, but nobody seems to have asked a question like this before.