first set up
Markdown to Printed Booklet
Getting the pdflatex command
To use pandoc to generate pdf you must have the
pdflatex command line command installed. The easiest way to get that is through these texlive packages. I got this trick from this github gist.
sudo apt-get install texlive-latex-base
sudo apt-get install texlive-fonts-recommended
sudo apt-get install texlive-fonts-extra
sudo apt-get install texlive-latex-extra
If these succeeded you should see a version number when you run this command:
Example PDF Command
pandoc --output OUTPUT_FILE_NAME.pdf --from markdown_github+yaml_metadata_block --to latex SOURCE_FILE_1.md SOURCE_FILE_2.md
--from: If you are using markdown pages from a Jekyll blog site, these files will be a combination of
yaml_metadata_block, and we can combine these with the
--to: to make a pdf we're using
latex as our intermediary
--output: put your destination file name here. If you want it to be a pdf, make sure the extension is
.pdf. For troubleshooting, you can change the file extension to
.tex to see the intermediary LaTeX file that's used to make the pdf.
The main reference for this is Pandoc's PDF creation documentation.
You can put LaTeX configuration in the yaml frontmatter block in the first file, and this will apply to all following pages as well. The frontmatter needs a
--- at the top of your file, your context after that, and then another
--- after, just like Jekyll blog posts. I opted to have a separate file for just this configuration versus having it at the top of my first chapter, but that's up to you.
Gotcha: make sure your
LaTeX Booklet Settings
--from contains BOTH markdown and yaml frontmatter (see above).
To get latex to export to half-sheets, here are my yaml frontmatter with the booklet settings. I got some tips from this post. You can see the
documentclass options visually on this blog post, and you can format them in yaml according to pandoc's Variables for LaTeX section. Passing options to the
geometry package is interesting, because you have to pass "paperheight=8.5in" as a string with quotes, not as a nested key:value pair like other things.
title: Debugging Your Brain
author: Casey Watts
LaTeX Double Spacing
author go into the file's metadata as well as cover page
documentclass: book sets a lot of settings to reasonable ones for us (like asymmetrical margins to account for the book binding taking up space)
openany says that chapters can start on the left side pages as well as right
geometry settings here specify half of a "letter" sized piece of paper (folding the 11" side to be 5.5")
You may want to double-space the document for reviewers to write comments in. Add this to the bottom of your yaml frontmatter.
Adobe Booklet Printing
Adobe PDF Reader has booklet printing built in! There is a "Booklet" setting under "Page Sizing & Handling". See more detailed instructions in this Adobe help article