git.iko.soy/typeable/pandoc
on master help sign in
LaTeX beamer: Only add [fragile] to slide if it contains verbatim.
05cf164John MacFarlane
src/Text/Pandoc/Writers/LaTeX.hs+8−1
@@ -207,7 +207,14 @@ slideToBeamer (SectionSlide lvl tit) = return [Header lvl tit]
207slideToBeamer (ContentSlide tit bs) = do
207slideToBeamer (ContentSlide tit bs) = do
208 tit' <- inlineListToLaTeX tit
208 tit' <- inlineListToLaTeX tit
209 -- note: [fragile] is required or verbatim breaks
209 -- note: [fragile] is required or verbatim breaks
210+ let hasCodeBlock (CodeBlock _ _) = [True]
211+ hasCodeBlock _ = []
212+ let hasCode (Code _ _) = [True]
213+ hasCode _ = []
214+ let fragile = if not $ null $ queryWith hasCodeBlock bs ++ queryWith hasCode bs
215+ then "[fragile]"
216+ else ""
210− let slideStart = RawBlock "latex" ("\\begin{frame}[fragile]\n" ++
217+ let slideStart = RawBlock "latex" ("\\begin{frame}" ++ fragile ++
211 "\\frametitle{" ++ render Nothing tit' ++ "}")
218 "\\frametitle{" ++ render Nothing tit' ++ "}")
212 let slideEnd = RawBlock "latex" "\\end{frame}"
219 let slideEnd = RawBlock "latex" "\\end{frame}"
213 -- now carve up slide into blocks if there are sections inside
220 -- now carve up slide into blocks if there are sections inside