Enteropia The bright side of me Skip to content * Home * About ? SklogWiki Rubber and Rubber Balloons: Paradigms of Thermodynamics ? ASCII-art Math Posted on June 9, 2012 by Yrogirg Many of computer algebra systems date back to the times when GUI machines were rare and expensive, if were present at all. Thus command line was a standard interface. Unfortunately text terminal doesn?t fit very well for displaying mathematical expressions which demand for rich typesetting. To represent math formulas CAS?s resorted to some kind of ASCII art: inf 1 ==== / n n \ [ x log (x) > I ---------- dx / ] gamma(n x) ==== / n = 0 0 That?s the output of Maxima. Some of the systems went further and don?t restrict themselves to plain ASCII. Axiom can produce such a nice output: 2 x - %A ???? ?? %e \?%A ? ???????????? d%A ?? tan(%A) + 2 Even now most CAS?s retain command line interface, for example Mathematica 8?s terminal session: In[14]:= Pi*(a+b^2/(Exp[12]+3/2 ">2)) 2 b Out[14]= (a + -------) Pi 3 12 - + E 2 The same technique was also spread in Usenet see whim.org for a collection of notes some of which appeared at sci.math. I was even able to find ?Guidelines for Using ASCII to Write Mathematics?. If you are looking for a standalone application to render LaTeX to ASCII the only one I?ve found is tex2mail, more than a decade old Perl script. Much water has flowed under the bridge since then and old character encodings were replaced by Unicode, namely UTF-8. Unicode provides lot?s of math-related symbols and naturally one wants to employ this abundant to allow for prettier output of math formulas in terminal. I?ve tried to enhance tex2mail by turning it to tex2unicode. To some extent I?ve succeeded: ???????? ??? 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 Unfortunately things turned out to be more complicated with other LaTeX commands. The problem is that some symbols like ??? should be wider than others. It undermines the whole concept of monospace formatted output. To make things worse the output depends both on the font and the software. Gedit and gnome terminal treat the same string differently. Actually the only reliable symbols to enrich ASCII art are form box-drawing Unicode block. Making a long story short. Since I don?t really need a full featured LaTeX-to-Monospace-Unicode renderer, I?ll just post what I did by now: TeX2Unicode Perl script If you are not content with certain LaTeX commands, for example ?\otimes? or ?\to? it is really easy to improve them. So don?t hesitate and adjust it for your needs. The license is whatever it was for tex2mail.in file in PARI/GP project, where I took it from. I guess it is GPLv2. Advertisements Share this: * Twitter * Facebook * Like this: Like Loading... Related This entry was posted in Math and tagged ascii-art, math, tex2unicode. Bookmark the permalink. ? SklogWiki Rubber and Rubber Balloons: Paradigms of Thermodynamics ? 7 Responses to ASCII-art Math 1. [31b] Sam Alexander says: June 10, 2012 at 08:30 Those are really beautiful, very nice work :) Having grown up browsing sci.math, ASCII math seems like the most natural thing in the world to me, and I can hardly imagine ASCII math *not* being part of a mathematician?s arsenal: how do you write emails to colleagues without ascii math? Reply 2. [e6e] Joseph Nebus says: June 10, 2012 at 08:49 Reblogged this on nebusresearch and commented: I had forgotten the challenges of doing more than the most basic mathematics expressions in ASCII art, and had completely forgotten there were tools that tried to make it a bit easier. Enteropia here?s put forth a script which ought to make it a bit easier to go from LaTeX into an ASCII representation, and I have the feeling I?m going to want to find this again later on, so I?d best make some kind of link I can locate when I do. Reply 3. [752] The S I says: June 21, 2012 at 09:41 Very interesting stuff! Reply 4. [100] wahrsagevogel says: September 24, 2013 at 10:57 The link for the script is dead, could you provide a new one? Thank you! Reply + [bcf] Yrogirg says: September 25, 2013 at 08:47 Done, though quickly, so check if it actually works, not sure that was the right version. Reply 5. [dc4] univerio says: October 28, 2014 at 06:57 Unfortunately the link is dead again. Could you perhaps post it to GitHub? Reply + [bcf] Yrogirg says: October 29, 2014 at 09:40 You can try the link again. Reply Leave a Reply Cancel reply Enter your comment here... [ ] Fill in your details below or click an icon to log in: * * * * * Gravatar Email (required) (Address never made public) [ ] Name (required) [ ] Website [ ] WordPress.com Logo You are commenting using your WordPress.com account. ( Log Out / Change ) Google photo You are commenting using your Google account. ( Log Out / Change ) Twitter picture You are commenting using your Twitter account. ( Log Out / Change ) Facebook photo You are commenting using your Facebook account. ( Log Out / Change ) Cancel Connecting to %s [ ] Notify me of new comments via email. [ ] Notify me of new posts via email. [Post Comment] * Search for: [ ] [Search] * Recent Posts + Rubber and Rubber Balloons: Paradigms of Thermodynamics + ASCII-art Math + SklogWiki + Why Does a Tiger Have Stripes and a Lion Doesn?t? + Categories for the Practising Physicist * Archives + March 2013 + June 2012 + January 2012 + December 2011 + October 2011 + September 2011 + June 2011 + April 2011 + March 2011 + January 2011 * Categories + BZFlag + FriCAS + Haskell + Math + Physics + Tips * Blogroll + Alasdair's musings + Azimuth Blog + Azimuth Project + Do the Math + The Standing Invitation + Xamuel.com * Locations of visitors to this page profile for Yrogirg on Stack Exchange, a network of free, community-driven Q&A sites Advertisements * Meta + Register + Log in + Entries RSS + Comments RSS + WordPress.com Enteropia Blog at WordPress.com. [Close and accept] Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use. To find out more, including how to control cookies, see here: Cookie Policy %d bloggers like this: [b]