aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-04-30 09:26:15 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-04-30 09:26:15 -0700
commit9961dc274ac29698f68bb7ac47d0259df93563e4 (patch)
treee4e27a3d26739f7fc494606b14e1bd3bb7a9b562 /src/Text/Pandoc
parent8201257b5c13f90f14aa529fac1b341fd1a900eb (diff)
downloadpandoc-9961dc274ac29698f68bb7ac47d0259df93563e4.tar.gz
Improved spacing around LaTeX block environments.
verbatim, itemize, description, enumerate.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index b114e4444..6460f98f7 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -298,7 +298,11 @@ blockToLaTeX (CodeBlock (_,classes,keyvalAttr) str) = do
return "Verbatim"
else return "verbatim"
return $ flush (text ("\\begin{" ++ env ++ "}") $$ text str $$
- text ("\\end{" ++ env ++ "}")) $$ cr -- final cr because of notes
+ text ("\\end{" ++ env ++ "}")) <> text "\n" <> blankline
+ -- note: we use 'text "\n"' instead of cr to make this
+ -- resistant to the 'chomp' in footnotes; a footnote
+ -- ending with a Verbatim environment must have a
+ -- cr before the closing }
listingsCodeBlock = do
st <- get
let params = if writerListings (stOptions st)
@@ -339,7 +343,8 @@ blockToLaTeX (BulletList lst) = do
incremental <- gets stIncremental
let inc = if incremental then "[<+->]" else ""
items <- mapM listItemToLaTeX lst
- return $ text ("\\begin{itemize}" ++ inc) $$ vcat items $$ "\\end{itemize}"
+ return $ text ("\\begin{itemize}" ++ inc) $$ chomp (vcat items) $$
+ "\\end{itemize}" <> blankline
blockToLaTeX (OrderedList (start, numstyle, numdelim) lst) = do
st <- get
let inc = if stIncremental st then "[<+->]" else ""
@@ -360,12 +365,13 @@ blockToLaTeX (OrderedList (start, numstyle, numdelim) lst) = do
"}{" ++ show (start - 1) ++ "}"
else empty
return $ text ("\\begin{enumerate}" ++ inc) <> exemplar $$ resetcounter $$
- vcat items $$ "\\end{enumerate}"
+ chomp (vcat items) $$ "\\end{enumerate}" <> blankline
blockToLaTeX (DefinitionList lst) = do
incremental <- gets stIncremental
let inc = if incremental then "[<+->]" else ""
items <- mapM defListItemToLaTeX lst
- return $ text ("\\begin{description}" ++ inc) $$ vcat items $$ "\\end{description}"
+ return $ text ("\\begin{description}" ++ inc) $$ chomp (vcat items) $$
+ "\\end{description}" <> blankline
blockToLaTeX HorizontalRule = return $
"\\begin{center}\\rule{3in}{0.4pt}\\end{center}" $$ blankline
blockToLaTeX (Header level lst) = sectionHeader "" level lst
@@ -595,7 +601,7 @@ inlineToLaTeX (Note contents) = do
let marker = cycle ['a'..'z'] !! length curnotes
modify $ \s -> s{ stTableNotes = (marker, contents') : curnotes }
return $ "\\tmark" <> brackets (char marker) <> space
- else return $ "\\footnote" <> braces (nest 2 contents')
+ else return $ "\\footnote" <> braces (chomp $ nest 2 contents')
-- note: a \n before } needed when note ends with a Verbatim environment
citationsToNatbib :: [Citation] -> State WriterState Doc