Skip to contentSkip to conversation

qqz and runlatex improvements

PATCH In review Akira Yokosawa 3 participants 15 messages Apr 24, 2016 – May 11, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

v3 cover qqz and runlatex improvements

From 687dd92a14a751c5919c80f9d7d8609db94d7634 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sun, 24 Apr 2016 09:26:52 +0900
Subject: [PATCH v3 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.

Paul tested v2 of this series and found that it is ready to be pushed out if minor fixes of a trailing blank and "XXXXXX" in commit messages are done.

Changes since v2:
Updated copyright notices in qqz.sty
Removed a trailing blank in runfirstlatex.sh
Fixed "XXXXXX" in commit messages
Added "-f" option to "rm" in runlatex.sh
Other minor changes in commit messages

Changes since v1:
Refactored runlatex.sh into 3 parts and improved the build behavior in response to the feedback's 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                    |   18 +-
 utilities/runfirstlatex.sh |   46 +
 utilities/runlatex.sh      |   85 +-
 8 files changed, 172 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
#1 lore raw

PATCH v3 1/3 qqz: Improve accuracy of cross-links

From 6ecb00b37832372d18cdc7ff5eaea9a53eab3cb9 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sun, 24 Apr 2016 08:19:20 +0900
Subject: [PATCH v3 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' iterations to get a final result. The following commit will take care of it.

This commit also updates the copyright notices in the header, including the name of Paolo Bonzini who authored the commit mentioned above.

---
 qqz.sty | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
qqz.sty +12 -6
index 7270468..08229b8 100644
@@ -12,10 +12,16 @@
 %% \QuickQuizAnswers -- to dump out all questions and answers in new section.
 %%
 %% Copyright (C) IBM Corporation, 2008
+%% Copyright (C) Paolo Bonzini, 2015
+%% Copyright (C) Akira Yokosawa, 2016
 %%
 %% Authors: Paul E. McKenney <[email protected]>
+%%          Paolo Bonzini <[email protected]> # cross-link questions and answers
+%%          Akira Yokosawa <[email protected]>   # improvement of cross-link
 
-\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 +29,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 +43,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 +53,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
#2 lore raw

Re: [PATCH v3 1/3] qqz: Improve accuracy of cross-links

Quoted 29 lines · Akira Yokosawa
Quoted 1 line

From 6ecb00b37832372d18cdc7ff5eaea9a53eab3cb9 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Sun, 24 Apr 2016 08:19:20 +0900
Subject: [PATCH v3 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' iterations to get a final result. The following commit will take care of it.

Quoted 5 lines

This commit also updates the copyright notices in the header, including the name of Paolo Bonzini who authored the commit mentioned above.

Hi, Paul.

I noticed there really is a change in the behavior of hyperref's of Chapters. They used to jump to the top of the pages, but after this patch is applied, they jump to the bottom of the Chapter titles. So you need to scroll a little to see the title of the Chapters.

I think this is a regression caused by this patch.

If you do think so, please keep from pushing this series out.

Or the benefit of the patch is big enough compared to the change of the behavior?

Regards, Akira

#3 lore raw

Re: [PATCH v3 1/3] qqz: Improve accuracy of cross-links

Quoted 43 lines · Akira Yokosawa
Quoted 29 lines · Akira Yokosawa
Quoted 1 line

From 6ecb00b37832372d18cdc7ff5eaea9a53eab3cb9 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Sun, 24 Apr 2016 08:19:20 +0900
Subject: [PATCH v3 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' iterations to get a final result. The following commit will take care of it.

Quoted 5 lines

This commit also updates the copyright notices in the header, including the name of Paolo Bonzini who authored the commit mentioned above.

Hi, Paul.

I noticed there really is a change in the behavior of hyperref's of Chapters. They used to jump to the top of the pages, but after this patch is applied, they jump to the bottom of the Chapter titles. So you need to scroll a little to see the title of the Chapters.

Quoted 9 lines

I think this is a regression caused by this patch.

If you do think so, please keep from pushing this series out.

Or the benefit of the patch is big enough compared to the change of the behavior?

Regards, Akira

Hi,

Seems like it is not easy (at least for me) to find out what is wrong in this patch.

So there are a few options I can think of you might want to do (assuming you'd like to push the refactoring of runlatex.sh):

1) Apply the series as a whole, then revert [1/3], and push out.

2) Me resubmit another patch series which just contains the refactoring.

3) Apply the series as a whole, and push it as is in the hope of someone familiar with LaTeX and hyperref might appear.

Thoughts?

Regards, Akira

#4 lore raw

Re: [PATCH v3 1/3] qqz: Improve accuracy of cross-links

Quoted 64 lines · Akira Yokosawa
Quoted 43 lines · Akira Yokosawa
Quoted 29 lines · Akira Yokosawa
Quoted 1 line

From 6ecb00b37832372d18cdc7ff5eaea9a53eab3cb9 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Sun, 24 Apr 2016 08:19:20 +0900
Subject: [PATCH v3 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' iterations to get a final result. The following commit will take care of it.

Quoted 5 lines

This commit also updates the copyright notices in the header, including the name of Paolo Bonzini who authored the commit mentioned above.

Hi, Paul.

I noticed there really is a change in the behavior of hyperref's of Chapters. They used to jump to the top of the pages, but after this patch is applied, they jump to the bottom of the Chapter titles. So you need to scroll a little to see the title of the Chapters.

Quoted 9 lines

I think this is a regression caused by this patch.

If you do think so, please keep from pushing this series out.

Or the benefit of the patch is big enough compared to the change of the behavior?

Regards, Akira

Hi,

Seems like it is not easy (at least for me) to find out what is wrong in this patch.

So there are a few options I can think of you might want to do (assuming you'd like to push the refactoring of runlatex.sh):

1) Apply the series as a whole, then revert [1/3], and push out.

Quoted 9 lines

2) Me resubmit another patch series which just contains the refactoring.

3) Apply the series as a whole, and push it as is in the hope of someone familiar with LaTeX and hyperref might appear.

Thoughts?

Regards, Akira

Hi, Paul.

So, you've pushed the whole series.
And I have to apologize to you for the noise. I've just realized that I compared apples and oranges.

In perfbook.pdf, hyperref of a Chapter jumps to the bottom of its title, while in perfbook-1c.pdf, it jumps to the head of the page.

There was no change in the behavior.

I'm very glad I can contribute the perfbook project in this manner.

So far, patches I submitted were mostly cosmetic changes. I'm planning to submit something that touches the actual contents, too. But don't expect too much.

Thanks so much, Akira

#5 lore raw

Re: [PATCH v3 1/3] qqz: Improve accuracy of cross-links

Quoted 77 lines · Akira Yokosawa
Quoted 64 lines · Akira Yokosawa
Quoted 43 lines · Akira Yokosawa
Quoted 29 lines · Akira Yokosawa
Quoted 1 line

From 6ecb00b37832372d18cdc7ff5eaea9a53eab3cb9 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Sun, 24 Apr 2016 08:19:20 +0900
Subject: [PATCH v3 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' iterations to get a final result. The following commit will take care of it.

Quoted 5 lines

This commit also updates the copyright notices in the header, including the name of Paolo Bonzini who authored the commit mentioned above.

Hi, Paul.

I noticed there really is a change in the behavior of hyperref's of Chapters. They used to jump to the top of the pages, but after this patch is applied, they jump to the bottom of the Chapter titles. So you need to scroll a little to see the title of the Chapters.

Quoted 9 lines

I think this is a regression caused by this patch.

If you do think so, please keep from pushing this series out.

Or the benefit of the patch is big enough compared to the change of the behavior?

Regards, Akira

Hi,

Seems like it is not easy (at least for me) to find out what is wrong in this patch.

So there are a few options I can think of you might want to do (assuming you'd like to push the refactoring of runlatex.sh):

1) Apply the series as a whole, then revert [1/3], and push out.

Quoted 9 lines

2) Me resubmit another patch series which just contains the refactoring.

3) Apply the series as a whole, and push it as is in the hope of someone familiar with LaTeX and hyperref might appear.

