I'm trying to create a shell script which converts latex-formulas to svgs. I want to use latex and dvisvgm.

But I want to use as few tempfiles as possible.

Is there a way to make latex write the dvi file to stdout?

I haven't found a corresponding option in the manpage, but is there maybe a general "shell way" of redirecting output that is supposed to go to a file to stdout?

  • 3
    What's the issue with the temporary files?
    – Kusalananda
    Jan 11, 2022 at 14:45
  • 2
    tex.stackexchange.com may be also relevant. But as far I know it is not possible (OTOH there are many "latex" engines). And latex will create various temporary file (for indices, toc, etc), so at the end, your efford may be just for nothing Jan 11, 2022 at 15:03
  • 1
    Possibly relevant answer on the TeX SE site: tex.stackexchange.com/a/11526
    – Kusalananda
    Jan 11, 2022 at 15:56

1 Answer 1


As LaTeX really creates copious amounts of temporary files anyway, you can't win anything here.

Also, outputting to stdout whilst suppressing the usual output to stdout would require changing things in the TeX core. That won't happen, so I'm afraid what you want is impossible.

I'm trying to create a shell script which converts latex-formulas to svgs.

For formulas only, there's relatively mature options that offer you a server that does that. Look into katex.org. The advantages would be speed and security (honestly, --write18 is probably disabled for you, anyway, but LaTeX is really not a piece of software I'd consider "safe for untrusted user input", not even "securable", without basically writing your own restricted TeX parser, which then as well might get a small rendering add on itself...).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .