Use batchmode in latex_to_png_dvipng

Latex is running into some unrelated error on my system, and making an
unseen prompt for output, which results in a test hanging. This turns
the hang into a failure.
Merge pull request #6492 from takluyver/latex-batchmode

Use batchmode in latex_to_png_dvipng