Created
September 21, 2016 17:54
-
-
Save nikoheikkila/b3dd54f81b01ccd6792267f7bbb2f691 to your computer and use it in GitHub Desktop.
Pandoc Makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Put this Makefile in your project directory---i.e., the directory | |
## containing the paper you are writing. Assuming you are using the | |
## rest of the toolchain here, you can use it to create .html, .tex, | |
## and .pdf output files from | |
## your markdown file. | |
## - Change the paths at the top of the file as needed. | |
## - Using `make` without arguments will generate html, tex, and pdf | |
## output files from all of the files with the designated markdown | |
## extension. The default is `.md` but you can change this. | |
## - You can specify an output format with `make tex`, `make pdf` or | |
## - `make html`. | |
## - Doing `make clean` will remove all the .tex, .html, and .pdf files | |
## in your working directory. Make sure you do not have files in these | |
## formats that you want to keep! | |
## Markdown extension (e.g. md, markdown, mdown). | |
MEXT = md | |
## All markdown files in the working directory | |
SRC = $(wildcard *.$(MEXT)) | |
## Location of Pandoc support files. | |
## Windows | |
PREFIX = C:\Users\nikoheikkila\AppData\Roaming\pandoc | |
## OSX & UNIX | |
## PREFIX = ~/.pandoc | |
## CSL stylesheet (located in the csl folder of the PREFIX directory). | |
CSL = apsa | |
DOCX=$(SRC:.md=.docx) | |
HTML=$(SRC:.md=.html) | |
PDF=$(SRC:.md=.pdf) | |
all: clean $(DOCX) $(HTML) $(PDF) | |
html: clean $(HTML) | |
docx: clean $(DOCX) | |
pdf: clean $(PDF) | |
%.html: %.md | |
pandoc -r markdown+simple_tables+table_captions+yaml_metadata_block -w html -S --template=$(PREFIX)/templates/html.template --css=$(PREFIX)/marked/kultiad-serif.css --filter pandoc-citeproc --csl=$(PREFIX)/csl/$(CSL).csl -o $@ $< | |
%.docx: %.md | |
pandoc -r markdown+simple_tables+table_captions+yaml_metadata_block -w docx -s -S --filter pandoc-citeproc --csl=$(PREFIX)/csl/ajps.csl -o $@ $< | |
%.pdf: %.md | |
pandoc -r markdown+simple_tables+table_captions+yaml_metadata_block -w latex -s -S --filter pandoc-citeproc --template=$(PREFIX)/templates/article.latex --csl=$(PREFIX)/csl/ajps.csl -o $@ $< | |
clean: | |
rm -f *.html *.docx *.pdf |
Nice, I have used this file a while ago. Now, I noticed that in recent versions of
pandoc
, it complains about the-S
switch being deprecated. Also, I use--filter pandoc-xnos
for PDF output, right before--filter pandoc-citeproc
.
Btw, do you run it on Windows 10? I was unable to get it to work, couldn't even installmake
. It runs very well on Linux though (Debian 9, Ubuntu 18.04).
Thanks for the heads up. I haven't updated Pandoc for a while now.
I've also used Windows 10 but under WSL for this, so yes, Linux and macOS are at least supported. If you have any suggestions for pure Windows, shoot me a message.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice, I have used this file a while ago. Now, I noticed that in recent versions of
pandoc
, it complains about the-S
switch being deprecated. Also, I use--filter pandoc-xnos
for PDF output, right before--filter pandoc-citeproc
.Btw, do you run it on Windows 10? I was unable to get it to work, couldn't even install
make
. It runs very well on Linux though (Debian 9, Ubuntu 18.04).