Thoughts?

Regards, Akira

Hi, Paul.

Quoted 8 lines

So, you've pushed the whole series.
And I have to apologize to you for the noise. I've just realized that I compared apples and oranges.

In perfbook.pdf, hyperref of a Chapter jumps to the bottom of its title, while in perfbook-1c.pdf, it jumps to the head of the page.

There was no change in the behavior.

Ah, that would explain the lack of complaints. Most people reading the book on a mobile device use perfbook-1c.pdf, so the chapter links would work nicely for them.

Quoted 5 lines

I'm very glad I can contribute the perfbook project in this manner.

So far, patches I submitted were mostly cosmetic changes. I'm planning to submit something that touches the actual contents, too. But don't expect too much.

Cosmetic it might be, but I believe that readers will appreciate it very much! Thank you again!

Thanx, Paul

#6 lore raw

Re: [PATCH v3 1/3] qqz: Improve accuracy of cross-links

Quoted 1 line · Paul E. McKenney

On Sun, Apr 24, 2016 at 11:23:35PM +0900, Akira Yokosawa wrote:

[snip]

Quoted 5 lines
Quoted 1 line

There was no change in the behavior.

Ah, that would explain the lack of complaints. Most people reading the book on a mobile device use perfbook-1c.pdf, so the chapter links would work nicely for them.

