0

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.

1
  • Show how you used \write18, and the "weird messages" you got. – muzimuzhi Z Nov 22 '20 at 18:11
0

If I understand correctly, you want to run a custom command from your editor. Your .tex file does no command calling, it has to be donde "externaly" as in, you can do it manually from the terminal, or you can do it from your editor (TeXMaker, TeXStudio, etc).

The way to define this custom command depends on what editor you are using.

For example, TeXMaker (what I use) lets you define personalized command orders, as if you were to run it from the command line, and all you have to do to run it is press Alt+Shift+F1,F2,F3,F4,F5, depends on which key you configure it.

What editor are you using?

1
  • Thanks, but that's actually not what I want. If you look at the link I provided, they edit the tikz style to run a custom convert command. That implies there's a way to pass a shell command from the .tex directly. For some reason doing it from tikz fails on my system, but there has to be a more general way to do it. – Alexbib Nov 22 '20 at 17:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.