Natural Math

by

Stephen Montgomery-Smith

Mathematics Department
University of Missouri
Columbia, Missouri 65211

stephen@math.missouri.edu
http://math.missouri.edu/~stephen/

July 21 2001

 

Natural Math is a program that takes mathematics written in a natural way and typesets it (using LaTeX). For example, you could create a file test.nat with the lines
        integral from 0 to infinity of e ^ (-x^2/2) dx
        = sqrt (pi over 2)
Then you type
        naturalmath test
which will produce a file test.tex ready for LaTeX to typeset it into a beautiful equation:

This is an image of the above equation when it is typeset

How to use it is described in more detail in the tutorial.

You can try it out from your web browser by connecting to this site.

This program was originally written to help disabled students write mathematics. The advantage of Natural Math over TeX/LaTeX/AMSTeX is that it is easy to learn Natural Math, and easy to type Natural Math with one hand or with a voice dictation system. (The advantage of TeX/LaTeX/AMSTeX is that one has many more options available - Natural Math is not recommended for writing math/science papers.) (Recently it has been pointed out to me that groff has a similar looking interface.)

Natural Math is free software. You may use it under Stephen's version of the Artistic License, or under the GNU General Public License. (See the web page http://www.opensource.org/licenses/artistic-license.html for the original "Artistic License".) I would like to thank the NSF for providing support whilst this sofware was being developed.

The current version of Natural Math is about 0.5. Please email bug reports to me at stephen@math.missouri.edu. Please also tell me about any bug fixes or enhancements you make.

Here are the files required, and the tutor. To run it, you will need Perl version 5 installed on your system. You will also need LaTeX version 2e in order to make use of the output from the program Natural Math. I give some suggestions as to where to get these packages in the instructions below.

The Windows/DOS package consists of the files
naturalmath.pl (the perl script),
naturalmath.bat (the batch file),
tutor.nat (the tutorial),
example.nat (an example .nat file, described in the tutorial),
install.html (installation instructions in html - what you are reading now),
Stephens-Artistic.txt (my version of the Artistic License)
GNU-GPL.txt (the GNU General Public License).

The UNIX package consists of
naturalmath (the perl script),
tutor.nat (the tutorial),
example.nat (an example .nat file, described in the tutorial),
install.html (installation instructions in html - what you are reading now),
Stephens-Artistic.txt (my version of the Artistic License)
GNU-GPL.txt (the GNU General Public License).

(Note that naturalmath and naturalmath.pl are exactly the same.)

Also available is the CGI script naturalmath.cgi that is used at this site.

You can get all of these in compressed format in naturalmath-0.5.tar.gz or naturalmath-0.5.zip.

Optional extras (derived files/directories that need not be distributed with the above files, but still covered by the copyright):
tutor.tex (the tutorial as a LaTeX file),
tutor.dvi (the tutorial as a dvi file),
tutor.ps (the tutorial as a postscript file),
tutor.pdf (the tutorial as a pdf file),
tutor (the tutoral in html).

How to install Natural Math in Windows 9x

The program Natural Math requires two things: Perl version 5, and LaTeX version 2e. If you have these already installed, you are doing great, and you can skip the next few steps.

One place to install Perl from is the web site http://www.ActiveState.com/ActivePerl/. At the time of this writing, it has a version 509, and a trial version 513. I guess that version 509 is the way to go for now. If you are running Windows 95, you should follow the link provided in the above web site to the Microsoft web site http://www.microsoft.com/com/dcom/dcom1_2/default.asp This will provide you with a patch to Windows 95 that is required for ActivePerl.

Installing these programs is a breeze - just click on the executables (do the DCOM1_2 program first), answer a few simple questions (like where you want it installed - if you can't figure out the questions about Explorer don't worry about it), and don't forget to reboot your machine after installing each piece of software.

Next, you need to install TeX. I like miktex, which is available from a large number of ftp sites, the so called CTAN sites. You can get a list of them by searching for CTAN in any search engine. The one I used was ftp://ftp.duke.edu/tex-archive/. After getting to whichever ftp site you want, look in systems/win32/miktex/1.11/ Personally, I would get the basic system, so download the file basic.exe. Also get the file INSTALL.TXT. Probably you should get update.exe also, although I did not mess with it myself. Again installation is a breeze. Double click on the executable. The only trickyish bit is the question about the local TeX repository - I would go for it, perhaps only changing the disk drive name if you are going to install on a different disk than the default. Again, remember to reboot your machine after installing the system. The file INSTALL.TXT. also has some additional instructions which probably are not necessary, but better to be safe than sorry.

Now you are ready to install Natural Math. This is not quite so easy, because I am not a Windows programmer, so I couldn't make a nice slick package. First decide which directory to store the program in. These instructions assume that you chose D:\NATURAL. Put the three files naturalmath.pl, naturalmath.bat and tutor.nat into that directory, as well as the files Stephens-Artistic.txt and GNU-GPL.txt. (To download these files, press the shift key whilst clicking on the link.) If necessary, edit the file naturalmath.bat to reflect the choice of this directory (currently it is set to work for D:\NATURAL).

