aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs17
-rw-r--r--tests/writer.latex1
2 files changed, 12 insertions, 6 deletions
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"
diff --git a/tests/writer.latex b/tests/writer.latex
index a3bdc06d0..45cb1f473 100644
--- a/tests/writer.latex
+++ b/tests/writer.latex
@@ -18,6 +18,7 @@
\date{July 17, 2006}
\begin{document}
\maketitle
+
This is a set of tests for pandoc. Most of them are adapted from John Gruber's markdown test suite.
\begin{center}\rule{3in}{0.4pt}\end{center}