forked from petrelharp/stoch_proc_notes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
73 lines (49 loc) · 2.34 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
SHELL := /bin/bash
# use bash for <( ) syntax
.PHONY : all notes
all : syllabus.html index.html style.html notes
notes : LectureNotes/Lectures/Fall2018/Lecture1/ASPLecture1.html LectureNotes/Lectures/Fall2018/Lecture3/ASPLecture3.html LectureNotes/Lectures/Fall2018/Lecture4/PPP_notes.html LectureNotes/Lectures/Fall2018/Lecture5/ASPLecture5.html LectureNotes/Lectures/Fall2018/Lecture6/ASPlecturenotes.html LectureNotes/Lectures/Fall2018/Lecture7/ASPLecture7.html LectureNotes/Lectures/Fall2018/Lecture8/ASPLecture8.html LectureNotes/Lectures/Fall2018/Lecture9/ASPLecture9.html LectureNotes/Lectures/Fall2018/Lecture10/ASPLecture10.html LectureNotes/Lectures/Fall2018/Lecture11/ASPLecture11.html LectureNotes/Lectures/Fall2018/Lecture12/ASPLecture12.html LectureNotes/Lectures/Fall2018/Lecture13/ASPLecture13.html
%.html : %.latexml.html
mv $< $@
MATHJAX = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js
# may want to add "--self-contained" to the following
PANDOC_OPTS = --mathjax=$(MATHJAX)?config=TeX-AMS-MML_HTMLorMML --standalone --self-contained
# optionally add in a latex file with macros
LATEX_MACROS = macros.tex
ifeq ($(wildcard $(LATEX_MACROS)),)
# macros file isn't there
else
PANDOC_OPTS += -H .pandoc.$(LATEX_MACROS)
endif
.pandoc.$(LATEX_MACROS) : $(LATEX_MACROS)
(echo '<div style="display: none">'; echo '\['; cat $(LATEX_MACROS); echo '\]'; echo '</div>') > $@
%.html : %.Rmd
Rscript -e 'templater::render_template("$<", output="$@", change.rootdir=TRUE, clean=FALSE)'
%.html : %.md .pandoc.$(LATEX_MACROS)
pandoc -o $@ $(PANDOC_OPTS) $<
%.md : %.Rmd
Rscript -e 'templater::render_template("$<", output="$@", change.rootdir=TRUE)'
%.pdf : %.md
pandoc -o $@ -t latex $<
%.pandoc.html : %.tex
pandoc --lua-filter tikz.lua | pandoc -f latex -o $@ -t html $(PANDOC_OPTS)
##########
# LaTeXML
%.xml : %.tex
latexml --dest=$@ $<
%.latexml.html : %.xml
latexmlpost --dest=$@ $<
##
# Graphics whatnot
# save inkscape svg files as .ink.svg and this'll do the right thing
$(DISPLAYDIR)/%.svg : %.ink.svg
inkscape $< --export-plain-svg=$@
$(DISPLAYDIR)/%.pdf : %.ink.svg
inkscape $< --export-pdf=$@
$(DISPLAYDIR)/%.svg : %.pdf
inkscape $< --export-plain-svg=$@
$(DISPLAYDIR)/%.png : %.pdf
convert -density 300 $< -flatten $@
## things without mathjax
syllabus.html : syllabus.md
pandoc -o $@ --standalone --self-contained $<