ocaml Unix.system 调用 pdflatex

发布于 2024-09-18 13:21:07 字数 1828 浏览 2 评论 0原文

我在从已编译的 ocaml 应用程序 pdflatex 调用外部应用程序时遇到问题。我使用正确的字符串作为参数,当我从顶层运行它时,我得到了预期的结果,

Unix.system "pdflatex -interaction batchmode -output-directory res ALGO_GEN.tex";;

并且它生成了正确的输出,

This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
 restricted \write18 enabled.
entering extended mode
(/usr/share/texmf-texlive/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size10.clo))
(/usr/share/texmf-texlive/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/share/texmf-texlive/tex/latex/amsmath/amstext.sty
(/usr/share/texmf-texlive/tex/latex/amsmath/amsgen.sty))
(/usr/share/texmf-texlive/tex/latex/amsmath/amsbsy.sty)
(/usr/share/texmf-texlive/tex/latex/amsmath/amsopn.sty))
(/usr/share/texmf-texlive/tex/latex/algorithms/algorithmic.sty
(/usr/share/texmf-texlive/tex/latex/base/ifthen.sty)
(/usr/share/texmf-texlive/tex/latex/graphics/keyval.sty))
No file ALGO_GEN.aux.
[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}]
(maze.html.res/ALGO_GEN.aux) )</usr/share/texmf-texlive/fonts/type1/public/a
msfonts/cm/cmbx10.pfb></usr/share/texmf-texlive/fonts/type1/public/amsfonts/cm/
cmmi10.pfb></usr/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmr10.pfb><
/usr/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmsy10.pfb>
Output written on res/ALGO_GEN.pdf (1 page, 36816 bytes).
Transcript written on res/ALGO_GEN.log.
- : Unix.process_status = Unix.WEXITED 0

从编译的应用程序中,日志表明,

*** (job aborted, no legal \end found)

它已经让我困惑了一段时间。我使用了来自 Unix 模块的其他系统调用以及其他命令行选项。我想知道是否有人可以就如何进行提供一些建议。该应用程序生成一些 tex 文档,需要将它们转换为 pdf。从顶层,调用它们列表上的映射可以正确生成 pdf;仅编译(字节代码)不起作用。

I'm having a problem calling an outside application from a compiled ocaml application, pdflatex. I'm using the proper string as an argument, when I run it from the toplevel I get the expected results,

Unix.system "pdflatex -interaction batchmode -output-directory res ALGO_GEN.tex";;

And it generates the proper output,

This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
 restricted \write18 enabled.
entering extended mode
(/usr/share/texmf-texlive/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size10.clo))
(/usr/share/texmf-texlive/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/share/texmf-texlive/tex/latex/amsmath/amstext.sty
(/usr/share/texmf-texlive/tex/latex/amsmath/amsgen.sty))
(/usr/share/texmf-texlive/tex/latex/amsmath/amsbsy.sty)
(/usr/share/texmf-texlive/tex/latex/amsmath/amsopn.sty))
(/usr/share/texmf-texlive/tex/latex/algorithms/algorithmic.sty
(/usr/share/texmf-texlive/tex/latex/base/ifthen.sty)
(/usr/share/texmf-texlive/tex/latex/graphics/keyval.sty))
No file ALGO_GEN.aux.
[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}]
(maze.html.res/ALGO_GEN.aux) )</usr/share/texmf-texlive/fonts/type1/public/a
msfonts/cm/cmbx10.pfb></usr/share/texmf-texlive/fonts/type1/public/amsfonts/cm/
cmmi10.pfb></usr/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmr10.pfb><
/usr/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmsy10.pfb>
Output written on res/ALGO_GEN.pdf (1 page, 36816 bytes).
Transcript written on res/ALGO_GEN.log.
- : Unix.process_status = Unix.WEXITED 0

From the compiled application, the log indicates that,

*** (job aborted, no legal \end found)

It has been confusing me for some time. I've used other system calls from the Unix module, and other command line options. I'm wondering if anyone can give some advice on how to proceed. The application generates a few tex documents, and they need to be converted to pdf. From the toplevel, calling a map over a list of them generates the pdfs properly; only compiled (byte code) does it not work.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

飘过的浮云 2024-09-25 13:21:07

我没有关闭之前写入的 tex 文件的通道,因此可能不会写入任何数据。感谢 Gilles 建议我在运行时检查文件。

I wasn't closing the channel to the tex file previously written, so no data would potentially be written. Thanks to Gilles for suggesting I inspect the files during runtime.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文