aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2013-08-11 16:16:24 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-08-11 16:16:24 -0700
commit7b975c2bcc32e5ddd96338afdb32a1ceacdc0980 (patch)
tree81b7a223758418bf1c7065d4acb1566771d2f296
parente279175ea517e2df65fe5d716bc02e383b04fc36 (diff)
downloadpandoc-7b975c2bcc32e5ddd96338afdb32a1ceacdc0980.tar.gz
PDF: Add suggestion to use --latex-engine=xelatex on encoding error.
-rw-r--r--src/Text/Pandoc/PDF.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Text/Pandoc/PDF.hs b/src/Text/Pandoc/PDF.hs
index ae611bc37..a445e2991 100644
--- a/src/Text/Pandoc/PDF.hs
+++ b/src/Text/Pandoc/PDF.hs
@@ -109,8 +109,14 @@ tex2pdf' tmpDir program source = do
(exit, log', mbPdf) <- runTeXProgram program numruns tmpDir source
let msg = "Error producing PDF from TeX source."
case (exit, mbPdf) of
- (ExitFailure _, _) -> return $ Left $
- msg <> "\n" <> extractMsg log'
+ (ExitFailure _, _) -> do
+ let logmsg = extractMsg log'
+ let extramsg =
+ case logmsg of
+ x | "! Package inputenc Error" `BC.isPrefixOf` x ->
+ "\nTry running pandoc with --latex-engine=xelatex."
+ _ -> ""
+ return $ Left $ msg <> "\n" <> extractMsg log' <> extramsg
(ExitSuccess, Nothing) -> return $ Left msg
(ExitSuccess, Just pdf) -> return $ Right pdf