git.iko.soy/typeable/pandoc
on master help sign in
LaTeX writer: Use \paragraph, \subparagraph for level 4,5 headers.
commit89bf3127654f152c1386014ab5b1588f6e80fc6f authorJohn MacFarlane <jgm@berkeley.edu> dateSat 18 Dec 2010, 15:05 (16 years ago) parent543aa28
2 files changed+12−11
src/Text/Pandoc/Writers/LaTeX.hs+10−9 tests/writer.latex+2−2
src/Text/Pandoc/Writers/LaTeX.hs+10−9
@@ -228,15 +228,16 @@ blockToLaTeX (Header level lst) = do
228228 return $ char '[' <> res <> char ']'
229229 let stuffing = optional <> char '{' <> txt <> char '}'
230230 book <- liftM stBook get
231− return $ case (book, level) of
232− (True, 1) -> text "\\chapter" <> stuffing <> char '\n'
233− (True, 2) -> text "\\section" <> stuffing <> char '\n'
234− (True, 3) -> text "\\subsection" <> stuffing <> char '\n'
235− (True, 4) -> text "\\subsubsection" <> stuffing <> char '\n'
236− (False, 1) -> text "\\section" <> stuffing <> char '\n'
237− (False, 2) -> text "\\subsection" <> stuffing <> char '\n'
238− (False, 3) -> text "\\subsubsection" <> stuffing <> char '\n'
239− _ -> txt <> char '\n'
231+ let level' = if book then level - 1 else level
232+ let headerWith x y = text x <> y <> char '\n'
233+ return $ case level' of
234+ 0 -> headerWith "\\chapter" stuffing
235+ 1 -> headerWith "\\section" stuffing
236+ 2 -> headerWith "\\subsection" stuffing
237+ 3 -> headerWith "\\subsubsection" stuffing
238+ 4 -> headerWith "\\paragraph" stuffing
239+ 5 -> headerWith "\\subparagraph" stuffing
240+ _ -> txt <> char '\n'
240241blockToLaTeX (Table caption aligns widths heads rows) = do
241242 headers <- if all null heads
242243 then return empty
tests/writer.latex+2−2
@@ -47,9 +47,9 @@ John Gruber's markdown test suite.
4747
4848\subsubsection{Level 3 with \emph{emphasis}}
4949
50−Level 4
50+\paragraph{Level 4}
5151
52−Level 5
52+\subparagraph{Level 5}
5353
5454\section{Level 1}
5555