/!\ this is a first draft
Here are some hints about the whole design :
Mathmaker creates Sheets of maths Exercises. Each Exercise contains Questions. Each Question uses specific objects and fields, that embbed enough information to write the text of the Question and also the answer. The informations embedded by these objects are independant from the output format. For instance, a Question about Pythagora's theorem would embed an object RightTriangle (which itself embeds information on its sides' lengths for instance ; and enough information to create a picture of it) but also fields telling if the figure should be drawn in the Question's text or if only a description of the figure should be given ; if the hypotenuse should be calculated or another side ; if the result shouldn't need to be rounded (either integer or decimal) ; if the result should be a rounded decimal and how precise it should be rounded etc. When a new Sheet is created, all objects it contains are created randomly (following some rules, though...).
The "Machine" object can be seen as a typewriter : it takes the mathematical objects and turns them into the output format (LaTeX, so far) ; it draws figures from the geometrical objects (using eukleides) etc. The Sheet object given to a Machine is a guideline for the Machine to type what is expected on output.
So, the main executable, mathmaker, just creates a (LaTeX) Machine and let it "type" the sheet the user is asking for (given in parameter).
All content created by mathmaker is written in stdin (except debugging informations, which are written in stderr)
Some details before diving into core :
mathmaker.cfg contains some variable the user might like to change easily without having to dive into the code
lib contains various methods and variables
locale contains all stuff related to internationalization (here are the po files to edit with poedit)
the maintenance directory contains anything related to debugging and to tests.
--> Turn ENABLED to True in debug.py will let mathmaker write debugging informations to stderr. The methods that give output informations can be chosen among the different variable below (into_str_in_item, into_str_in_product etc.). All objects have a special (small) method called dbg_str() which is used to clearly identify the objects and their classes. (I can see in your snip : {+1^.1.} and {-0^.1.}, which represent Item(1) and Item(0), so there was some debugging stuff enabled there)
--> The autotest-mathmaker executable in the main directory uses the tests present in maintenance/autotest
These tests have been written either before writing the code (unit tests) or after a bug has been found.
Some uses of autotest-mathmaker :
Now, here are some details about the core :
I should certainly also update the documentation (I use doxygen), this would be of help...