diff options
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 19 | ||||
-rw-r--r-- | tests/writer.latex | 4 |
2 files changed, 12 insertions, 11 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 1afc55f4a..5a203fd23 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -228,15 +228,16 @@ blockToLaTeX (Header level lst) = do return $ char '[' <> res <> char ']' let stuffing = optional <> char '{' <> txt <> char '}' book <- liftM stBook get - return $ case (book, level) of - (True, 1) -> text "\\chapter" <> stuffing <> char '\n' - (True, 2) -> text "\\section" <> stuffing <> char '\n' - (True, 3) -> text "\\subsection" <> stuffing <> char '\n' - (True, 4) -> text "\\subsubsection" <> stuffing <> char '\n' - (False, 1) -> text "\\section" <> stuffing <> char '\n' - (False, 2) -> text "\\subsection" <> stuffing <> char '\n' - (False, 3) -> text "\\subsubsection" <> stuffing <> char '\n' - _ -> txt <> char '\n' + let level' = if book then level - 1 else level + let headerWith x y = text x <> y <> char '\n' + return $ case level' of + 0 -> headerWith "\\chapter" stuffing + 1 -> headerWith "\\section" stuffing + 2 -> headerWith "\\subsection" stuffing + 3 -> headerWith "\\subsubsection" stuffing + 4 -> headerWith "\\paragraph" stuffing + 5 -> headerWith "\\subparagraph" stuffing + _ -> txt <> char '\n' blockToLaTeX (Table caption aligns widths heads rows) = do headers <- if all null heads then return empty diff --git a/tests/writer.latex b/tests/writer.latex index 9cd660d8a..33c52eadd 100644 --- a/tests/writer.latex +++ b/tests/writer.latex @@ -47,9 +47,9 @@ John Gruber's markdown test suite. \subsubsection{Level 3 with \emph{emphasis}} -Level 4 +\paragraph{Level 4} -Level 5 +\subparagraph{Level 5} \section{Level 1} |