#!/bin/sh export orig="$(pwd)" export dir="$(dirname $0)" create(){ mkdir imgs cd imgs python3 ../data.py img || python ../data.py img || echo "You must install python3" cd .. mkdir graph cd graph python3 ../data.py depwid || python ../data.py depwid python3 ../data.py nei || python ../data.py nei cd .. mkdir outputs cd document cp ../format.orig.tex ../format.tex pdftex report.tex || echo "You must install \`pdftex\` (MacTeX, TeXLive, MikTeX, etc)" mv pageno.tex .. mv pageno2.tex .. mv report.pdf ../outputs/report-double.pdf sed ../format.orig.tex -e 's/\\baselineskip=24pt/\\baselineskip=14pt/g' >../format.tex pdftex report.tex mv report.pdf ../outputs/report-single.pdf cd .. pdftex pics.tex mv pics.pdf outputs/pics.pdf pdftk outputs/report-double.pdf cat $(expr $(cat pageno.tex) + 1)-$(expr $(cat pageno2.tex) + 1) output outputs/graphs-tables.pdf rm *.log rm document/report.log cp assets/* outputs/ qrencode https://hrhr.dev/r -o qr.png || echo "For QR code, install \`qrencode\`" magick qr.png -gravity south -background white -splice 0x10 -draw 'text 0,0 hrhr.dev/r' outputs/qr.png || echo 'Install imagemagick for qr code' rm format.tex pageno.tex document/pageno.tex pageno2.tex document/pageno2.tex qr.svg } cd $dir create 2>/dev/null cd $orig