qqz and runlatex improvements
v2 cover qqz and runlatex improvements
From 0a9063f5bfc9a984b505fefe54d347f39e099f58 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sat, 23 Apr 2016 20:37:29 +0900
Subject: [PATCH v2 0/3] qqz and runlatex improvements
Hi,
There have been two issues that bother me a little since I began to build perfbook.pdf myself.
One is the cross-link references of quick quizzes that land on random nearby places in the PDF.
The other is the premature termination of make with warning messages displayed.
I think I have managed to fix both issues.
However, .sty file modification may introduce regressions and should be fully tested before being pushed out. Can anybody on the list test it and give feedback?
Thanks.
Changes since v1:
Refactored runlatex.sh into 3 parts and improved the build behavior in response to the feedbacks from Paul[1].
As the result of the change, *.bbl files are not necessary any more, so a patch to remove them is added.
[1] http://www.spinics.net/lists/perfbook/msg00160.html
Akira Yokosawa (3):
qqz: Improve accuracy of cross-links
Improve behavior of build scripts
Remove *.bbl from repository
.gitignore | 2 +- Makefile | 55 +- perfbook-1c.bbl | 2103 ------------------------------------------- perfbook-hb.bbl | 1949 ---------------------------------------- perfbook.bbl | 2146 -------------------------------------------- qqz.sty | 14 +- utilities/runfirstlatex.sh | 46 + utilities/runlatex.sh | 85 +- 8 files changed, 168 insertions(+), 6232 deletions(-) delete mode 100644 perfbook-1c.bbl delete mode 100644 perfbook-hb.bbl delete mode 100644 perfbook.bbl create mode 100644 utilities/runfirstlatex.sh
Signature · 1 line
1.9.1
PATCH v2 1/3 qqz: Improve accuracy of cross-links
From da7b4f7e910734102b8a4c54cb1e9b3ad599aa04 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Thu, 21 Apr 2016 21:29:57 +0900
Subject: [PATCH v2 1/3] qqz: Improve accuracy of cross-links
In commit 33b93f8258f5 ("qqz: Cross-link questions and answers"), cross-links of quick quizzes and their answers were implemented. However it uses the \stepcounter{} command, and direct references of 'quickquizctr' counter is not output to the .aux file. The symptom is when you click on a hyperlink in the resulting PDF, you jump to a random nearby label such as that of Figure, Table, or Section, etc. which happens just before the \label{} using 'quickquizctr'.
By using \refstepcounter{} instead and using 2 counters 'quickquizctr' and 'quickquizctrC' ('C' stands for 'Chapter'), each of which is automatically reset at a new chapter and a new section respectively, and defining \theHNum at the head of qqz.sty, then redefining it within the \QuickQuizAnsers command, matching QQ.n.m's and QQA.n.m's are output to the .aux file correctly.
By applying this change, resulting hyperlinks become to jump to places almost exactly where you'd expect.
This change may have the effect of increasing the required number of 'pdflatex' invocations to get a final result. The following commit will take care of it.
--- qqz.sty | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
qqz.sty +8 -6
@@ -15,7 +15,9 @@ %% %% Authors: Paul E. McKenney <[email protected]> -\newcounter{quickquizctr} +\newcounter{quickquizctr}[chapter] +\newcounter{quickquizctrC}[section] +\newcommand*{\theHNum}{\arabic{chapter}.\arabic{quickquizctr}} \newcommand{\QuickQuizAnswerChapter}{\textbf{Unknown QuickQAC!!!}} \newcommand{\QuickQHeading}[3]{\label{#1.#3}\hyperref[#2.#3]{\textbf{Quick Quiz #3:}}}
@@ -23,9 +25,9 @@ \newcommand{\QuickQuizChapter}[2]{ \chapter{#2} \label{#1} - \setcounter{quickquizctr}{0}} + } \newcommand{\QuickQuiz}[1]{ - \stepcounter{quickquizctr} + \refstepcounter{quickquizctr} \QuickQHeading{QQ}{QQA}{\thechapter.\thequickquizctr}} \newcommand{\QuickQuizAnswer}[1]{\rule{7pt}{7pt}} \newcommand{\QuickQuizEnd}{}
@@ -37,6 +39,7 @@ % There is probably a better way to do this, but this does work. \newcommand{\QuickQuizAnswers}{ + \renewcommand*{\theHNum}{\arabic{section}.\arabic{quickquizctrC}} \chapter{Answers to Quick Quizzes} \label{chp:Answers to Quick Quizzes} ~ \\
@@ -46,11 +49,10 @@ \newcommand{\QuickQAC}[2]{ \edef\QuickQuizAnswerChapter{\getrefnumber{#1}} - \setcounter{quickquizctr}{0} \section{#2}} \newcommand{\QuickQ}[1]{ - \stepcounter{quickquizctr} ~ \\ ~ \\ - \QuickQHeading{QQA}{QQ}{\QuickQuizAnswerChapter.\thequickquizctr} #1 ~ \\ } + \refstepcounter{quickquizctrC} ~ \\ ~ \\ + \QuickQHeading{QQA}{QQ}{\QuickQuizAnswerChapter.\thequickquizctrC} #1 ~ \\ } \newcommand{\QuickA}[1]{\rule{7pt}{7pt} \\ ~ \\ \textbf{Answer:} \\ }
Signature · 1 line
1.9.1
PATCH v2 2/3 Improve behavior of build scripts
In reply to Akira YokosawaFrom 04acadf5171ed71178fe9cbf9390e81c9d67587e Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sat, 23 Apr 2016 17:48:42 +0900
Subject: [PATCH v2 2/3] Improve behavior of build scripts
This commit takes care of the possible increase of pdflatex iterations introduced by commit XXXXXXXXXXXX ("qqz: Improve accuracy of cross-links") that would cause 'make' to terminate prematurely. The same issue seems to have been observed since commit 33b93f8258f5 ("qqz: Cross-link questions and answers"). However, no one has attempted to fix it because a final PDF can be obtained by just repeating 'make' again.
To fix the issue, this commit refactors 'runlinux.sh' into 3 parts.
1) bibtex related part is moved to 'Makefile' as rules for targets such as 'perfbook.bbl'. It also adds necessary rules which support the '.bbl' rules.
2) 'runfirstlatex.sh' is added so that it can be invoked in rules for '.aux' targets which support '.bbl' rules.
3) 'runlatex.sh' is intensively modified. The first while loop watches the 'LaTeX Warning: There were undefined references' message and the second one watches the 'LaTeX Warning: Label(s) may have changed' message.
The loops watch the variation in 'LaTeX Warning:" lines in $basename.log and when they find no change, they will give up. Note that in early rounds of the loop, there may be cases when there is no change in 'LaTeX Warning' messages while there remain the warnings being watched. To accommodate this, giving-up will fire only after a certain number of iterations for each loop. Since the minimum iteration numbers are chosen in try-and-error fashion, they might need to be changed in the future.
For each round of the loop, a message representing which warning is being watched is displayed.
When the giving-up condition fires, grep of the remaining warning is also displayed.
'$basename-first.log', '$basename-warning.log' and '$basename-warning-prev.log' files are used to track things. They are removed when the build succeeds.
--- Makefile | 54 ++++++++++++++++++++++++----- utilities/runfirstlatex.sh | 46 +++++++++++++++++++++++++ utilities/runlatex.sh | 85 +++++++++++++++++++++++++++++++++++----------- 3 files changed, 158 insertions(+), 27 deletions(-) create mode 100644 utilities/runfirstlatex.sh
Makefile +46 -8
@@ -145,18 +145,56 @@ EPSSOURCES = \ locking/NonLocalLockHierarchy.eps \ locking/rnplock.eps +BIBSOURCES = \ + bib/OSS.bib \ + bib/RCU.bib \ + bib/RCUuses.bib \ + bib/TM.bib \ + bib/WFS.bib \ + bib/energy.bib \ + bib/hw.bib \ + bib/maze.bib \ + bib/os.bib \ + bib/parallelsys.bib \ + bib/patterns.bib \ + bib/perfmeas.bib \ + bib/realtime.bib \ + bib/refs.bib \ + bib/search.bib \ + bib/standards.bib\ + bib/swtools.bib \ + bib/syncrefs.bib + all: perfbook.pdf -perfbook.pdf: $(LATEXSOURCES) $(EPSSOURCES) extraction embedfonts - sh utilities/runlatex.sh perfbook bib +perfbook.pdf: perfbook.bbl $(LATEXSOURCES) $(EPSSOURCES) extraction embedfonts + sh utilities/runlatex.sh perfbook + +perfbook.bbl: $(BIBSOURCES) perfbook.aux + bibtex perfbook -perfbook-1c.pdf: $(LATEXSOURCES) $(EPSSOURCES) extraction embedfonts +perfbook.aux: $(LATEXSOURCES) $(EPSSOURCES) + sh utilities/runfirstlatex.sh perfbook + +perfbook-1c.pdf: perfbook-1c.bbl $(LATEXSOURCES) $(EPSSOURCES) extraction embedfonts sed -e 's/,twocolumn//' -e '/^\\frontmatter/a \\\\pagestyle{plain}' -e 's/setboolean{twocolumn}{true}/setboolean{twocolumn}{false}/' < perfbook.tex > perfbook-1c.tex - sh utilities/runlatex.sh perfbook-1c bib + sh utilities/runlatex.sh perfbook-1c + +perfbook-1c.bbl: $(BIBSOURCES) perfbook-1c.aux + bibtex perfbook-1c -perfbook-hb.pdf: $(LATEXSOURCES) $(EPSSOURCES) extraction embedfonts +perfbook-1c.aux: $(LATEXSOURCES) $(EPSSOURCES) extraction embedfonts + sh utilities/runfirstlatex.sh perfbook-1c + +perfbook-hb.pdf: perfbook-hb.bbl $(LATEXSOURCES) $(EPSSOURCES) extraction embedfonts sed -e 's/,twocolumn/&,letterpaperhb/' -e 's/setboolean{hardcover}{false}/setboolean{hardcover}{true}/' < perfbook.tex > perfbook-hb.tex - sh utilities/runlatex.sh perfbook-hb bib + sh utilities/runlatex.sh perfbook-hb + +perfbook-hb.bbl: $(BIBSOURCES) perfbook-hb.aux + bibtex perfbook-hb + +perfbook-hb.aux: $(LATEXSOURCES) $(EPSSOURCES) extraction embedfonts + sh utilities/runfirstlatex.sh perfbook-hb perfbook_flat.tex: $(LATEXSOURCES) $(EPSSOURCES) embedfonts echo > qqz.tex
@@ -217,7 +255,7 @@ count/sig-theft.eps: count/sig-theft.dot clean: find . -name '*.aux' -o -name '*.blg' \ -o -name '*.dvi' -o -name '*.log' \ - -o -name '*.qqz' -o -name '*.toc' | xargs rm + -o -name '*.qqz' -o -name '*.toc' | xargs rm -f rm -f perfbook_flat.tex perfbook_html.tex perfbook.out perfbook-1c.out rm -rf perfbook_html rm -f SMPdesign/DiningPhilosopher5.eps \
@@ -230,4 +268,4 @@ distclean: clean neatfreak: distclean # Don't forget to regenerate the .pdf from each .svg file - find . -name '*.pdf' | xargs rm + find . -name '*.pdf' | xargs rm -f
utilities/runfirstlatex.sh new file +46 -0
46 lines not on this page · raw message
utilities/runlatex.sh +66 -19
122 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v2 3/3 Remove *.bbl from repository
In reply to Akira YokosawaFrom 0a9063f5bfc9a984b505fefe54d347f39e099f58 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sat, 23 Apr 2016 19:50:23 +0900
Subject: [PATCH v2 3/3] Remove *.bbl from repository
As rules for '*.bbl' targets are added to 'Makefile' in commit XXXXXXXXXXXX ("Improve behavior of build scripts"), they are no longer necessary in the repository. This commit removes them. It also updates .gitignore and the 'make clean' rule accordingly. It also adds 'perfbook-hb.out' to the 'make clean' rule.
--- .gitignore | 2 +- Makefile | 3 +- perfbook-1c.bbl | 2103 ----------------------------------------------------- perfbook-hb.bbl | 1949 -------------------------------------------------- perfbook.bbl | 2146 ------------------------------------------------------- 5 files changed, 3 insertions(+), 6200 deletions(-) delete mode 100644 perfbook-1c.bbl delete mode 100644 perfbook-hb.bbl delete mode 100644 perfbook.bbl
.gitignore +1 -1
@@ -1,5 +1,5 @@ *.aux -# *.bbl -- but need to figure out what to do with my latex .bib files... +*.bbl *.blg *.dvi *.log
Makefile +2 -1
@@ -255,8 +255,9 @@ count/sig-theft.eps: count/sig-theft.dot clean: find . -name '*.aux' -o -name '*.blg' \ -o -name '*.dvi' -o -name '*.log' \ - -o -name '*.qqz' -o -name '*.toc' | xargs rm -f + -o -name '*.qqz' -o -name '*.toc' -o -name '*.bbl' | xargs rm -f rm -f perfbook_flat.tex perfbook_html.tex perfbook.out perfbook-1c.out + rm -f perfbook-hb.out rm -rf perfbook_html rm -f SMPdesign/DiningPhilosopher5.eps \ SMPdesign/DiningPhilosopher5TB.eps \
perfbook-1c.bbl deleted +0 -2103
2,103 lines not on this page · raw message
perfbook-hb.bbl deleted +0 -1949
881 lines not on this page · raw message
perfbook.bbl deleted +0 -2146
2,146 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.9.1
Part of the diff is not shown here. View the raw message.
Quoted 5 lines · Akira Yokosawa
Quoted 1 line
From
0a9063f5bfc9a984b505fefe54d347f39e099f58Mon Sep 17 00:00:00 2001From: Akira Yokosawa <[email protected]>
Date: Sat, 23 Apr 2016 20:37:29 +0900
Subject: [PATCH v2 0/3] qqz and runlatex improvements
Hi, Paul
I should have mentioned that this series is rebased to the current master 431a80df9d6e ("Fix build error on Fedora 23 with texlive").
Regarding to ("[PATCH v2 2/3] Improve behavior of build scripts"), I want to add some comments in the form of a reply to your previous feedback. As I refactored the script, please note that in-line comments do not exactly match the actual patch.
Quoted 5 lines
To see what I am getting at, please add a "\ref{this is a typo}" or a reference to any other non-\label string, then type "make". This is a pure error that no number of reruns will fix, but the build script will nevertheless crank away multiple times.
I checked several intentional error cases for this patch. However, I'm sure you are the one who will use the scripts most heavily, you might find corner cases I'm not aware of.
Quoted 8 lines
Before, it would run bibtex and stop. (Which, I freely admit, wasn't particularly good behavior either!)
My question is whether it is possible to make the script let the user know why it is re-running latex, so that the user can choose to kill it early, if appropriate. Or, alternatively (and for extra credit!), recognize which labels are undefined, and do more passes if they are quick-quiz links.
I've not gone so far as to distinguish whether a warning is of a quick-quiz link or not, but I think current level of output should be quite useful for most of the cases. Please give it a try.
Quoted 20 lines
Quoted 11 lines
---
#!/bin/sh
# [snip]
#if test -z "$1"
then
echo No latex file, aborting.
exit 1
fiQuoted 8 lines
basename=
echo $1 | sed -e 's/\.tex$//'iter=1
echo "pdflatex $iter"
pdflatex $basename >/dev/null2>&1 </dev/null|| :
if grep -q '! Emergency stop.' $basename.log
then
echo "----- Fatal latex error, see $basename.log for details. -----"
Quoted 3 lines
Please add "exit 1" here. (Yes, this was a bug in my orignal. But as long as we are here...)
Done.
Quoted 19 lines
Quoted 9 lines
fi
if grep -q 'LaTeX Warning: There were undefined references' $basename.log thenif test -d "$2" then bibtex $basename || : else echo "No bibliography directory, skipping bibtex." fiQuoted 9 lines
fi
while grep -q 'LaTeX Warning: There were undefined references' $basename.log do
if test "$iter" -eq 4
then
echo "Iteration limit: $iter passes through pdflatex" exit 1
fi
iter=expr $iter + 1
Quoted 5 lines
This would be one point to add some indication of why we are doing another pass through the loop. Might be as simple as adding "Undefined references" to the "echo" below. Or maybe even show the last symbol listed as undefined.
Done.
And I made a change so that the giving-up of the iteration is decided by the result of comparison of recent two logs. When they have identical warnings, giving-up logic kicks in (note that there are special cases mentioned in the commit message) and the remaining warning messages will be displayed. The messages should contain the info of undefined symbols.
Quoted 17 lines
Quoted 8 lines
echo "pdflatex $iter"
pdflatex $basename >/dev/null2>&1 </dev/null|| :
if grep -q '! Emergency stop.' $basename.log
then
echo "----- Fatal latex error, see $basename.log for details. -----" exit 1
fi
doneQuoted 8 lines
while grep -q 'LaTeX Warning: Label(s) may have changed' $basename.log do
if test "$iter" -ge 4
then
echo "Iteration limit: $iter passes through pdflatex" exit 1
fi
iter=expr $iter + 1
Quoted 4 lines
This would be one point to add some indication of why we are doing another pass through the loop. Might be as simple as adding "Label(s) may have changed" to the "echo" below.
Done.
Quoted 13 lines
Quoted 11 lines
echo "pdflatex $iter"
pdflatex $basename >/dev/null2>&1 </dev/null|| :
if grep -q '! Emergency stop.' $basename.log
then
echo "----- Fatal latex error, see $basename.log for details. -----" exit 1
fi
done
grep "LaTeX Warning:" $basename.log
exit 0
As for the bibtex part moved to Makefile, I made '.bbl' be dependent on '.aux.'
'.aux' requires pdflatex to run for the first time, so I separated 'runfirstlatex.sh.' Since '.aux' is always updated by pdflatex, this means that bibtex is always invoked for a normal 'make.'
If you absolutely want bibtex *not* to run (and you are sure that '.bib' files are not modified), touch a related '.bbl' file just before a 'make'. Then 'runfirstlatex.sh' won't be invoked. But I think bibtex itself is fairly quick, and simply doing 'make' is acceptable. Please give it a try and let me know how it feels like.
I also made changes in the comment area at the head of each script. I added my copyright notices there, but not sure if those are what are expected. Could you please give a look at them, too?
Thanks, Akira
Quoted 21 lines · Akira Yokosawa
Quoted 1 line
From
0a9063f5bfc9a984b505fefe54d347f39e099f58Mon Sep 17 00:00:00 2001From: Akira Yokosawa <[email protected]>
Date: Sat, 23 Apr 2016 20:37:29 +0900
Subject: [PATCH v2 0/3] qqz and runlatex improvementsHi,
There have been two issues that bother me a little since I began to build perfbook.pdf myself.
One is the cross-link references of quick quizzes that land on random nearby places in the PDF.
The other is the premature termination of make with warning messages displayed.
I think I have managed to fix both issues.However, .sty file modification may introduce regressions and should be fully tested before being pushed out. Can anybody on the list test it and give feedback?
Thanks.
Quoted 7 lines
Changes since v1:
Refactoredrunlatex.shinto 3 parts and improved the build behavior in response to the feedbacks from Paul[1].
As the result of the change, *.bbl files are not necessary any more, so a patch to remove them is added.
I played around with it a bit, and it is very nice, a definite improvement over my original!!! Thank you!
Just a couple of very small things left:
1. Because perfbook currently has a fairly low change rate and
a mostly linear history, please feel free to put something like "previous commit" or "next commit" in place of your X-ed-out SHA-1 commit IDs.
If you really want to include the SHA-1 numbers for the backwards references, that is fine, just set them up and send me a pull request. (When I "git am" your email, I will get different SHA-1 commit IDs than you got, but "git pull" preserves the IDs.)
Your choice!
2. The second patch gets a trailing-whitespace error. Could you
please fix that?
Thanx, Paul
Quoted 22 lines
Akira Yokosawa (3):
qqz: Improve accuracy of cross-links
Improve behavior of build scripts
Remove *.bbl from repository.gitignore | 2 +- Makefile | 55 +- perfbook-1c.bbl | 2103 ------------------------------------------- perfbook-hb.bbl | 1949 ---------------------------------------- perfbook.bbl | 2146 -------------------------------------------- qqz.sty | 14 +- utilities/runfirstlatex.sh | 46 + utilities/runlatex.sh | 85 +- 8 files changed, 168 insertions(+), 6232 deletions(-) delete mode 100644 perfbook-1c.bbl delete mode 100644 perfbook-hb.bbl delete mode 100644 perfbook.bbl create mode 100644 utilities/runfirstlatex.shSignature · 1 line
1.9.1
Quoted 9 lines · Akira Yokosawa
Quoted 5 lines · Akira Yokosawa
Quoted 1 line
From
0a9063f5bfc9a984b505fefe54d347f39e099f58Mon Sep 17 00:00:00 2001From: Akira Yokosawa <[email protected]>
Date: Sat, 23 Apr 2016 20:37:29 +0900
Subject: [PATCH v2 0/3] qqz and runlatex improvementsHi, Paul
Quoted 7 lines
I should have mentioned that this series is rebased to the current master
431a80df9d6e("Fix build error on Fedora 23 with texlive").Regarding to ("[PATCH v2 2/3] Improve behavior of build scripts"), I want to add some comments in the form of a reply to your previous feedback. As I refactored the script, please note that in-line comments do not exactly match the actual patch.
Feel free to update the comments either as part of your upcoming series/pull, or as a separate follow-on patch.
Quoted 8 lines
Quoted 4 lines
To see what I am getting at, please add a "\ref{this is a typo}" or a reference to any other non-\label string, then type "make". This is a pure error that no number of reruns will fix, but the build script will nevertheless crank away multiple times.
I checked several intentional error cases for this patch. However, I'm sure you are the one who will use the scripts most heavily, you might find corner cases I'm not aware of.
I tried a number of things, including adding undefined references, deleting and re-adding full chapters, and so on. It worked quite well.
Quoted 9 lines
Quoted 8 lines
Before, it would run bibtex and stop. (Which, I freely admit, wasn't particularly good behavior either!)
My question is whether it is possible to make the script let the user know why it is re-running latex, so that the user can choose to kill it early, if appropriate. Or, alternatively (and for extra credit!), recognize which labels are undefined, and do more passes if they are quick-quiz links.
Quoted 3 lines
I've not gone so far as to distinguish whether a warning is of a quick-quiz link or not, but I think current level of output should be quite useful for most of the cases. Please give it a try.
I am sure that further improvement is possible, but I definitely would like to queue up what you currently have. Please fix up the XXXX strings in the commit logs and remove the trailing whitespace from the second patch and resend, and I will queue the result.
Thanx, Paul
Quoted 114 lines
Quoted 20 lines
Quoted 11 lines
---
#!/bin/sh
# [snip]
#if test -z "$1"
then
echo No latex file, aborting.
exit 1
fiQuoted 8 lines
basename=
echo $1 | sed -e 's/\.tex$//'iter=1
echo "pdflatex $iter"
pdflatex $basename >/dev/null2>&1 </dev/null|| :
if grep -q '! Emergency stop.' $basename.log
then
echo "----- Fatal latex error, see $basename.log for details. -----"Quoted 3 lines
Please add "exit 1" here. (Yes, this was a bug in my orignal. But as long as we are here...)
Done.
Quoted 19 lines
Quoted 9 lines
fi
if grep -q 'LaTeX Warning: There were undefined references' $basename.log thenif test -d "$2" then bibtex $basename || : else echo "No bibliography directory, skipping bibtex." fiQuoted 9 lines
fi
while grep -q 'LaTeX Warning: There were undefined references' $basename.log do
if test "$iter" -eq 4
then
echo "Iteration limit: $iter passes through pdflatex" exit 1
fi
iter=expr $iter + 1Quoted 5 lines
This would be one point to add some indication of why we are doing another pass through the loop. Might be as simple as adding "Undefined references" to the "echo" below. Or maybe even show the last symbol listed as undefined.
Done.
And I made a change so that the giving-up of the iteration is decided by the result of comparison of recent two logs. When they have identical warnings, giving-up logic kicks in (note that there are special cases mentioned in the commit message) and the remaining warning messages will be displayed. The messages should contain the info of undefined symbols.
Quoted 17 lines
Quoted 8 lines
echo "pdflatex $iter"
pdflatex $basename >/dev/null2>&1 </dev/null|| :
if grep -q '! Emergency stop.' $basename.log
then
echo "----- Fatal latex error, see $basename.log for details. -----" exit 1
fi
doneQuoted 8 lines
while grep -q 'LaTeX Warning: Label(s) may have changed' $basename.log do
if test "$iter" -ge 4
then
echo "Iteration limit: $iter passes through pdflatex" exit 1
fi
iter=expr $iter + 1Quoted 4 lines
This would be one point to add some indication of why we are doing another pass through the loop. Might be as simple as adding "Label(s) may have changed" to the "echo" below.
Done.
Quoted 13 lines
Quoted 11 lines
echo "pdflatex $iter"
pdflatex $basename >/dev/null2>&1 </dev/null|| :
if grep -q '! Emergency stop.' $basename.log
then
echo "----- Fatal latex error, see $basename.log for details. -----" exit 1
fi
done
grep "LaTeX Warning:" $basename.log
exit 0As for the bibtex part moved to
Makefile, I made '.bbl' be dependent on '.aux.'
'.aux' requires pdflatex to run for the first time, so I separated 'runfirstlatex.sh.' Since '.aux' is always updated by pdflatex, this means that bibtex is always invoked for a normal 'make.'
If you absolutely want bibtex *not* to run (and you are sure that '.bib' files are not modified), touch a related '.bbl' file just before a 'make'. Then 'runfirstlatex.sh' won't be invoked. But I think bibtex itself is fairly quick, and simply doing 'make' is acceptable. Please give it a try and let me know how it feels like.I also made changes in the comment area at the head of each script. I added my copyright notices there, but not sure if those are what are expected. Could you please give a look at them, too?
Thanks, Akira