Backport PR #6492: 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.