-%.pdf: %.tex
- perl -p -e 's/©//' refs.bib > refs-cleaned.bib
- recode -d u8..ltex < refs-cleaned.bib > refs-processed.bib
- rubber -fd $<
+# use the following section for Rnw/knitr documents
+# all: $(patsubst %.Rnw,%.pdf,$(wildcard *.Rnw))
+# %.tex: %.Rnw
+# Rscript -e "library(knitr); knit('$<')"
+
+refs-processed.bib:
+ perl -p -e 's/©//' refs.bib > refs-processed.bib
+ perl -0pe 's/,\s+(file|abstract) = \{.*?\}(,\n|\n)/\2/sg' refs-processed.bib |sponge refs-processed.bib
+ recode -d u8..ltex < refs-processed.bib | sponge refs-processed.bib
+
+%.pdf: %.tex refs-processed.bib
+ latexmk -f -pdf $<