2020-07-08 03:45:43 +00:00
|
|
|
#!/bin/zsh
|
2019-09-09 02:43:57 +00:00
|
|
|
|
2020-07-14 17:06:42 +00:00
|
|
|
export max_print_line=1000
|
|
|
|
export error_line=254
|
|
|
|
export half_error_line=238
|
|
|
|
|
2019-09-15 05:16:45 +00:00
|
|
|
TEXML_HOME=$HOME/Library/texmf/tex/latex
|
2020-07-08 03:45:43 +00:00
|
|
|
SONGS_HOME=`pwd`
|
2019-09-15 05:16:45 +00:00
|
|
|
|
|
|
|
function setup_pdflatex {
|
|
|
|
if [ ! -d $TEXML_HOME ]; then
|
|
|
|
mkdir -p $TEXML_HOME
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d $TEXML_HOME/tex ]; then
|
2020-07-08 03:45:43 +00:00
|
|
|
ln -s $SONGS_HOME/tex $TEXML_HOME
|
2019-09-15 05:16:45 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function make_pdf {
|
2020-07-08 03:45:43 +00:00
|
|
|
infile="$SONGS_HOME/$1"
|
2019-09-15 05:16:45 +00:00
|
|
|
indir=$(dirname "$1")
|
2020-07-08 03:45:43 +00:00
|
|
|
pdf_outdir="$SONGS_HOME/build/pdf/${indir#songs/}"
|
2019-09-15 05:16:45 +00:00
|
|
|
#aux_outdir="`realpath "aux"`/${indir#songs/}"
|
|
|
|
|
|
|
|
mkdir -p "$pdf_outdir"
|
|
|
|
#mkdir -p "$aux_outdir"
|
|
|
|
|
|
|
|
pdflatex \
|
|
|
|
-interaction=nonstopmode \
|
|
|
|
-output-directory="$pdf_outdir" \
|
|
|
|
"$infile"
|
|
|
|
}
|
|
|
|
|
|
|
|
function make_packet {
|
|
|
|
pdfs=""
|
|
|
|
while read p; do
|
|
|
|
make_pdf "songs/$p.tex"
|
2019-10-06 04:43:47 +00:00
|
|
|
done < <(grep includepdf $1 | grep build/pdf | sed -E 's/.*{build\/pdf\/([^}]*)\.pdf}.*/\1/')
|
2019-09-15 05:16:45 +00:00
|
|
|
|
|
|
|
mkdir -p "build/packets"
|
|
|
|
pdflatex \
|
2019-09-17 05:12:54 +00:00
|
|
|
-interaction=nonstopmode \
|
|
|
|
-output-directory="build/packets" \
|
|
|
|
"$1"
|
2019-09-15 05:16:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
setup_pdflatex
|
2020-07-14 17:06:42 +00:00
|
|
|
#make_pdf "$1"
|
2019-09-15 05:16:45 +00:00
|
|
|
|
2020-07-14 17:06:42 +00:00
|
|
|
make_packet "packets/aircoustic202007.tex"
|