# What is “TeX daemon” and why and how is it used?

Recently I've come across a question that asks about "TeX daemon" for Windows.

I always thought that nature of TeX is compilation of document sources. Why would anyone use a daemon for that?

So, what is a "TeX daemon", and why is it used?

-

It can have all kind of uses.

One of the answers to the question you refer to shows an example: for one particular document, you can precompile the preamble and have the daemon run in the background, waiting for the document body to be modified, thus accelerating the usual edit-compile-preview cycle.

A variant of this is the ability to preview the result of your TeX source as you type it, such as is provided by the `preview-latex` package for Emacs; but I don't think it uses a daemon.

Another example is given by this other answer to the same question: you use TeX as a web service. Of course you could run a new instance of TeX for each request and send the result back to the user, but a daemon is much more appropriate for that. It's not different in nature from a hypertext preprocessor.

The ConTeXt distribution contains a script that is a variant of the latter example: it uses LuaTeX to typeset font samples and to show the effect of the different OpenType features for each font you have installed. In fact, the script runs the web server itself, as it is written in Lua, while the actual typesetting of the font samples is of course done in TeX. Now, there is no actual daemon here (apart from the web server), we need a new process for each new sample, but this is exactly the kind of use a TeX daemon could have.

I can't think of other uses right now, but I'm sure there are.

-
+1 This gives a good overview, though I would notably add it's also used for preview functionality in emacs and such. –  Noldorin Aug 5 '10 at 12:35
Added, thanks Noldorin. But in fact I've done nothing but paraphrasing your question, I feel :-) –  Arthur Reutenauer Aug 5 '10 at 12:50
Heh, well consolidating the information can't hurt though. :) –  Noldorin Aug 5 '10 at 12:54

There's also the "original" TeX-Daemon: It uses a program `dvichop` to create a new dvi document every time the document is recompiled, which can then be displayed. That approach works only with dvi, though.

-
I just saw your 4.999 points and decided to upvote one of your decent answers. –  Keks Dose Jan 30 '13 at 9:30