From 94ed30cf15bef8d5e6743769144eac23707df2df Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Sat, 28 Jul 2007 03:58:09 +0000 Subject: LaTeX writer: include fancyvrb and \VerbatimFootnotes line in header only if absolutely needed -- that is, only if there is actually a code block in a footnote. git-svn-id: https://pandoc.googlecode.com/svn/trunk@815 788f1e2b-df1e-0410-8736-df70ead52e1b --- src/Text/Pandoc/Writers/LaTeX.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 739b60133..ef96cf7b7 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -130,9 +130,10 @@ blockToLaTeX (BlockQuote lst) = do return $ "\\begin{quote}\n" ++ contents ++ "\\end{quote}\n" blockToLaTeX (CodeBlock str) = do st <- get - let verbEnv = if stInNote st then "Verbatim" else "verbatim" - return $ "\\begin{" ++ verbEnv ++ "}\n" ++ str ++ - "\n\\end{" ++ verbEnv ++ "}\n" + if stInNote st + then do addToHeader "\\usepackage{fancyvrb}" + return $ "\\begin{Verbatim}\n" ++ str ++ "\n\\end{Verbatim}\n" + else return $ "\\begin{verbatim}\n" ++ str ++ "\n\\end{verbatim}\n" blockToLaTeX (RawHtml str) = return "" blockToLaTeX (BulletList lst) = do items <- mapM listItemToLaTeX lst @@ -259,5 +260,4 @@ inlineToLaTeX (Note contents) = do contents' <- blockListToLaTeX contents st <- get put (st {stInNote = False}) - addToHeader "\\usepackage{fancyvrb}" return $ "\\footnote{" ++ stripTrailingNewlines contents' ++ "}" -- cgit v1.2.3