GPLv3 Licence. Overhaul optional arguments system. Add latex output mode.