summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index b75f56cef..3657f3464 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -743,14 +743,16 @@ sectionHeader :: Bool -- True for unnumbered
sectionHeader unnumbered ident level lst = do
txt <- inlineListToLaTeX lst
plain <- stringToLaTeX TextString $ concatMap stringify lst
- let noNote (Note _) = Str ""
- noNote x = x
- let lstNoNotes = walk noNote lst
+ let removeInvalidInline (Note _) = []
+ removeInvalidInline (Span (id', _, _) _) | not (null id') = []
+ removeInvalidInline (Image _ _ _) = []
+ removeInvalidInline x = [x]
+ let lstNoNotes = foldr (mappend . (\x -> walkM removeInvalidInline x)) mempty lst
txtNoNotes <- inlineListToLaTeX lstNoNotes
-- footnotes in sections don't work (except for starred variants)
-- unless you specify an optional argument:
-- \section[mysec]{mysec\footnote{blah}}
- optional <- if unnumbered || lstNoNotes == lst
+ optional <- if unnumbered || lstNoNotes == lst || lstNoNotes == []
then return empty
else do
return $ brackets txtNoNotes