- output_string f (Texutil.get_preface ());
- output_string f outtex;
- output_string f (Texutil.get_footer ());
- close_out f;
- if Util.run_in_other_directory tmppath (cmd_latex tmpprefix) != 0
- then (unlink_all (); raise (ExternalCommandFailure "latex"))
- else if (Sys.command ((cmd_dvips tmpprefix) ^ " | " ^ (cmd_convert (finalpath^"/"^md5^".png"))) != 0)
- then (unlink_all (); raise (ExternalCommandFailure ("dvips")))
- else unlink_all ()
+ (* Assemble final output in file 'f' *)
+ output_string f (Texutil.get_preface ());
+ output_string f outtex;
+ output_string f (Texutil.get_footer ());
+ close_out f;
+
+ (* TODO: document *)
+ if Util.run_in_other_directory tmppath (cmd_latex tmpprefix0) != 0
+ then (
+ unlink_all (); raise (ExternalCommandFailure "latex")
+ ) else if (Sys.command (cmd_dvipng tmpprefix (finalpath^"/"^md5^".png") backcolor) != 0)
+ then (
+ if (Sys.command (cmd_dvips tmpprefix) != 0)
+ then (
+ unlink_all ();
+ raise (ExternalCommandFailure "dvips")
+ ) else if (Sys.command (cmd_convert tmpprefix (finalpath^"/"^md5^".png")) != 0)
+ then (
+ unlink_all ();
+ raise (ExternalCommandFailure "convert")
+ ) else (
+ unlink_all ()
+ )
+ ) else (
+ unlink_all ()
+ )