@@ -494,7 +494,7 @@ sectionHeader unnumbered ref level lst = do
495 res <- inlineListToLaTeX lstNoNotes
495 res <- inlineListToLaTeX lstNoNotes
496 return $ char '[' <> res <> char ']'
496 return $ char '[' <> res <> char ']'
497− let stuffing = star <> optional <> char '{' <> txt <> char '}'
497+ let stuffing = star <> optional <> braces txt
498 book <- gets stBook
498 book <- gets stBook
499 opts <- gets stOptions
499 opts <- gets stOptions
500 let level' = if book || writerChapters opts then level - 1 else level
500 let level' = if book || writerChapters opts then level - 1 else level
@@ -507,17 +507,23 @@ sectionHeader unnumbered ref level lst = do
507 <> braces (text ref))
507 <> braces (text ref))
508 else lab)
508 else lab)
509 let headerWith x y = refLabel $ text x <> y
509 let headerWith x y = refLabel $ text x <> y
510− return $ case level' of
510+ let sectionType = case level' of
511− 0 -> if writerBeamer opts
511+ 0 | writerBeamer opts -> "part"
512− then headerWith "\\part" stuffing
512+ | otherwise -> "chapter"
513− else headerWith "\\chapter" stuffing
514− 1 -> headerWith "\\section" stuffing
513+ 1 -> "section"
515− 2 -> headerWith "\\subsection" stuffing
514+ 2 -> "subsection"
516− 3 -> headerWith "\\subsubsection" stuffing
515+ 3 -> "subsubsection"
517− 4 -> headerWith "\\paragraph" stuffing
516+ 4 -> "paragraph"
518− 5 -> headerWith "\\subparagraph" stuffing
517+ 5 -> "subparagraph"
519+ return $ if level' > 5
521+ else headerWith ('\\':sectionType) stuffing
523+ then "\\addcontentsline{toc}" <>
524+ braces (text sectionType) <>
519− _ -> txt
525+ braces txt
522-- | Convert list of inline elements to LaTeX.
528-- | Convert list of inline elements to LaTeX.
523inlineListToLaTeX :: [Inline] -- ^ Inlines to convert
529inlineListToLaTeX :: [Inline] -- ^ Inlines to convert