Skip to content

Instantly share code, notes, and snippets.

@dnguyen85
Created October 17, 2015 17:54
Show Gist options
  • Save dnguyen85/37405bf85183bd5d59db to your computer and use it in GitHub Desktop.
Save dnguyen85/37405bf85183bd5d59db to your computer and use it in GitHub Desktop.
Markdown to baretex conversion
.phony: all
# SRC is a list of all .md files
SRC=$(wildcard *.md)
# OBJ is a list of all files in $(SRC), but replacing extension
OBJ=$(SRC:.md=.tex)
# Convert a.md to a.tex
%.tex: %.md
scholdoc --natbib --no-standalone -o $@ $<
# Run tex conversion for each target in OBJ
all: $(OBJ)
# replace `\citep` (in natbib) with regular `\cite`
sed -i -e 's/\\citep/\\cite/g' $^
# remove the last line
sed -i '/\\section{References}/d' $^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment