-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
executable file
·91 lines (74 loc) · 2.41 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
pandoc_args = -f markdown --filter pandoc-tablenos --filter pandoc-fignos --bibliography=refs.bib --smart
name=dissertation
data= logs/stats.csv
progressfile='./progress/data.csv'
all: mostlyclean docx
all.md:
cat writing-files.txt | parallel -n1 -j1 cat {} " && " echo "" >all.md
stats:
# Show chart of word count progress
cat logs/stats.csv | Rscript workspace/vis-progress.r
refs:
perl -pe "s:^(@.*{.*_)\?*:\1:g" refs.bib | perl -pe "s/^(@.*{.*):_/\1_/g" | perl -pe "s/co-cre/cocre/g" >refs.bib2
mv refs.bib2 refs.bib
defense:
pandoc -t revealjs \
-s proposal-defense/talk.md \
-o proposal-defense/talk.html \
--slide-level=2 \
-V theme=moon \
--mathjax \
$(pandoc_args)
defensepdf:
pandoc -t beamer \
-s proposal-defense/talk.md \
-o proposal-defense/talk.pdf \
--mathjax \
$(pandoc_args)
count:
./count.sh >> $(progressfile)
tail $(progressfile)
report:
# Update stats
echo -e "\nWORD COUNT"
wc -w summary.md document/*_*.md
# Also save a tab-saparated machine-readable version
wc -w summary.md document/*_*md | perl -pe "s/ +/\t/g" | \
perl -pe "s/^(\d)/\t\1/g" | perl -pe "s/^/`date +%s`/g" >>$(data)
# Visualize
# Run stats ./scripts/visualizeStats.sh
tex: refs
# Convert Chapters to LaTex
cat writing-files.txt | parallel pandoc -t latex $(pandoc_args) --id-prefix={.} --biblatex --chapters -o {.}.tex {}
# Fix underscores in \cite, \autocite, and \textcite commands
# ls document/*_*.md | parallel "perl -i -p -e 's{cite{.*}}{$& =~ s/_/\\\_/gr}ge' {}"
pdf: refs tex
# Compile to PDF and view
export TEXINPUTS=document//:texstyles//
pdflatex --include-directory=document --include-directory=texstyles $(name)
biber $(name)
pdflatex --include-directory=document --include-directory=texstyles $(name)
# Check if I'm using any ill-advised subsubsubheadings
# grep -q "#####" document/*md
html: refs all.md
pandoc $(pandoc_args) -t html --table-of-contents \
--template pandoc-bootstrap-template/template.html \
--css pandoc-bootstrap-template/template.css -o $(name).html all.md
docx: refs all.md
sed "s:../images/:images/:g" all.md >all-links-fixed.md
pandoc $(pandoc_args) -t docx -o $(name).docx all-links-fixed.md
rm all-links-fixed.md
mostlyclean:
rm -f all.md
rm -f document/[1-5]_*.tex
rm -f *.aux
rm -f $(name).lof
rm -f $(name).lot
rm -f $(name).dvi
rm -f $(name).bbl
rm -f $(name).blg
clean: mostlyclean
rm -f *~
rm -f document/*~
rm -f $(name).docx
rm -f $(name).html