>From a87bed749d870ce45fd7b328f4099a58271dfa20 Mon Sep 17 00:00:00 2001 From: Akira Yokosawa <akiyks@xxxxxxxxx> Date: Mon, 13 Mar 2017 20:42:39 +0900 Subject: [PATCH v2 1/6] runlatex.sh: Refactor further This won't result in reducing line count, but is worth doing. Signed-off-by: Akira Yokosawa <akiyks@xxxxxxxxx> --- utilities/runlatex.sh | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/utilities/runlatex.sh b/utilities/runlatex.sh index e6b3938..cece545 100644 --- a/utilities/runlatex.sh +++ b/utilities/runlatex.sh @@ -39,6 +39,17 @@ diff_warning () { fi } +identical_warnings () { + if test -r $basename-warning-prev.log + then + if test "$iter" -gt "$min_iter" && diff_warning + then + return 0 ; + fi + fi + return 1 ; +} + iterate_latex () { pdflatex $basename > /dev/null 2>&1 < /dev/null || : if grep -q '! Emergency stop.' $basename.log @@ -76,27 +87,23 @@ rm -f $basename-first.log iter=2 echo "pdflatex 2 for $basename.pdf # for possible bib update" iterate_latex +min_iter=2 while grep -q 'LaTeX Warning: There were undefined references' $basename.log do - if test -r $basename-warning-prev.log + if identical_warnings then - if test "$iter" -gt 2 && diff_warning - then - break - fi + break fi iter=`expr $iter + 1` echo "pdflatex $iter for $basename.pdf # remaining undefined refs" iterate_latex done +min_iter=3 while grep -q 'LaTeX Warning: Label(s) may have changed' $basename.log do - if test -r $basename-warning-prev.log + if identical_warnings then - if test "$iter" -gt 3 && diff_warning - then - break - fi + break fi iter=`expr $iter + 1` echo "pdflatex $iter for $basename.pdf # label(s) may have changed" -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe perfbook" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html