I need to create a large document that when printed will be a couple hundred pages. I’d like to do this with something like Markdown. One of my requirements is that the document must have page numbers and a table of contents. Is there a way using Markdown or a similar Markup language to automatically generate a table of contents with associated page numbers? All the stuff I’ve sceen with Markdown so far can automatically generate a table of contents for HTML output but there are no associated page numbers.
Sounds like a job for pandoc.
HTML has no concept of 'pages'; it would probably be possible to kludge something together with
Pandoc can take an arbitrary number of inputs; it adds a newline to the end of each input and concatenates them. The above command will create a PDF designed to be bound as a book - each chapter (signified by a level 1 title) will start on an odd-numbered page. If you don't want this behaviour, use the following:
If you want to save paper and don't mind about chapters just starting wherever the previous one ends (they will even start in the middle of a page), call pandoc without the
You can generate a HTML with a table of contents, but with all the limitations that you listed. It is also possible to generate ODT and Microsoft DOC documents with pandoc, but I think they don't look very good, especially compared to the beautiful PDF generation.
Creating PDFs with pandoc requires a LaTeX engine to be installed; this is pretty trivial on Linux, where you'll have at least one in the repositories, but on Windows it might be a little harder (I wouldn't know, I've never actually tried). As such, it is possible to customise things to your liking with a custom LaTeX template - but I haven't got my head around that yet, so I currently stick with the (pretty nice) defaults.
After some google minutes I noticed that you need your own LaTeX-Template which can passed as an option to pandoc:
However your template needs some modification on the LaTeX site. As a suggestion you can use:
As a starting point you can use the following template. I copied the default template https://github.com/jgm/pandoc-templates/blob/master/default.latex and added some extra stuff.
I am sure that you can remove most of the if-end-combinations. The template needs it to have more options for users.
Have you considered using LaTeX?
The other answers suggest using Pandoc, which looks like it can convert Markdown to LaTeX, but it might be easier to start right in LaTeX.
LaTeX is designed for the creation of print documents, and has things like page numbers and TOC generation built-in. Check out this basic tutorial: http://www.andy-roberts.net/writing/latex