2019-09-09 02:43:57 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-09-15 05:16:45 +00:00
|
|
|
TEXML_HOME=$HOME/Library/texmf/tex/latex
|
|
|
|
PDF_JOINER="/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py"
|
|
|
|
|
|
|
|
function setup_pdflatex {
|
|
|
|
if [ ! -d $TEXML_HOME ]; then
|
|
|
|
mkdir -p $TEXML_HOME
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d $TEXML_HOME/tex ]; then
|
|
|
|
ln -s "`realpath tex`" $TEXML_HOME
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function make_pdf {
|
|
|
|
infile="`realpath "$1"`"
|
|
|
|
indir=$(dirname "$1")
|
|
|
|
pdf_outdir="`realpath "build/pdf"`/${indir#songs/}"
|
|
|
|
#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"
|
|
|
|
pdfs="$pdfs \"build/pdf/$p.pdf\""
|
|
|
|
done < $1
|
|
|
|
|
|
|
|
mkdir -p "build/packets"
|
|
|
|
#echo "$PDF_JOINER" --output "build/$1.pdf" $pdfs
|
|
|
|
|
|
|
|
pdflatex \
|
|
|
|
-interaction=nonstopmode \
|
|
|
|
-output-directory="build/packets" \
|
|
|
|
"$1"
|
|
|
|
}
|
|
|
|
|
|
|
|
setup_pdflatex
|
2019-09-17 04:34:25 +00:00
|
|
|
make_pdf "$1"
|
2019-09-15 05:16:45 +00:00
|
|
|
|
2019-09-17 04:34:25 +00:00
|
|
|
#make_packet "packets/aircoustic201910.tex"
|