-
Notifications
You must be signed in to change notification settings - Fork 3
/
.make-pages.sh
executable file
·70 lines (48 loc) · 1.94 KB
/
.make-pages.sh
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
#!/bin/bash
# Makes pdf version then html version then copies html to docs
SCPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
# SCPT_DIR=/Volumes/Data/Courses/Choice/LectureNotes/AssetPricing/Handouts/LucasAPM-07Crisis
jobName="LucasAssetPrice"
cp .latexmkrc_gh-pages .latexmkrc
latexmk -C
# get default formatting stuff
cmd="/bin/bash `kpsewhich tex4htMakeCFG.sh` $jobName"
echo "$cmd"
eval "$cmd"
# Tables need to be tabular not pictures
rpl ',pic-tabular}' '}' *.cfg
econ_ark_theme=/tmp/econ-ark-html-theme
curl https://raw.githubusercontent.com/econ-ark/econ-ark-tools/master/Web/Styling/REMARKs-HTML/econ-ark-html-theme.css -o $econ_ark_theme.css
cp $econ_ark_theme.css page-style.css
cmd="[[ ! -e _config.yml ]] && echo 'theme: jekyll-theme-minimal' > _config.yml"
echo "$cmd" ; eval "$cmd"
latexmk -c
# make4ht is unreliable in getting bib entries right, unless the file has already been compiled
# as a dvi
pdflatex -output-format=dvi "$jobName"
bibtex "$jobName"
# pdflatex -output-format=dvi "$jobName"
# pdflatex -output-format=dvi "$jobName"
cmd="source ~/.bash_profile ; make4ht --loglevel error --utf8 --config $jobName.cfg --format html5 $(basename $jobName) "'"svg"'" "'"-cunihtf -utf8"'""
# compiling it with make4ht generates the $jobName.css file
echo "$cmd"
eval "$cmd"
cp "$jobName.css" "$jobName-generated-by-make4ht.css"
# Update style files
css="cat page-style.css | cat - $jobName-generated-by-make4ht.css > $jobName-page-style.css && mv $jobName-page-style.css $jobName.css"
# Replace make4ht-generated css with augmented
eval "$css"
rm -f page-style.css && rm -f $jobName-generated-by-make4ht.css
cp $jobName.html index.html
mkdir -p docs
mv *.html *.yml *.css *.cfg *.svg *.mk4 *.idv *.dvi *.lg .latexmkrc docs
cp *.pdf *.bib *.xref *.bib "$jobName.tex" docs
cp .latexmkrc_main .latexmkrc
latexmk -c
latexmk "$jobName"
bibtex "$jobName"
latexmk "$jobName"
latexmk -c
rm -f .latexmkrc
cd docs
open index.html