After improvements from Karl (previous commit), some other changes:
1) Lines 132-134: I placed those framed boxes within \marginpar to avoid line breaking (I've cheated a little with dimensions there, but I think it won't harm. What you think?)
2) Line 145: "...overlaps the text at its right" instead of "to the right" (not sure if this is a good change).
3) Lines 208 and 210: removed in order to free some space (no need for so many steps).
4) Line 237: I've just added an "almost" to the non-zero depth of the figure: "has depth zero (almost)".   ;-)

It now requires Linux package texlive-publishers:
sudo apt-get install texlive-publishers