@@ -130,6 +130,7 @@ data Opt = Opt
130 , optCslFile :: FilePath
130 , optCslFile :: FilePath
131 , optAbbrevsFile :: Maybe FilePath
131 , optAbbrevsFile :: Maybe FilePath
132 , optListings :: Bool -- ^ Use listings package for code blocks
132 , optListings :: Bool -- ^ Use listings package for code blocks
133+ , optLaTeXProgram :: String -- ^ Program to use for latex -> pdf
135-- | Defaults for command-line options.
136-- | Defaults for command-line options.
@@ -178,6 +179,7 @@ defaultOpts = Opt
178 , optCslFile = ""
179 , optCslFile = ""
179 , optAbbrevsFile = Nothing
180 , optAbbrevsFile = Nothing
180 , optListings = False
181 , optListings = False
182+ , optLaTeXProgram = "pdflatex"
183-- | A list of functions, each transforming the options data structure
185-- | A list of functions, each transforming the options data structure
@@ -783,6 +785,7 @@ main = do
783 , optAbbrevsFile = cslabbrevs
785 , optAbbrevsFile = cslabbrevs
784 , optCiteMethod = citeMethod
786 , optCiteMethod = citeMethod
785 , optListings = listings
787 , optListings = listings
788+ , optLaTeXProgram = latexProgram
788 when dumpArgs $
791 when dumpArgs $
@@ -965,8 +968,6 @@ main = do
965 processBiblio cslfile' cslabbrevs refs doc1
968 processBiblio cslfile' cslabbrevs refs doc1
966 else return doc1
969 else return doc1
968− let latexProgram = "pdflatex"
970 case lookup writerName' writers of
971 case lookup writerName' writers of
971 Nothing | writerName' == "epub" ->
972 Nothing | writerName' == "epub" ->
972 writeEPUB epubStylesheet writerOptions doc2 >>= writeBinary
973 writeEPUB epubStylesheet writerOptions doc2 >>= writeBinary
@@ -981,7 +982,7 @@ main = do
981 Nothing -> err 41 $
982 Nothing -> err 41 $
982 latexProgram ++ " not found" -- TODO improve
983 latexProgram ++ " not found" -- TODO improve
983 Just pgm -> do
984 Just pgm -> do
984− res <- tex2pdf latexProgram $ writeLaTeX writerOptions doc2
985+ res <- tex2pdf pgm $ writeLaTeX writerOptions doc2
985 case res of
986 case res of
986 Right pdf -> writeBinary pdf
987 Right pdf -> writeBinary pdf
987 Left err' -> err 43 $ toString err'
988 Left err' -> err 43 $ toString err'