dvi2bitmap
is perfectly happy reading DVI
files from a pipe, so that
will work perfectly well. Since the program knows that the standard input -- indicated by thecat myfile.dvi | dvi2bitmap --pipe -
-
argument to dvi2bitmap
--
is not seekable, the option --pipe
is actually
redundant. This is not by itself particularly useful, since
TeX is not written to send its DVI output into a pipe.If, however, you make a `named pipe' beforehand, using the Unix
mkfifo
command (a FIFO, or first-in-first-out, is the
other name for such an object), then TeX can be persuaded to send its
output there.
Here, we create the FIFO using the% mkfifo myfile.dvi % ls -l myfile.dvi prw-r--r-- 1 norman admin 0 Aug 12 00:18 myfile.dvi % latex myfile >myfile.stdout & % dvi2bitmap --pipe mkfile.dvi
mkfifo
command; looking at it, we see that the first character on
the ls
line is a p
, indicating the
type of object it is. We start (La)TeX going in the
background (achieved by the &
), putting its
chatty output into a file, and it merrily writes into the
`file' myfile.dvi
. Immediately afterwards
(we've shown this on two lines, but the two commands could
be run together with only the &
separating
them) we start dvi2bitmap
, telling it to read
from the named pipe. The pipe effectively synchronises the
two processes, so that if there is nothing to read,
dvi2bitmap
is briefly suspended, and if the
pipe is full, LaTeX is suspended. After this performance,
the DVI file, myfile.dvi
ends up zero size
again, and the process can be repeated.You can go further than this, and use a FIFO for LaTeX's input, too:
(the trailing backslashes indicate that this second set of commands is all on one line). The rather odd form of LaTeX invocation (note the quotes) stops TeX from peeking at the file, looking for the magic% mkfifo myfile.tex myfile.dvi % cat foo.tex >myfile.tex & \ latex '\input myfile.tex' >myfile.stderr & \ dvi2bitmap --pipe myfile.dvi
%&
line which
can tell it which format to use; since the input is a pipe,
it's unseekable, so we must use this form, or else LaTeX
fails.