Fix citation2latex for Python 3
Fix pylabtools test for Python 3
Merge pull request #4168 from takluyver/py3-failing-tests

Fixes the failing tests revealed by #4165.