From 146555e63623bfd1b960a0ef9b66c7853f6f6b3c Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Fri, 6 Jul 2018 23:51:20 +0200
Subject: [PATCH] PDF: revert fix for #4484 (only compress images on last run).

Closes #4755.

This will mean some increase in the time it takes to
produce an image-heavy PDF with xelatex, but it will
make tables of contents correct, which is more important.

Note that the production time should also be decreased
by the previous commit, which fixed a logic error
affecting the number of runs.  That change might mitigate
the effect of this one.
---
 src/Text/Pandoc/PDF.hs | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/src/Text/Pandoc/PDF.hs b/src/Text/Pandoc/PDF.hs
index e951c8c3e..65de3e45a 100644
--- a/src/Text/Pandoc/PDF.hs
+++ b/src/Text/Pandoc/PDF.hs
@@ -285,12 +285,7 @@ runTeXProgram verbosity program args runNumber numRuns tmpDir source = do
     let file' = file
 #endif
     let programArgs = ["-halt-on-error", "-interaction", "nonstopmode",
-         "-output-directory", tmpDir'] ++
-         -- see #4484, only compress images on last run:
-         if program == "xelatex" && runNumber < numRuns
-            then ["-output-driver", "xdvipdfmx -z0"]
-            else []
-         ++ args ++ [file']
+         "-output-directory", tmpDir'] ++ args ++ [file']
     env' <- getEnvironment
     let sep = [searchPathSeparator]
     let texinputs = maybe (tmpDir' ++ sep) ((tmpDir' ++ sep) ++)