@@ -833,10 +833,12 @@ main = do
833833
834834 let pdfOutput = map toLower (takeExtension outputFile) == ".pdf"
835835
836+ let laTeXOutput = writerName' == "latex" || writerName' == "beamer" ||
837+ writerName' == "latex+lhs" || writerName' == "beamer+lhs"
838+
836839 when pdfOutput $ do
837840 -- make sure writer is latex or beamer
838− unless (writerName' == "latex" || writerName' == "beamer" ||
839− writerName' == "latex+lhs") $
841+ unless laTeXOutput $
840842 err 47 $ "cannot produce pdf output with " ++ writerName' ++ " writer"
841843 -- check for latex program
842844 mbLatex <- findExecutable latexEngine
@@ -916,14 +918,13 @@ main = do
916918 lhsExtension sources,
917919 stateStandalone = standalone',
918920 stateCitations = map CSL.refId refs,
919− stateSmart = smart || writerName' `elem`
920− ["latex", "context", "latex+lhs", "beamer"],
921+ stateSmart = smart || laTeXOutput || writerName' == "context",
921922 stateOldDashes = oldDashes,
922923 stateColumns = columns,
923924 stateStrict = strict,
924925 stateIndentedCodeClasses = codeBlockClasses,
925− stateApplyMacros = writerName' `notElem`
926− ["latex", "latex+lhs", "beamer"] }
926+ stateApplyMacros = not laTeXOutput
927+ }
927928
928929 let writerOptions = defaultWriterOptions
929930 { writerStandalone = standalone',
@@ -945,8 +946,7 @@ main = do
945946 writerReferenceLinks = referenceLinks,
946947 writerWrapText = wrap,
947948 writerColumns = columns,
948− writerLiterateHaskell = "+lhs" `isSuffixOf` writerName' ||
949− lhsExtension [outputFile],
949+ writerLiterateHaskell = False,
950950 writerEmailObfuscation = if strict
951951 then ReferenceObfuscation
952952 else obfuscationMethod,
@@ -957,7 +957,7 @@ main = do
957957 slideVariant == DZSlides,
958958 writerChapters = chapters,
959959 writerListings = listings,
960− writerBeamer = writerName' == "beamer",
960+ writerBeamer = False,
961961 writerSlideLevel = slideLevel,
962962 writerHighlight = highlight,
963963 writerHighlightStyle = highlightStyle,
@@ -980,9 +980,7 @@ main = do
980980
981981 let convertTabs = tabFilter (if preserveTabs then 0 else tabStop)
982982
983− let handleIncludes' = if readerName' == "latex" || readerName' == "beamer" ||
984− readerName' == "latex+lhs" ||
985− readerName' == "context"
983+ let handleIncludes' = if readerName' == "latex" || readerName' == "latex+lhs"
986984 then handleIncludes
987985 else return
988986
@@ -1029,18 +1027,18 @@ main = do
10291027 | writerName' == "docx" ->
10301028 writeDocx referenceDocx writerOptions doc2 >>= writeBinary
10311029 | otherwise -> err 9 ("Unknown writer: " ++ writerName')
1032− Just _
1030+ Just w
10331031 | pdfOutput -> do
1034− res <- tex2pdf latexEngine $ writeLaTeX writerOptions doc2
1032+ res <- tex2pdf latexEngine $ w writerOptions doc2
10351033 case res of
10361034 Right pdf -> writeBinary pdf
10371035 Left err' -> err 43 $ toString err'
1038− Just r
1036+ Just w
10391037 | htmlFormat && ascii ->
10401038 writerFn outputFile =<< selfcontain (toEntities result)
10411039 | otherwise ->
10421040 writerFn outputFile =<< selfcontain result
1043− where result = r writerOptions doc2 ++ ['\n' | not standalone']
1041+ where result = w writerOptions doc2 ++ ['\n' | not standalone']
10441042 htmlFormat = writerName' `elem`
10451043 ["html","html+lhs","html5","html5+lhs",
10461044 "s5","slidy","dzslides"]