2 # Well-behaved repeating TeX builder -- Matt McCutchen
3 # usage: retex <cmd> <input-file-minus-.tex>
12 echo "[$iter] Running $2..."
13 yes X | "$cmd" -file-line-error-style "$in"
17 echo "Comparing files..."
19 # ignore pdfs because they have a nonreproducible "ID" at the end
20 # and logs because they aren't read
21 if ! [ "$f" != "${f%.keep*}" ] && ! [ "$f" != "${f%.pdf}" ] \
22 && ! [ "$f" != "${f%.log}" ]; then
24 cmp "$in$suf" "$in.keep$suf" || return $?
27 echo "Reached a fixed point."
31 echo "Keeping files..."
33 if ! [ "$f" != "${f%.keep*}" ]; then
35 \cp -p "$in$suf" "$in.keep$suf"
41 echo "Cleaning up kept files..."
46 echo "Compiler exited with code $1."
47 # Remove output files here, a la .DELETE_ON_ERROR?
57 if [ $iter -ge $limit ]; then
58 echo "Did not reach a fixed point in $limit tries."