git.iko.soy/typeable/pandoc
on master help sign in
LaTeX writer:
e58a55efiddlosopher
src/Text/Pandoc/Writers/LaTeX.hs+11−6
@@ -40,12 +40,17 @@ writeLaTeX :: WriterOptions -> Pandoc -> String
40writeLaTeX options (Pandoc meta blocks) =
40writeLaTeX options (Pandoc meta blocks) =
41 let body = (writerIncludeBefore options) ++
41 let body = (writerIncludeBefore options) ++
42 (concatMap blockToLaTeX blocks) ++
42 (concatMap blockToLaTeX blocks) ++
43− (writerIncludeAfter options) in
43+ (writerIncludeAfter options)
44− let head = if writerStandalone options
44+ head = if writerStandalone options
45 then latexHeader options meta
45 then latexHeader options meta
46− else "" in
46+ else ""
47+ toc = if writerTableOfContents options
48+ then "\\tableofcontents\n\n"
49+ else ""
47− let foot = if writerStandalone options then "\n\\end{document}\n" else "" in
50+ foot = if writerStandalone options
51+ then "\n\\end{document}\n"
52+ else ""
48− head ++ body ++ foot
53+ in head ++ toc ++ body ++ foot
49
54
50-- | Insert bibliographic information into LaTeX header.
55-- | Insert bibliographic information into LaTeX header.
51latexHeader :: WriterOptions -- ^ Options, including LaTeX header
56latexHeader :: WriterOptions -- ^ Options, including LaTeX header
@@ -62,7 +67,7 @@ latexHeader options (Meta title authors date) =
62 datetext = if date == ""
67 datetext = if date == ""
63 then ""
68 then ""
64 else "\\date{" ++ stringToLaTeX date ++ "}\n"
69 else "\\date{" ++ stringToLaTeX date ++ "}\n"
65− maketitle = if null title then "" else "\\maketitle\n"
70+ maketitle = if null title then "" else "\\maketitle\n\n"
66 secnumline = if (writerNumberSections options)
71 secnumline = if (writerNumberSections options)
67 then ""
72 then ""
68 else "\\setcounter{secnumdepth}{0}\n"
73 else "\\setcounter{secnumdepth}{0}\n"
tests/writer.latex+1
@@ -18,6 +18,7 @@
18\date{July 17, 2006}
18\date{July 17, 2006}
19\begin{document}
19\begin{document}
20\maketitle
20\maketitle
21+
21This is a set of tests for pandoc. Most of them are adapted from John Gruber's markdown test suite.
22This is a set of tests for pandoc. Most of them are adapted from John Gruber's markdown test suite.
22
23
23\begin{center}\rule{3in}{0.4pt}\end{center}
24\begin{center}\rule{3in}{0.4pt}\end{center}