Call LaTeX on a named pipe (fifo)?

I am running LaTeX over a named pipe fifo on Unix. I create a fifo like this:

$ mkfifo fifo

      

Then I start LaTeX like this:

$ latex fifo

      

This process blocks and never exits until I write to fifo from another shell:

$ echo "\\end" > fifo

      

Then the output of $ latex fifo becomes:

This is pdfTeXk, Version 3.1415926-1.40.9 (Web2C 7.5.7)
%&-line parsing enabled.
entering extended mode

      

However, the LaTeX process never ends. How can you finish LaTeX? I tried sending it to chr (0) and chr (4) (i.e. Ctrl-d) but doesn't work. Is there any command that will tell LaTeX to exit (i.e. Something like \ exit)?

Thanks for reading.

EDIT

It should be noted that when you run tex instead of the latex variant then it works as expected:

$ echo "story\\end" > fifo

      

(so far in the tex console)

$ tex fifo
This is TeX, Version 3.1415926 (Web2C 7.5.7)
(./fifo [1] )
Output written on fifo.dvi (1 page, 212 bytes).
Transcript written on fifo.log.

      

However, although Leslie Lamport notes in the LaTeX Document Preparation System on page 233 that \ end has been replaced with \ end {document}, none of the following ends with a LaTeX session:

$ echo "\begin{document}story\end{document}"
$ echo "\\begin{document}story\\end{document}"

      

+2


source to share


2 answers


I would suggest that your shell route the fifo pipe to standard.

latex < fifo

      

When I do that, I first get this output:



This is pdfeTeXk, Version 3.141592-1.21a-2.2 (Web2C 7.5.4) (format=latex 2009.3.25)  18 SEP 2009 14:25
entering extended mode
 file:line:error style messages enabled.
 %&-line parsing enabled.

      

and then after the echo command:

**\end

*
! Emergency stop.
<*> \end

End of file on the terminal!

      

+2


source


If I repeat a blank line in the fifo first and then repeat the rest of the document, it works fine.

mkfifo test
latex test

      

Another console:

echo "" > test
echo "\documentclass{report}\begin{document}asdf\end{document}" > test

      



First console:

xdvi test

      

My guess is that LaTeX does two passes of the file whereas TeX does not. On the first pass, LaTeX tries to figure something out, then it closes the file and reopens it for a second pass.

+1


source







All Articles