From 52b78b10c81e99926d560bc383938006be3b0458 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 20 Jan 2022 19:09:44 -0800 Subject: [PATCH] Avoid putting a frame around speaker notes in beamer. If speaker notes (a Div with class 'notes') occur right after a section heading, but above slide level, the resulting `\note{..}` caommand should not be wrapped in a frame, as that will cause a spurious blank slide. Closes #7857. --- src/Text/Pandoc/Writers/LaTeX.hs | 11 +++++++---- test/command/7857.md | 22 ++++++++++++++++++++++ 2 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 test/command/7857.md diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index e16fcf13f..9f342f61f 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -235,10 +235,13 @@ elementToBeamer slideLevel (Div (ident,"section":dclasses,dkvs) isSlide _ = False let (titleBs, slideBs) = break isSlide ys return $ - if null titleBs - then Div (ident,"section":dclasses,dkvs) xs - else Div (ident,"section":dclasses,dkvs) - (h : Div ("","slide":dclasses,dkvs) (h:titleBs) : slideBs) + case titleBs of + [] -> Div (ident,"section":dclasses,dkvs) xs + [Div (_,"notes":_,_) _] -> -- see #7857, don't create frame + -- just for speaker notes after section heading + Div (ident,"section":dclasses,dkvs) xs + _ -> Div (ident,"section":dclasses,dkvs) + (h : Div ("","slide":dclasses,dkvs) (h:titleBs) : slideBs) | otherwise = return $ Div (ident,"slide":dclasses,dkvs) xs elementToBeamer _ x = return x diff --git a/test/command/7857.md b/test/command/7857.md new file mode 100644 index 000000000..9a4968e88 --- /dev/null +++ b/test/command/7857.md @@ -0,0 +1,22 @@ +``` +% pandoc --slide-level=2 -t beamer +# section + +::: notes +my note +::: + +## slide + +ok +^D +\hypertarget{section}{% +\section{section}\label{section}} + +\note{my note} + +\begin{frame}{slide} +\protect\hypertarget{slide}{} +ok +\end{frame} +```