git.iko.soy/typeable/pandoc
on master help sign in
LaTeX writer: Use \paragraph, \subparagraph for level 4,5 headers.
89bf312John MacFarlane
src/Text/Pandoc/Writers/LaTeX.hs+10−9
@@ -228,15 +228,16 @@ blockToLaTeX (Header level lst) = do
228 return $ char '[' <> res <> char ']'
228 return $ char '[' <> res <> char ']'
229 let stuffing = optional <> char '{' <> txt <> char '}'
229 let stuffing = optional <> char '{' <> txt <> char '}'
230 book <- liftM stBook get
230 book <- liftM stBook get
231+ let level' = if book then level - 1 else level
232+ let headerWith x y = text x <> y <> char '\n'
231− return $ case (book, level) of
233+ return $ case level' of
232− (True, 1) -> text "\\chapter" <> stuffing <> char '\n'
234+ 0 -> headerWith "\\chapter" stuffing
233− (True, 2) -> text "\\section" <> stuffing <> char '\n'
235+ 1 -> headerWith "\\section" stuffing
234− (True, 3) -> text "\\subsection" <> stuffing <> char '\n'
236+ 2 -> headerWith "\\subsection" stuffing
235− (True, 4) -> text "\\subsubsection" <> stuffing <> char '\n'
237+ 3 -> headerWith "\\subsubsection" stuffing
236− (False, 1) -> text "\\section" <> stuffing <> char '\n'
238+ 4 -> headerWith "\\paragraph" stuffing
237− (False, 2) -> text "\\subsection" <> stuffing <> char '\n'
239+ 5 -> headerWith "\\subparagraph" stuffing
238− (False, 3) -> text "\\subsubsection" <> stuffing <> char '\n'
239− _ -> txt <> char '\n'
240+ _ -> txt <> char '\n'
240blockToLaTeX (Table caption aligns widths heads rows) = do
241blockToLaTeX (Table caption aligns widths heads rows) = do
241 headers <- if all null heads
242 headers <- if all null heads
242 then return empty
243 then return empty
tests/writer.latex+2−2
@@ -47,9 +47,9 @@ John Gruber's markdown test suite.
47
47
48\subsubsection{Level 3 with \emph{emphasis}}
48\subsubsection{Level 3 with \emph{emphasis}}
49
49
50−Level 4
50+\paragraph{Level 4}
51
51
52−Level 5
52+\subparagraph{Level 5}
53
53
54\section{Level 1}
54\section{Level 1}
55
55