Matt's MathTools: OpenSource Java Software
Matt's MathTools is an opensource Java program designed to help math teachers design math tests and worksheets. There are six basic parts: the core tools, the helper tools, the demo panels, the utilities, the graph paper generators and the scripting environment.
At its heart, MathTools is a textgeneration package. It is designed around OpenOffice, MathML, LaTeX, HTML and SVG. It is by no means limited to these, though, and it can handle any type of textbased mathematical formatting. It does this by defining mathematical things, such as polynomials, fractions and matrices, and manipulating them as mathematical objects and NOT as floatingpoint approximations. Fractions, for instance, are handled as numeratordenominator; the individual parts are tracked separately and may be combined and formatted as desired.
Matt's MathTools is released under the Apache license by default and it is totally FREE!!
Software
Matt's Writing Tools: These are what I use
These are the tools I use for writing and formatting my books. Each of these programs is opensource, which means freedom, but they're also FREE in terms of price. Besides that, they work much better than most commercial software! And they're FREE!

OpenOffice / LibreOffice  This is simply the BEST office suite available. The package contains a word processor, spreadsheet, database, presentation graphics and an awesome textbased math formatting editor!

calibre Ebook managment  This handy program can read in an OpenOffice document and format it into .mobi and .epub, along with an impressive list of others. It has tons of other formats too, and at least three tons of other options.

Scribus  This is a desktop publishing program and it is a MONSTER! There are hundreds of ways to format a page with absolute granularity. There is a bit of a learning curve but not a bad one. I use it for generating paperback cover PDFs.

The GIMP  This is the GNU Image Manipulation Program. It's an incredible image creation and editing tool. I use it occasionally for tweaking colors for my book covers, but if you're an artist, the GIMP is a treasure!