Question

Is there a LaTeX style, header, or something so that e.g. markdown2pdf from pandoc would produce a PDF having a new page with each H1/markdown heading? Cheers

Was it helpful?

Solution

Using a recent version of pandoc, you can do this:

pandoc myslides.txt -t beamer -o myslides.pdf

and you will get a nicely formatted PDF slide show. For further instructions, see the pandoc User's Guide.

OTHER TIPS

This should be a comment akin jleedev's mentioning the post on using markdown for beamer presentations, which in any case seems a little simpler (and better documented!). I was going to mention some pandoc 'filters' on bitbucket, https://bitbucket.org/mpastell/pandoc-filters, including one for beamer. It provides for ordinary pandoc image import syntax, for what that is worth.

They work through Pandoc's json machinery which I don't know much about, together with the sort of transformation explained in http://johnmacfarlane.net/pandoc/scripting.html. I'm not sure why the route through json is used. The effect is not that different from the perl substitutions used the in post above. In any case, this command:

pandoc -r markdown -w json deg.txt | runhaskell beamer.hs | pandoc -r json -w latex -s --template=templates/beamer.template > deg.tex

seems to work fine on a very simple text divided into level one sections. -- With the one proviso, that \begin{document} is immediately followed by an \end {frame}. This may be inevitable given the extreme simplicity of the file https://bitbucket.org/mpastell/pandoc-filters/src/6cd7b8522cf5/beamer.hs which is much like the first example Behead.hs on the "Scripting with Pandoc" page. In any case, it is clear that you are meant to begin your markdown file with a bit of LaTeX, presumably beamer-specific. If you stick something like

\begin{frame}{\;}
\center{What I did on my summer vacation}
\center{Meredith Alvarez}

at the start of your markdown file, it all works fine, but I assume something more beamer-specific is intended. It could do with a little more documentation!

The middle process, runhaskell beamer.hs is very slow, but it's instantaneous if you compile it and run

pandoc -r markdown -w json deg.txt | ./beamer | pandoc -r json -w latex -s --template=templates/beamer.template > deg.tex

You might want to take a look at MMD2PDF, a command line utility, converts MultiMarkDown text files to PDF documents, adding a few extra's like options to include webpages and support for page-breaks. It is a portable utility, it will leave no traces in registry or on your file system.

http://code.google.com/p/mmd2pdf

There are native beamer support features (along with S5 and many other open PPT-replacements) in Pandoc; read the docs, search the mail list and you'll find lots of details. BTW FFR the pandoc mailing list is very responsive, including getting quick feedback from John M (the lead developer) himself directly.

Regarding the specific content of your question regarding page-breaks on sections, this is a normal feature of LaTeX, therefore fully supported in Pandoc - just use the normal pandocs option to specify a latex stylesheet and stick with the pandocs native markdown input.

Of course, this does require a little latex knowledge, but IMO better that than having to deal with an entirely different package.

I couldn't get any of the pandoc solutions to work. (Though I didn't spend any time trying to figure out why.)

Assuming you're using something like Slidify of Slidy to obtain your HTML slides, you could try this workaround that did surprisingly well for me:

I merely printed to PDF from within Chrome. Setting the layout to landscape and options to background colors and images gave me all the goodies.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top