I've configured my xelatex for shell escape (to use tikzexternal), but can I use it to run an arbitrary shell command at the end of compilation? How do I pass it the command to run from inside my .tex document?
I'm trying to use imagemagick mogrify to batch convert figures to jpg (for some reason all the versions of doing that as part of the tikzexternal process like this have failed, they produce a bunch of pdf files, but never any jpg.) Using mogrify from the shell works fine, so I'm hoping to be able to do it as a custom shell escape to automate it.
Edit: \write18{blah} passes "blah" to the shell. Be careful that the PATH may be different there than from an actual shell started outside latex, resulting in possible errors.
\write18, and the "weird messages" you got. – muzimuzhi Z Nov 22 '20 at 18:11