Update writeImage to also output a .tex file for inclusion

It should be backwards compatible since the new arguments are all
optional and the new file can just be ignored.  I could add arguments to
not output the tex file and to set the path in it to the image.