git.iko.soy/typeable/pandoc
on master help sign in
LaTeX Writer: Don't use listings in headers
274efc4Matthew Pickering
src/Text/Pandoc/Writers/LaTeX.hs+4−3
@@ -701,7 +701,7 @@ inlineListToLaTeX lst =
701 ("\\\\[" ++ show (length lbs) ++
701 ("\\\\[" ++ show (length lbs) ++
702 "\\baselineskip]") : fixBreaks rest
702 "\\baselineskip]") : fixBreaks rest
703 fixBreaks (y:ys) = y : fixBreaks ys
703 fixBreaks (y:ys) = y : fixBreaks ys
704−
704+
705isQuoted :: Inline -> Bool
705isQuoted :: Inline -> Bool
706isQuoted (Quoted _ _) = True
706isQuoted (Quoted _ _) = True
707isQuoted _ = False
707isQuoted _ = False
@@ -750,10 +750,11 @@ inlineToLaTeX (Cite cits lst) = do
750
750
751inlineToLaTeX (Code (_,classes,_) str) = do
751inlineToLaTeX (Code (_,classes,_) str) = do
752 opts <- gets stOptions
752 opts <- gets stOptions
753+ inHeading <- gets stInHeading
753 case () of
754 case () of
754− _ | writerListings opts -> listingsCode
755+ _ | writerListings opts && not inHeading -> listingsCode
755 | writerHighlight opts && not (null classes) -> highlightCode
756 | writerHighlight opts && not (null classes) -> highlightCode
756− | otherwise -> rawCode
757+ | otherwise -> rawCode
757 where listingsCode = do
758 where listingsCode = do
758 inNote <- gets stInNote
759 inNote <- gets stInNote
759 when inNote $ modify $ \s -> s{ stVerbInNote = True }
760 when inNote $ modify $ \s -> s{ stVerbInNote = True }