views:

44

answers:

1

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.

A: 

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.

nlucaroni