Math Typesetting for the Internet

Guidelines for Using ASCII
to Write Mathematics

Table of Contents || Math in Email || Math on the Web

What is ASCII, and why is it important?
ASCII is an acronym for American Standard Code for Information Interchange - all printable characters on your keyboard (including the shift characters) are part of ASCII. This set of characters is recognized by nearly all computers - so if you want to share information with the broadest possible audience, you need to use ASCII.

Writing mathematical expressions with ASCII is appropriate if you want to talk about math in an email message, or in a web form, or whenever you are restricted to the use of only standard characters. In any of these cases, you can't be sure how other people might view your text - but you can count on everyone being able to read what's written in ASCII. This notation is also helpful if you want to include math in a web page using only standard HTML code, which falls short in supporting math typesetting.

Guidelines for Using ASCII Math Notation
Writing mathematics on a piece of paper is easy - writing mathematics with ASCII is somewhat harder. If you're aware of a few important rules, though, you can help other people accurately interpret your math notation.

  • Fractions
    Say you want to write ASCII mathematical notation for the fraction "1 over 2x" - what do you do? Here are two acceptable ways to do it:
     a)     1                   b)     1/(2x)   
    Both a) and b) are correct, but it's easier to work with b) if you want to include the notation within the body of a paragraph (because it sits on a single line of text). If you do write fractions like the one in b), though, you have to be careful about putting parentheses in the right place. Here's an example of what can go wrong if you don't use parentheses:

     c)     1/2x     BAD FORM!
    Don't write fractions like the example in c)! You might mean "1 over 2x" but c) could also be interpreted as "one half x" - and these are not the same. Note: brackets can also be used, in lieu of parentheses.

  • Exponents
    How should you represent "x squared plus x to the 5y-th power" in ASCII? Here are two correct ways to do this:
     a)      2    5y            b)     x^2 + x^(5y)           
            x  + x
    Again, if you decide to write the entire expression on one line (like in b)), and you can forsee any possible confusion over the exponent, you MUST use parentheses to indicate what the exponent is.

  • Roots
    The most common way to write a square root symbol with ASCII is like this:
     a) "the square root of x"    can be written  Sqrt(x)
    Since there's no easy way to write cube root symbols (and higher) in ASCII, it's best to express your root as a power. For instance:
     b) "the cube root of seven"  can be written  7^(1/3)
    In general, you will be able to use ASCII to write any root if you remember the fact that
    'the y-th root of x' = 'x to the 1/y-th power'

  • A Note about Tabs and Spacing
    Following is an example of how to write out long division with ASCII.
     100 ) 34700

    The trick to getting ASCII math notation to look nice is mostly a matter of spacing, especially when your expression takes up more than one line of text (like the example above). It's important to use the space bar to line up text, NOT tab. The number of spaces equal to one tab varies from computer to computer, so what might look nice to you could be way off the screen for someone else.

  • Still not sure?
    More Examples of ASCII Math Notation
    Example: Pictures with ASCII

    ASCII Notation for an Online Calculus Tutor
    More guidelines for ASCII math notation, written by Karl Hahn.

    What is the correct order of operations?
    An item from the Ask Dr. Math FAQ.

[Privacy Policy] [Terms of Use]

Home || The Math Library || Quick Reference || Search || Help 

© 1994-2014 Drexel University. All rights reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.The Math Forum is a research and educational enterprise of the Drexel University School of Education.