Wednesday, December 14, 2011

Quick LaTeX Equation Examples for use by programmers on windows, convert to PNG

LaTeX/TeX is a complex documenting system that is mostly used in a academic setting but can also be used by anyone to convey information.  It is a complete system but a massive system that has been in development for decades so it isn't something that you skim over and become fluent in.  But I did want to provide some full setup scripts so you can add write an equation and add an image of that equation or pseudo code to your blog or word documents.

Install Cygwin and tetex

You can install all of the tex software through cygwin.  Use the cygwin easy click through install wizard.  Select all of the Publishing/tetex*  applications.

1.1 Install of tetex through Cygwin setup
Install Cygwin, make and gcc and vim

gcc and make aren't required for tetext but I use a make script to run tex.  Install gcc and make through the cygwin installer.

Download my make script and example tex files

There are several makefiles on the Internet for running tex files into tex and then converting them into some output.  Download the Makefile that I have in my link and you can simply type 'make' in a directory that has a collection of tex files.

1.2 At directory, see makefile, launch cygwin and run 'make' at a directory with tex files

Write a simple equation and convert to PNG

You will need to follow a three step process to in order to add an equation or pseudo image to your blog; write the equation in vim, execute the provided makefile, run the dvigif command.  Enter this equation using vim.

1.3 Equation in vim

1.4 Running 'make' and then dvigif command

dvigif --png -T'6.6in,7in' b.dvi

1.5 PNG image output after running make build on tex  files and the dvigif command
1.6.a Tex source with various equations and pseudo code

1.6.b Output PNG image from tex source defined in figure 1.6.a
1.7 Source with pseudo code
1.7.b Output from pseudo code
Additional Resources

[1]. Example Source -




Tested with:


CYGWIN_NT-5.1 1.7.9(0.237/5/3) 2011-03-29 10:10 i686 Cygwin

TeX 3.141592 (Web2C 7.5.4)

"The extreme Cerebral differs from other types chiefly in the fact that while his head is unusually large compared to the body, his alimentive, thoracic, muscular and bony systems are smaller and less developed than the average. The latter fact is due to the same law which causes the Alimentive to have a large body and a small head. Nature is a wonderful efficiency engineer. She provides only as much space as is required for the functioning of any particular organ, giving extra space only to those departments that need it."

--- Berlin Brown

No comments: