final String path = tmpDir2.getAbsolutePath() + LResources.FILE_SEP;
final File texFile = createLatexFile(drawing, path + name + TeXFilter.TEX_EXTENSION, synchronizer, pstGen);
String log;
File finalPS;
final IPoint tr = synchronizer.getTopRightDrawingPoint();
final IPoint bl = synchronizer.getBottomLeftDrawingPoint();
final int ppc = synchronizer.getPPCDrawing();
final float dec = 0.2f;
final OperatingSystem os = LSystem.INSTANCE.getSystem();
if(texFile==null || !texFile.exists())
return null;
final String[] paramsLatex = {os.getLatexBinPath(), "--interaction=nonstopmode", "--output-directory=" + tmpDir2.getAbsolutePath(),//$NON-NLS-1$//$NON-NLS-2$
texFile.getAbsolutePath()};
log = LSystem.INSTANCE.execute(paramsLatex, tmpDir2);
final File dviFile = new File(tmpDir2.getAbsolutePath() + LResources.FILE_SEP + name + ".dvi"); //$NON-NLS-1$
final boolean dviRenamed = dviFile.renameTo(new File(tmpDir2.getAbsolutePath() + LResources.FILE_SEP + name));
final String[] paramsDvi = {os.getDvipsBinPath(), "-Pdownload35", "-T", //$NON-NLS-1$ //$NON-NLS-2$
(tr.getX()-bl.getX())/ppc*scale+dec+"cm,"+((bl.getY()-tr.getY())/ppc*scale+dec)+"cm", //$NON-NLS-1$ //$NON-NLS-2$
name, "-o", pathExportPs}; //$NON-NLS-1$
log += LSystem.INSTANCE.execute(paramsDvi, tmpDir2);
texFile.delete();
new File(path + name + (dviRenamed ? "" : ".div")).delete(); //$NON-NLS-1$ //$NON-NLS-2$