Then, wouldn't it be nicer if we change the default target in Makefile to perfbook-1c.pdf ?

Or how about just adding a shorter name target such as "1c" that would build perfbook-1c.pdf ?

Of course, we should be careful enough not to annoy people by a sudden change of behavior.

Thanks, Akira

Quoted 13 lines
Quoted 6 lines

I'm very glad I can contribute the perfbook project in this manner.

So far, patches I submitted were mostly cosmetic changes. I'm planning to submit something that touches the actual contents, too. But don't expect too much.

Cosmetic it might be, but I believe that readers will appreciate it very much! Thank you again!

Thanx, Paul

#7 lore raw

Re: [PATCH v3 1/3] qqz: Improve accuracy of cross-links

Quoted 11 lines · Akira Yokosawa
Quoted 1 line · Paul E. McKenney

On Sun, Apr 24, 2016 at 11:23:35PM +0900, Akira Yokosawa wrote:

[snip]

Quoted 5 lines
Quoted 1 line

There was no change in the behavior.

Ah, that would explain the lack of complaints. Most people reading the book on a mobile device use perfbook-1c.pdf, so the chapter links would work nicely for them.

Quoted 8 lines

Then, wouldn't it be nicer if we change the default target in Makefile to perfbook-1c.pdf ?

Or how about just adding a shorter name target such as "1c" that would build perfbook-1c.pdf ?

Of course, we should be careful enough not to annoy people by a sudden change of behavior.

I prefer the double-column layout because it takes less paper to print.

But having "make 1c" create the single-column layout would be fine.

Thanx, Paul

Quoted 13 lines
Quoted 12 lines
Quoted 5 lines

I'm very glad I can contribute the perfbook project in this manner.

So far, patches I submitted were mostly cosmetic changes. I'm planning to submit something that touches the actual contents, too. But don't expect too much.

Cosmetic it might be, but I believe that readers will appreciate it very much! Thank you again!

Thanx, Paul

#8 lore raw

Re: [PATCH v3 1/3] qqz: Improve accuracy of cross-links

Quoted 15 lines · Paul E. McKenney
Quoted 14 lines · Akira Yokosawa
Quoted 1 line · Paul E. McKenney

On Sun, Apr 24, 2016 at 11:23:35PM +0900, Akira Yokosawa wrote:

[snip]

Quoted 5 lines
Quoted 1 line

There was no change in the behavior.

Ah, that would explain the lack of complaints. Most people reading the book on a mobile device use perfbook-1c.pdf, so the chapter links would work nicely for them.

Then, wouldn't it be nicer if we change the default target in Makefile to perfbook-1c.pdf ?

Quoted 7 lines
Quoted 5 lines

Or how about just adding a shorter name target such as "1c" that would build perfbook-1c.pdf ?

Of course, we should be careful enough not to annoy people by a sudden change of behavior.

I prefer the double-column layout because it takes less paper to print.

I see. You have the final say.

Quoted 1 line

But having "make 1c" create the single-column layout would be fine.

I'll see what I can do in this direction.

Thanks, Akira

Quoted 18 lines

Thanx, Paul

Quoted 13 lines
Quoted 12 lines
Quoted 5 lines

I'm very glad I can contribute the perfbook project in this manner.

So far, patches I submitted were mostly cosmetic changes. I'm planning to submit something that touches the actual contents, too. But don't expect too much.

Cosmetic it might be, but I believe that readers will appreciate it very much! Thank you again!

Thanx, Paul

#9 lore raw

Re: [PATCH v3 1/3] qqz: Improve accuracy of cross-links

In reply to Akira Yokosawa
Quoted 36 lines · Akira Yokosawa
Quoted 29 lines · Akira Yokosawa
Quoted 1 line

