在命名管道 (fifo) 上调用 LaTeX?
我在 Unix 上的命名管道 fifo 上运行 LaTeX。我像这样创建 fifo:
$ mkfifo fifo
然后像这样运行 LaTeX:
$ latex fifo
这个过程会阻塞并且没有输出,直到我从另一个 shell 写入 fifo:
$ echo "\\end" > fifo
然后 $ Latex fifo 输出变为:
This is pdfTeXk, Version 3.1415926-1.40.9 (Web2C 7.5.7)
%&-line parsing enabled.
entering extended mode
然而,LaTeX 进程永远不会结束。怎么才能让LaTeX结束呢?我尝试发送 chr(0) 和 chr(4) (即 ctrl-d),但都不起作用。是否有一些命令可以告诉 LaTeX 退出(即类似 \exit 的命令)?
感谢您的阅读。
编辑:
值得注意的是,当您运行 tex 而不是 latex 的变体时,以下内容将按预期工作:(
$ echo "story\\end" > fifo
同时,在 tex然而
$ 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.
,尽管 Leslie Lamport 在第 233 页的文档准备系统 LaTeX 中指出 \end 已被 \end{document} 取代,但以下任一情况都不会结束 LaTeX 会话:
$ echo "\begin{document}story\end{document}"
$ echo "\\begin{document}story\\end{document}"
I'm running LaTeX on a named pipe fifo on Unix. I create the fifo like-so:
$ mkfifo fifo
I then run LaTeX like-so:
$ latex fifo
This process blocks and has no output until I write to the fifo from another shell:
$ echo "\\end" > fifo
Then the $ latex fifo output 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 get LaTeX to end? I've tried sending it chr(0) and chr(4) (i.e. ctrl-d), but neither works. Is there some command that will tell LaTeX to exit (i.e. something like \exit)?
Thanks for reading.
EDIT:
It is noteworthy that when you run tex instead of a variant of latex then the following works as expected:
$ echo "story\\end" > fifo
(meanwhile, 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 A Document Preparation System LaTeX on page 233 that \end has been replaced by \end{document}, neither of the following ends a LaTeX session:
$ echo "\begin{document}story\end{document}"
$ echo "\\begin{document}story\\end{document}"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我建议允许你的 shell 将 fifo 管道定向到标准输入。
当我这样做时,我首先得到这个输出:
然后在 echo 命令之后得到:
I would suggest allow your shell to direct the fifo pipe to the standard in.
When I do that, I get this output first:
and then after the echo command:
如果我先将空行回显到 fifo,然后再回显文档的其余部分,则它可以正常工作。
其他控制台:
第一个控制台:
我的猜测是 LaTeX 对文件进行了两次传递,而 TeX 则没有。在第一遍中,LaTeX 尝试确定某些内容,然后关闭文件,并在第二遍中重新打开它。
If I echo a blank line into the fifo first and then echo the rest of the document, it works fine.
Other console:
First console:
My guess is that LaTeX makes two passes of the file whereas TeX does not. On the first pass, LaTeX tries to determine something, then it closes the file, and reopens it for the second pass.