# Software to render formulas to ASCII art

I guess all computer algebra systems have command line interfaces which render formula as 2D monospace "ascii art". But the only standalone tool to render TeX to 2D I know is tex2mail (comes with PARI/GP).

Are there other standalone programs or libraries for that task, preferably making advantage of various Unicode symbols? Or maybe there is a CAS capable for that.

FriCAS:

            ┌──┐
x   \│%A
┌┐  %e
│   ─────── d%A
└┘       2
%A


tex2mail:

         +-+
,- \|x   2
| e    /x    dx
-'


Maxima:

     /   sqrt(x)
[ %e
I --------- dx
]     2
/    x


Those are meant to represent:

$$\int \frac{e^{\sqrt x}}{x^2} \, dx$$

-
I have to ask... why?? –  Asaf Karagila May 24 '12 at 17:45
Because it's BOSS! –  Thomas Eding May 24 '12 at 18:02
@AsafKaragila mostly to output a formula to console. –  Yrogirg May 24 '12 at 19:09
I see. Thank you for the answer. If I had to choose between the above examples or a very complicated $\TeX$ code, I'd choose the $\TeX$. That's just me, though. –  Asaf Karagila May 24 '12 at 19:14
I think that the console version of Maple also can do such things, but I am not 100% sure. –  dtldarek May 24 '12 at 19:36

I've edited a bit tex2mail to use Unicode for output. Here are the results:

                                      ┌──────┐
┌─┐  3                   4  │     2     6      4
⌠   \│a  x         ┌─┐     3 x  \│1 - x   + x  - 3 x
⎮  ───────── dx = \│a  ──────────────────────────────────
⌡   ┌──────┐                          ┌──────┐
│     2            ⎛    2      ⎞  │     2      2
\│1 - x             ⎝ 3 x  - 12 ⎠ \│1 - x   - 9x  + 12

⎡     1 ⎤n
lim           ⎢ 1 + ─ ⎥  = e
n  --> oo ⎣     n ⎦

n       n
⌠1  x     ──┐oo   ⌠1 x (log x)
⎮  x dx = >       ⎮  ──────────   dx.
⌡0        ──┘n=0  ⌡0     n!

┬─┬oo ⎛   1  ⎞   ⎛ ┬─┬oo   1   ⎞-1           1            1     6
│ │   ⎜ 1-── ⎟ = ⎜ │ │   ───── ⎟   = ───────────────── = ──── = ──  ≈ 61%
┴ ┴p  ⎜    2 ⎟   ⎜ ┴ ┴p     -2 ⎟         1    1          ζ(2)    2
⎝   p  ⎠   ⎝       1-p   ⎠     1 + ── + ── + ∙∙∙          π
2    2
2    3


The look depends hugely on the fonts and the browser. If you are interested in the script here is the link.

-
As long as you're using Unicode, why not also replace oo with ∞, --> with →, and so on? You might also consider using Unicode's sub- and superscripted characters whenever possible to save vertical space. –  Rahul Jun 9 '12 at 20:22
@RahulNarain Well, --> should be ⟶, not →. However the space occupied by ⟶ depends on the font and the renderer, which can ruin the formatting. Same story with many others characters, even with ⊗. For my taste is ∞ is too small compared to oo. Well, it is ubelievebly easy to make such substitutions. If one wants he may do it, however the results might not be good. –  Yrogirg Jun 9 '12 at 20:24
@RahulNarain As for the sub and superscripts, I just think that they are small and poorly readable. Anyway, implementing this is beyond my Perl skills. –  Yrogirg Jun 9 '12 at 20:32