From 6ecb00b37832372d18cdc7ff5eaea9a53eab3cb9 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Sun, 24 Apr 2016 08:19:20 +0900
Subject: [PATCH v3 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' iterations to get a final result. The following commit will take care of it.

Quoted 5 lines

This commit also updates the copyright notices in the header, including the name of Paolo Bonzini who authored the commit mentioned above.

Quoted 8 lines

Hi, Paul.

I noticed there really is a change in the behavior of hyperref's of Chapters. They used to jump to the top of the pages, but after this patch is applied, they jump to the bottom of the Chapter titles. So you need to scroll a little to see the title of the Chapters.

I think this is a regression caused by this patch.

I believe that it always did that. Let me check...

And yes, same behavior before and after the patch. The chapter hyperrefs put you just after the chapter heading.

Quoted 4 lines

If you do think so, please keep from pushing this series out.

Or the benefit of the patch is big enough compared to the change of the behavior?

The benefit is large, and on my system, the chapter behavior does not change. So I am keeping the patches.

It would of course be nice if the chapter hyperrefs pointed to just before the chapter heading (or to the beginning of the page. But given that no one has complained, this is not high priority.

Thanx, Paul

#10 lore raw

Re: [PATCH v3 1/3] qqz: Improve accuracy of cross-links

In reply to Akira Yokosawa
Quoted 3 lines · Akira Yokosawa

This commit also updates the copyright notices in the header, including the name of Paolo Bonzini who authored the commit mentioned above.

Not sure what's Paul's policy about copyright and authors in files (the "Copyright (C)" stuff dates back to before the US joined the Berne Convention; and authorship is recorded well in git logs).

Apart from this, I agree with the meat of the change. I didn't know about the \newcounter{}[] syntax, hence my hack using \setcounter.

Thanks,

Paolo

#11 lore raw

Re: [PATCH v3 1/3] qqz: Improve accuracy of cross-links

Quoted 10 lines · Paolo Bonzini
Quoted 3 lines · Akira Yokosawa

This commit also updates the copyright notices in the header, including the name of Paolo Bonzini who authored the commit mentioned above.

Not sure what's Paul's policy about copyright and authors in files (the "Copyright (C)" stuff dates back to before the US joined the Berne Convention; and authorship is recorded well in git logs).

My employer also dates before the Berne convention, so no problem here.

Quoted 2 lines

Apart from this, I agree with the meat of the change. I didn't know about the \newcounter{}[] syntax, hence my hack using \setcounter.

I expect both the original and the improvement to be quite welcome, especially for people reading this on small form-factor devices!

Thanx, Paul

#12 lore raw

PATCH v3 2/3 Improve behavior of build scripts

In reply to Akira Yokosawa

From bda40978aed2cdd9bd0a52bd7a9c43e149a011b4 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sun, 24 Apr 2016 09:02:50 +0900
Subject: [PATCH v3 2/3] Improve behavior of build scripts

This commit takes care of the possible increase of pdflatex iterations introduced by the previous commit ("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 separated 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 is still room for improvement. To accommodate this, giving-up will fire only after a certain number of iterations for each loop. Since the minimum iteration numbers are chosen after trial and error, 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 logic kicks in, grep of the remaining warnings 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.

This commit also updates the copyright notices in the scripts.

---
 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
index 9eeaa16..d96bc46 100644
@@ -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
#13 lore raw

PATCH v3 3/3 Remove *.bbl from repository

In reply to Akira Yokosawa

From 687dd92a14a751c5919c80f9d7d8609db94d7634 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sun, 24 Apr 2016 09:20:55 +0900
Subject: [PATCH v3 3/3] Remove *.bbl from repository

As rules for '*.bbl' targets are added to 'Makefile' in the previous commit ("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
index 5df1646..39fd69d 100644
@@ -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
index d96bc46..7202334 100644
@@ -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.

#14 lore raw
In reply to Akira Yokosawa
Quoted 15 lines · Akira Yokosawa
Quoted 1 line

From 687dd92a14a751c5919c80f9d7d8609db94d7634 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Sun, 24 Apr 2016 09:26:52 +0900
Subject: [PATCH v3 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.

Quoted 3 lines

Paul tested v2 of this series and found that it is ready to be pushed out if minor fixes of a trailing blank and "XXXXXX" in commit messages are done.

Merged and pushed, thank you!

Thanx, Paul

Quoted 37 lines

Changes since v2:
Updated copyright notices in qqz.sty
Removed a trailing blank in runfirstlatex.sh
Fixed "XXXXXX" in commit messages
Added "-f" option to "rm" in runlatex.sh
Other minor changes in commit messages

Changes since v1:
Refactored runlatex.sh into 3 parts and improved the build behavior in response to the feedback's 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                    |   18 +-
 utilities/runfirstlatex.sh |   46 +
 utilities/runlatex.sh      |   85 +-
 8 files changed, 172 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