+
+ # Check for PostScript specials in the dvi, badly supported by dvipng
+ # This is required for correct rendering of PSTricks and TikZ
+ dv2dt = find_exe_or_terminate(["dv2dt"], path)
+ dv2dt_call = '%s %s' % (dv2dt, dvi_file)
+
+ # The output from dv2dt goes to stdout
+ dv2dt_status, dv2dt_output = run_command(dv2dt_call)
+ psliteral_re = re.compile("^special[1-4] [0-9]+ '(\"|ps:)")
+ for dtl_line in dv2dt_output.split("\n"):
+ if psliteral_re.match(dtl_line) != None:
+ # Literal PostScript special detected!
+ # Fallback to legacy conversion
+ vec = [argv[0], argv[2], argv[3], argv[1], argv[4], argv[5], latex]
+ return legacy_conversion(vec)
+
+ # Run the dvi file through dvipng.