Index: render.ml
===================================================================
RCS file: /cvsroot/wikipedia/phase3/math/render.ml,v
retrieving revision 1.3
diff -u -r1.3 render.ml
--- render.ml	7 Jan 2004 11:53:18 -0000	1.3
+++ render.ml	16 Apr 2004 01:40:46 -0000
@@ -1,6 +1,8 @@
 let cmd_dvips tmpprefix = "dvips -R -E " ^ tmpprefix ^ ".dvi -f"
 let cmd_latex tmpprefix = "latex " ^ tmpprefix ^ ".tex >/dev/null"
 let cmd_convert finalpath = "convert -quality 100 -density 120 ps:- " ^ finalpath ^ " >/dev/null 2>/dev/null"
+let cmd_dvipng tmpprefix finalpath =
+  "dvipng -q -D 120 -bg Transparent -T tight -o " ^ finalpath ^ " " ^ tmpprefix ^ ".dvi"
 
 exception ExternalCommandFailure of string
 
@@ -8,10 +10,12 @@
     let tmpprefix = (tmppath^"/"^(string_of_int (Unix.getpid ()))^"_"^md5) in
     let unlink_all () =
       begin
+      (* For debugging keep these:
 	Sys.remove (tmpprefix ^ ".dvi");
 	Sys.remove (tmpprefix ^ ".aux");
 	Sys.remove (tmpprefix ^ ".log");
         Sys.remove (tmpprefix ^ ".tex")
+	*)
       end in
     let f = (Util.open_out_unless_exists (tmpprefix ^ ".tex")) in
       begin
@@ -21,7 +25,10 @@
 	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)
+	*)
+	else if (Sys.command ((cmd_dvipng tmpprefix (finalpath^"/"^md5^".png"))) != 0)
 	then (unlink_all (); raise (ExternalCommandFailure ("dvips")))
 	else unlink_all ()
       end
