@@ -53,7 +53,6 @@ data WriterState =
53 , stOLLevel :: Int -- level of ordered list nesting
53 , stOLLevel :: Int -- level of ordered list nesting
54 , stOptions :: WriterOptions -- writer options, so they don't have to be parameter
54 , stOptions :: WriterOptions -- writer options, so they don't have to be parameter
55 , stVerbInNote :: Bool -- true if document has verbatim text in note
55 , stVerbInNote :: Bool -- true if document has verbatim text in note
56− , stEnumerate :: Bool -- true if document needs fancy enumerated lists
57 , stTable :: Bool -- true if document has a table
56 , stTable :: Bool -- true if document has a table
58 , stStrikeout :: Bool -- true if document has strikeout
57 , stStrikeout :: Bool -- true if document has strikeout
59 , stUrl :: Bool -- true if document has visible URL link
58 , stUrl :: Bool -- true if document has visible URL link
@@ -73,7 +72,7 @@ writeLaTeX options document =
73 evalState (pandocToLaTeX options document) $
72 evalState (pandocToLaTeX options document) $
74 WriterState { stInNote = False, stInTable = False,
73 WriterState { stInNote = False, stInTable = False,
75 stTableNotes = [], stOLLevel = 1, stOptions = options,
74 stTableNotes = [], stOLLevel = 1, stOptions = options,
76− stVerbInNote = False, stEnumerate = False,
75+ stVerbInNote = False,
77 stTable = False, stStrikeout = False,
76 stTable = False, stStrikeout = False,
78 stUrl = False, stGraphics = False,
77 stUrl = False, stGraphics = False,
79 stLHS = False, stBook = writerChapters options,
78 stLHS = False, stBook = writerChapters options,
@@ -144,7 +143,6 @@ pandocToLaTeX options (Pandoc (Meta title authors date) blocks) = do
144 else "article") ] ++
143 else "article") ] ++
145 [ ("author", a) | a <- authorsText ] ++
144 [ ("author", a) | a <- authorsText ] ++
146 [ ("verbatim-in-note", "yes") | stVerbInNote st ] ++
145 [ ("verbatim-in-note", "yes") | stVerbInNote st ] ++
147− [ ("fancy-enums", "yes") | stEnumerate st ] ++
148 [ ("tables", "yes") | stTable st ] ++
146 [ ("tables", "yes") | stTable st ] ++
149 [ ("strikeout", "yes") | stStrikeout st ] ++
147 [ ("strikeout", "yes") | stStrikeout st ] ++
150 [ ("url", "yes") | stUrl st ] ++
148 [ ("url", "yes") | stUrl st ] ++
@@ -354,20 +352,32 @@ blockToLaTeX (OrderedList (start, numstyle, numdelim) lst) = do
354 put $ st {stOLLevel = oldlevel + 1}
352 put $ st {stOLLevel = oldlevel + 1}
355 items <- mapM listItemToLaTeX lst
353 items <- mapM listItemToLaTeX lst
356 modify (\s -> s {stOLLevel = oldlevel})
354 modify (\s -> s {stOLLevel = oldlevel})
355+ let tostyle x = case numstyle of
356+ Decimal -> "\\arabic" <> braces x
357+ UpperRoman -> "\\Roman" <> braces x
358+ LowerRoman -> "\\roman" <> braces x
359+ UpperAlpha -> "\\Alph" <> braces x
360+ LowerAlpha -> "\\alph" <> braces x
362+ let todelim x = case numdelim of
363+ OneParen -> x <> ")"
364+ TwoParens -> parens x
367+ let enum = text $ "enum" ++ map toLower (toRomanNumeral oldlevel)
357− exemplar <- if numstyle /= DefaultStyle || numdelim /= DefaultDelim
368+ let stylecommand = if numstyle == DefaultStyle && numdelim == DefaultDelim
358− then do
369+ then empty
359− modify $ \s -> s{ stEnumerate = True }
370+ else "\\def" <> "\\label" <> enum <>
360− return $ char '[' <>
371+ braces (todelim $ tostyle enum)
361− text (head (orderedListMarkers (1, numstyle,
372+ let resetcounter = if start == 1 || oldlevel > 4
362− numdelim))) <> char ']'
373+ then empty
364− let resetcounter = if start /= 1 && oldlevel <= 4
365− then text $ "\\setcounter{enum" ++
374+ else "\\setcounter" <> braces enum <>
366− map toLower (toRomanNumeral oldlevel) ++
367− "}{" ++ show (start - 1) ++ "}"
375+ braces (text $ show $ start - 1)
369− return $ text ("\\begin{enumerate}" ++ inc) <> exemplar $$ resetcounter $$
376+ return $ text ("\\begin{enumerate}" ++ inc)
370− vcat items $$ "\\end{enumerate}"
380+ $$ "\\end{enumerate}"
371blockToLaTeX (DefinitionList lst) = do
381blockToLaTeX (DefinitionList lst) = do
372 incremental <- gets stIncremental
382 incremental <- gets stIncremental
373 let inc = if incremental then "[<+->]" else ""
383 let inc = if incremental then "[<+->]" else ""