git.iko.soy/typeable/pandoc
on master help sign in
LaTeX beamer: Only add [fragile] to slide if it contains verbatim.

Closes #385.

commit05cf164edff9bc4ffbed443c18c15773749ca358 authorJohn MacFarlane <fiddlosopher@gmail.com> dateMon 23 Jan 2012, 21:03 (15 years ago) parent97af576
1 file changed+8−1
src/Text/Pandoc/Writers/LaTeX.hs+8−1
src/Text/Pandoc/Writers/LaTeX.hs+8−1
@@ -207,7 +207,14 @@ slideToBeamer (SectionSlide lvl tit) = return [Header lvl tit]
207207slideToBeamer (ContentSlide tit bs) = do
208208 tit' <- inlineListToLaTeX tit
209209 -- note: [fragile] is required or verbatim breaks
210− let slideStart = RawBlock "latex" ("\\begin{frame}[fragile]\n" ++
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 ""
217+ let slideStart = RawBlock "latex" ("\\begin{frame}" ++ fragile ++
211218 "\\frametitle{" ++ render Nothing tit' ++ "}")
212219 let slideEnd = RawBlock "latex" "\\end{frame}"
213220 -- now carve up slide into blocks if there are sections inside