From e58a55eb41b3f8e9c3a2a2a91ca12b8ec24a15fd Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Sun, 8 Jul 2007 03:48:07 +0000 Subject: LaTeX writer: + Leave extra blank line after \maketitle + Insert \tableofcontents if --toc option was selected Test suite: + extra blank line after \maketitle in writer.latex git-svn-id: https://pandoc.googlecode.com/svn/trunk@649 788f1e2b-df1e-0410-8736-df70ead52e1b --- src/Text/Pandoc/Writers/LaTeX.hs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 30a277691..41c98c9f0 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -40,12 +40,17 @@ writeLaTeX :: WriterOptions -> Pandoc -> String writeLaTeX options (Pandoc meta blocks) = let body = (writerIncludeBefore options) ++ (concatMap blockToLaTeX blocks) ++ - (writerIncludeAfter options) in - let head = if writerStandalone options + (writerIncludeAfter options) + head = if writerStandalone options then latexHeader options meta - else "" in - let foot = if writerStandalone options then "\n\\end{document}\n" else "" in - head ++ body ++ foot + else "" + toc = if writerTableOfContents options + then "\\tableofcontents\n\n" + else "" + foot = if writerStandalone options + then "\n\\end{document}\n" + else "" + in head ++ toc ++ body ++ foot -- | Insert bibliographic information into LaTeX header. latexHeader :: WriterOptions -- ^ Options, including LaTeX header @@ -62,7 +67,7 @@ latexHeader options (Meta title authors date) = datetext = if date == "" then "" else "\\date{" ++ stringToLaTeX date ++ "}\n" - maketitle = if null title then "" else "\\maketitle\n" + maketitle = if null title then "" else "\\maketitle\n\n" secnumline = if (writerNumberSections options) then "" else "\\setcounter{secnumdepth}{0}\n" -- cgit v1.2.3