Next, you need to edit C:\AUTOEXEC.BAT on your computer. It will have some lines in it that look something like:

        path c:\pk204g
        PATH=%PATH%;C:\WSMU\dl;
        SET PATH=D:\TEXMF\MIKTEX\BIN;D:\PERL\BIN;%PATH%
To one of these lines, you should add D:\NATURAL (upper or lower case - it does not matter), for example, to the first line:
        path c:\pk204g;d:\natural
You need to reboot again for these changes to take effect. Now start a DOS command line window. Go to the directory you put Natural Math into by, say, typing
        d:
        cd \natural
Now test Natural Math by typing
        naturalmath tutor
You should get an output something like

        This is Natural Math version 0.2alpha, last modified March 19, 1999.
        These errors were inserted deliberately.
        ^
        Error: what's this: `These' just before line 604
        1 + 2 over (x + yy) - 11.2235 +
                        ^
        Error: what's this: `yy' just before line 580
        (1+2
            ^
        Error: right bracket missing just before line 583
        Created tutor.tex from tutor.nat.
(Don't worry about the error messages - they are deliberately in the tutorial to illustrate errors.)

If you want to run LaTeX, you can do it with the command

        latex tutor
or by the command which will run natural Math and LaTeX in one go:
        naturalmath /l tutor
To view the typeset file, start your previewer program. In the case of miktex you do this by typing
        yap tutor
From here you can print out the tutorial by pressing the print buttons. You may get some error messages indicating that you need to set up the printer in YAP correctly - if so press the appropriate buttons (sorry I cannot help you much more here, but a local computer boffin should be able to help).

In general, you can create any file of type .nat and Natural Math will process it for you. If you think that it is too much to type all of naturalmath, you can change the name of naturalmath.bat to, for example, nm.bat, and now the command to invoke the program will be

        nm filename

How to install Natural Math in Unix

You need to have Perl version 5 and LaTeX version 2e installed on your system. If you don't have these already installed, it will be a little hard for me to give complete instructions, as the different versions of Unix are so, well, different. I use FreeBSD 3.x where this installation is a breeze via the ports collection.

First you need to install Perl version 5. It is very likely that this is already installed. To find out, type

        perl -v
and hopefully it will report that you have a version number something like 5.005_02. If you get an earlier version, or a "Command not found" error, you will need to install Perl version 5. Look in http://www.perl.com/pace/pub/perldocs/latest.html to find information. (On FreeBSD 2.x install from /usr/ports/lang/perl5.)

Again, it is very likely you have LaTeX installed. Otherwise, it is available from a a large number of ftp sites, the so called CTAN sites. You can get a list of them by searching for CTAN in any search engine. The one I used was ftp://ftp.duke.edu/tex-archive/.

The distribution I used was teTeX, which has everything. After getting to whichever ftp site you want, look in systems/unix/teTeX/. (On FreeBSD install from /usr/ports/print/teTeX.)

Now you are ready to install Natural Math. Put the file naturalmath anywhere where you put executables (for example /usr/local/bin, or $HOME/bin, $HOME is your home directory). Find out where your perl is installed with the command

        which perl
and edit the top line of naturalmath appropriately (now it assumes that perl is in /usr/bin/perl). You also need to make sure that the file naturalmath is set to be executable:
        chmod +x /whereeveritis/naturalmath
where /whereeveritis is the location where you have put the file naturalmath.

Next, get the file tutor.nat. You may want to put this in some place where you put other document files. You should also get the files Stephens-Artistic.txt and GNU-GPL.txt, and put them somewhere easy to find.

Now test Natural Math by typing

        naturalmath tutor
You should get an output something like

        This is Natural Math version 0.2alpha, last modified March 19, 1999.
        These errors were inserted deliberately.
        ^
        Error: what's this: `These' just before line 604
        1 + 2 over (x + yy) - 11.2235 +
                        ^
        Error: what's this: `yy' just before line 580
        (1+2
            ^
        Error: right bracket missing just before line 583
        Created tutor.tex from tutor.nat.
(Don't worry about the error messages - they are deliberately in the tutorial to illustrate errors.)

If you want to run LaTeX, you can do it with the command

        latex tutor
or by the command which will run natural Math and LaTeX in one go:
        naturalmath -l tutor
To view the typeset file, start your previewer program. For example
        xdvi tutor
To print the file, use your local dvi printer program, which might be
        dvips tutor
or
        dvips tutor -o!lpr
In general, you can create any file of type .nat and Natural Math will process it for you. If you think that it is too much to type all of naturalmath, you can change (or link) the name of naturalmath to, for example, nm, and now the command to invoke the program will be
        nm filename