Beamer: add allowframebreaks to slide if set in header classes.
It's recommended that your bibliography slide have this attribute: # References {.allowframebreaks} This causes multiple slides to be created if necessary, depending on the length of the bibliography.
This commit is contained in:
parent
d5fad2306a
commit
a97f39c12e
2 changed files with 21 additions and 8 deletions
10
README
10
README
|
@ -2674,6 +2674,16 @@ using the `-V` option:
|
||||||
|
|
||||||
pandoc -t beamer habits.txt -V theme:Warsaw -o habits.pdf
|
pandoc -t beamer habits.txt -V theme:Warsaw -o habits.pdf
|
||||||
|
|
||||||
|
Note that header attributes will turn into slide attributes
|
||||||
|
(on a `<div>` or `<section>`) in HTML slide formats, allowing you
|
||||||
|
to style individual slides. In Beamer, the only header attribute
|
||||||
|
that affects slides is the `allowframebreaks` class, which sets the
|
||||||
|
`allowframebreaks` option, causing multiple slides to be created
|
||||||
|
if the content overfills the frame. This is recommended especially for
|
||||||
|
bibliographies:
|
||||||
|
|
||||||
|
# References {.allowframebreaks}
|
||||||
|
|
||||||
Literate Haskell support
|
Literate Haskell support
|
||||||
========================
|
========================
|
||||||
|
|
||||||
|
|
|
@ -232,7 +232,7 @@ toSlides bs = do
|
||||||
|
|
||||||
elementToBeamer :: Int -> Element -> State WriterState [Block]
|
elementToBeamer :: Int -> Element -> State WriterState [Block]
|
||||||
elementToBeamer _slideLevel (Blk b) = return [b]
|
elementToBeamer _slideLevel (Blk b) = return [b]
|
||||||
elementToBeamer slideLevel (Sec lvl _num (ident,classes,_) tit elts)
|
elementToBeamer slideLevel (Sec lvl _num (ident,classes,kvs) tit elts)
|
||||||
| lvl > slideLevel = do
|
| lvl > slideLevel = do
|
||||||
bs <- concat `fmap` mapM (elementToBeamer slideLevel) elts
|
bs <- concat `fmap` mapM (elementToBeamer slideLevel) elts
|
||||||
return $ Para ( RawInline "latex" "\\begin{block}{"
|
return $ Para ( RawInline "latex" "\\begin{block}{"
|
||||||
|
@ -240,7 +240,7 @@ elementToBeamer slideLevel (Sec lvl _num (ident,classes,_) tit elts)
|
||||||
: bs ++ [RawBlock "latex" "\\end{block}"]
|
: bs ++ [RawBlock "latex" "\\end{block}"]
|
||||||
| lvl < slideLevel = do
|
| lvl < slideLevel = do
|
||||||
bs <- concat `fmap` mapM (elementToBeamer slideLevel) elts
|
bs <- concat `fmap` mapM (elementToBeamer slideLevel) elts
|
||||||
return $ (Header lvl (ident,classes,[]) tit) : bs
|
return $ (Header lvl (ident,classes,kvs) tit) : bs
|
||||||
| otherwise = do -- lvl == slideLevel
|
| otherwise = do -- lvl == slideLevel
|
||||||
-- note: [fragile] is required or verbatim breaks
|
-- note: [fragile] is required or verbatim breaks
|
||||||
let hasCodeBlock (CodeBlock _ _) = [True]
|
let hasCodeBlock (CodeBlock _ _) = [True]
|
||||||
|
@ -248,17 +248,20 @@ elementToBeamer slideLevel (Sec lvl _num (ident,classes,_) tit elts)
|
||||||
let hasCode (Code _ _) = [True]
|
let hasCode (Code _ _) = [True]
|
||||||
hasCode _ = []
|
hasCode _ = []
|
||||||
opts <- gets stOptions
|
opts <- gets stOptions
|
||||||
let fragile = if not $ null $ queryWith hasCodeBlock elts ++
|
let fragile = not $ null $ queryWith hasCodeBlock elts ++
|
||||||
if writerListings opts
|
if writerListings opts
|
||||||
then queryWith hasCode elts
|
then queryWith hasCode elts
|
||||||
else []
|
else []
|
||||||
then "[fragile]"
|
let allowframebreaks = "allowframebreaks" `elem` classes
|
||||||
else ""
|
let optionslist = ["fragile" | fragile] ++
|
||||||
let slideStart = Para $ RawInline "latex" ("\\begin{frame}" ++ fragile) :
|
["allowframebreaks" | allowframebreaks]
|
||||||
|
let options = if null optionslist
|
||||||
|
then ""
|
||||||
|
else "[" ++ intercalate "," optionslist ++ "]"
|
||||||
|
let slideStart = Para $ RawInline "latex" ("\\begin{frame}" ++ options) :
|
||||||
if tit == [Str "\0"] -- marker for hrule
|
if tit == [Str "\0"] -- marker for hrule
|
||||||
then []
|
then []
|
||||||
else (RawInline "latex" "\\frametitle{") : tit ++
|
else (RawInline "latex" "{") : tit ++ [RawInline "latex" "}"]
|
||||||
[RawInline "latex" "}"]
|
|
||||||
let slideEnd = RawBlock "latex" "\\end{frame}"
|
let slideEnd = RawBlock "latex" "\\end{frame}"
|
||||||
-- now carve up slide into blocks if there are sections inside
|
-- now carve up slide into blocks if there are sections inside
|
||||||
bs <- concat `fmap` mapM (elementToBeamer slideLevel) elts
|
bs <- concat `fmap` mapM (elementToBeamer slideLevel) elts
|
||||||
|
|
Loading…
Reference in a new issue