aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-08-31 19:31:38 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-08-31 19:31:38 -0700
commit3533218d6d7e15384262bf478d5ebf5e191f96ff (patch)
tree28a7411c62302e836b0d0ceb517c0fa2e5e5da04 /src
parent01b795781280018323e176b9540de7bf3599f9ac (diff)
parentdfc8ab5a6acd6bdd41463937283ac0865f5cf6f5 (diff)
downloadpandoc-3533218d6d7e15384262bf478d5ebf5e191f96ff.tar.gz
Merge pull request #1594 from jkr/itemFix
Item fix
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index acbe8a48d..8e3befe19 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -572,7 +572,13 @@ tableCellToLaTeX header (width, align, blocks) = do
$ reverse ns)
listItemToLaTeX :: [Block] -> State WriterState Doc
-listItemToLaTeX lst = blockListToLaTeX lst >>= return . (text "\\item" $$) .
+listItemToLaTeX lst
+ -- we need to put some text before a header if it's the first
+ -- element in an item. This will look ugly in LaTeX regardless, but
+ -- this will keep the typesetter from throwing an error.
+ | ((Header _ _ _) :_) <- lst =
+ blockListToLaTeX lst >>= return . (text "\\item ~" $$) . (nest 2)
+ | otherwise = blockListToLaTeX lst >>= return . (text "\\item" $$) .
(nest 2)
defListItemToLaTeX :: ([Inline], [[Block]]) -> State WriterState Doc
@@ -586,7 +592,11 @@ defListItemToLaTeX (term, defs) = do
then braces term'
else term'
def' <- liftM vsep $ mapM blockListToLaTeX defs
- return $ "\\item" <> brackets term'' $$ def'
+ return $ case defs of
+ (((Header _ _ _) : _) : _) ->
+ "\\item" <> brackets term'' <> " ~ " $$ def'
+ _ ->
+ "\\item" <> brackets term'' $$ def'
-- | Craft the section header, inserting the secton reference, if supplied.
sectionHeader :: Bool -- True for unnumbered