(* Putting -bg Transparent in dvipng's arguments will give full-alpha transparency *)
(* Note that IE have problems with such PNGs and need an additional javascript snippet *)
(* Putting -bg transparent in dvipng's arguments will give binary transparency *)
-let cmd_dvipng tmpprefix finalpath = "dvipng -gamma 1.5 -D 120 -T tight --strict " ^ tmpprefix ^ ".dvi -o " ^ finalpath ^ " >/dev/null 2>/dev/null"
+let cmd_dvipng tmpprefix finalpath backcolor = "dvipng -bg \'" ^ backcolor ^ "\' -gamma 1.5 -D 120 -T tight --strict " ^ tmpprefix ^ ".dvi -o " ^ finalpath ^ " >/dev/null 2>/dev/null"
exception ExternalCommandFailure of string
-let render tmppath finalpath outtex md5 =
+let render tmppath finalpath outtex md5 backcolor =
let tmpprefix0 = (string_of_int (Unix.getpid ()))^"_"^md5 in
let tmpprefix = (tmppath^"/"^tmpprefix0) in
let unlink_all () =
close_out f;
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")) != 0)
+ 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)