latex: lots of stuff (sorry for huge commit)
latex: use CodeExample where possible