Skip to contentSkip to conversation

SMPdesign: Fix meaningless consecutive blank pages

PATCH Applied Akira Yokosawa 2 participants 7 messages Feb 8, 2020 – Feb 9, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 SMPdesign: Fix meaningless consecutive blank pages

From 66df1c9aaaefb2ef5ccfd0c23837b33218a24f30 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sat, 8 Feb 2020 08:29:08 +0900
Subject: [PATCH] SMPdesign: Fix meaningless consecutive blank pages

In the introduction of Dining Philosophers, there is two-page "think about it" gap before presenting an answer.

Let's see what we need for print editions.

When the question is on an odd page, the answer can be on the next page (the other side of the question's page).
When the question is on an even page, the answer should be on the next even page to prevent it from being spotted too early.

For electronic editions, there needs to be a gap of at least one page regardless of the question's position.

As \cleardoublepage changes its behavior depending on whether it is on an odd page (one blank page) or on an even page (nothing), it can not cover the requirement for electronic editions.

For our purpose, the sequence of \clearpage, "((Intentional blank page)", and another \clearpage should suffice.

---
 SMPdesign/partexercises.tex | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
SMPdesign/partexercises.tex +2 -2
index 5d1f1fb0..4ceaefeb 100644
@@ -107,9 +107,9 @@ philosophers to eat concurrently.
 Please think about ways of partitioning the Dining Philosophers Problem
 before reading further.
 
-\pagebreak
+\clearpage
 (Intentional blank page)
-\cleardoublepage
+\clearpage
 
 \begin{figure}[tb]
 \centering
Signature · 1 line
2.17.1
#1 lore raw
Quoted 22 lines · Akira Yokosawa
Quoted 1 line

From 66df1c9aaaefb2ef5ccfd0c23837b33218a24f30 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Sat, 8 Feb 2020 08:29:08 +0900
Subject: [PATCH] SMPdesign: Fix meaningless consecutive blank pages

In the introduction of Dining Philosophers, there is two-page "think about it" gap before presenting an answer.

Let's see what we need for print editions.

When the question is on an odd page, the answer can be on the next page (the other side of the question's page).
When the question is on an even page, the answer should be on the next even page to prevent it from being spotted too early.

For electronic editions, there needs to be a gap of at least one page regardless of the question's position.

As \cleardoublepage changes its behavior depending on whether it is on an odd page (one blank page) or on an even page (nothing), it can not cover the requirement for electronic editions.

Quoted 5 lines

For our purpose, the sequence of \clearpage, "((Intentional blank page)", and another \clearpage should suffice.

I have queued this, thank you!

It works as desired with the current setup because the discussion and the reveal both end up on even pages. You can check this using the "evince" PDF viewer by putting it into two-page mode (apologies for not saying so earlier, but I just now remembered myself).

Wasting the single page isn't a disaster, as you say, but could the trick shown here avoid even that?

https://tex.stackexchange.com/questions/6143/if-then-else-for-odd-page-even-page

I tried this (but leaving out the recommended \strictpagecheck, which might mean that there could be errors when this occurs near the beginning of a page?) and it seems to handle both cases. Please see below for a patchlet on top of your patch.

If this really works, could you please fold it into your patch with any needed adjustments? If it is broken in some way, well, I do have your existing patch which does represent a much-appreciated improvement!

Thanx, Paul

------------------------------------------------------------------------

SMPdesign/partexercises.tex +6 -0
index 4ceaefe..82de2b9 100644
@@ -84,6 +84,8 @@ there will be five forks available to four philosophers.
 At least one of these four will have two forks, and will thus be able
 to eat.
 
+\clearpage  //  Comment out to see the other option.  And move it around.
+
 This general technique of numbering resources and acquiring them in
 numerical order is heavily used as a deadlock-prevention technique.
 However, it is easy to imagine a sequence of events that will result
@@ -107,8 +109,12 @@ philosophers to eat concurrently.
 Please think about ways of partitioning the Dining Philosophers Problem
 before reading further.
 
+\checkoddpage
+\ifoddpage
+\else
 \clearpage
 (Intentional blank page)
+\fi
 \clearpage
 
 \begin{figure}[tb]
#2 lore raw
Quoted 39 lines · Paul E. McKenney
Quoted 22 lines · Akira Yokosawa
Quoted 1 line

From 66df1c9aaaefb2ef5ccfd0c23837b33218a24f30 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Sat, 8 Feb 2020 08:29:08 +0900
Subject: [PATCH] SMPdesign: Fix meaningless consecutive blank pages

In the introduction of Dining Philosophers, there is two-page "think about it" gap before presenting an answer.

Let's see what we need for print editions.

When the question is on an odd page, the answer can be on the next page (the other side of the question's page).
When the question is on an even page, the answer should be on the next even page to prevent it from being spotted too early.

For electronic editions, there needs to be a gap of at least one page regardless of the question's position.

As \cleardoublepage changes its behavior depending on whether it is on an odd page (one blank page) or on an even page (nothing), it can not cover the requirement for electronic editions.

Quoted 5 lines

For our purpose, the sequence of \clearpage, "((Intentional blank page)", and another \clearpage should suffice.

I have queued this, thank you!

It works as desired with the current setup because the discussion and the reveal both end up on even pages. You can check this using the "evince" PDF viewer by putting it into two-page mode (apologies for not saying so earlier, but I just now remembered myself).

Wasting the single page isn't a disaster, as you say, but could the trick shown here avoid even that?

Quoted 6 lines

https://tex.stackexchange.com/questions/6143/if-then-else-for-odd-page-even-page

I tried this (but leaving out the recommended \strictpagecheck, which might mean that there could be errors when this occurs near the beginning of a page?) and it seems to handle both cases. Please see below for a patchlet on top of your patch.

I've not tested it yet, but I think this trick should be enabled only for print editions.
I'm wondering what is the right option to distinguish print editions from electronic editions.

One way would be to update autodate.sh and define a boolean as true in autodate.tex when you have a tag of "Edition.nP".

Does this sound reasonable to you?

Thanks, Akira

Quoted 36 lines

If this really works, could you please fold it into your patch with any needed adjustments? If it is broken in some way, well, I do have your existing patch which does represent a much-appreciated improvement!

Thanx, Paul

------------------------------------------------------------------------

SMPdesign/partexercises.tex +6 -0
index 4ceaefe..82de2b9 100644
@@ -84,6 +84,8 @@ there will be five forks available to four philosophers.
 At least one of these four will have two forks, and will thus be able
 to eat.
 
+\clearpage  //  Comment out to see the other option.  And move it around.
+
 This general technique of numbering resources and acquiring them in
 numerical order is heavily used as a deadlock-prevention technique.
 However, it is easy to imagine a sequence of events that will result
@@ -107,8 +109,12 @@ philosophers to eat concurrently.
 Please think about ways of partitioning the Dining Philosophers Problem
 before reading further.
 
+\checkoddpage
+\ifoddpage
+\else
 \clearpage
 (Intentional blank page)
+\fi
 \clearpage
 
 \begin{figure}[tb]
#3 lore raw
Quoted 52 lines · Akira Yokosawa
Quoted 39 lines · Paul E. McKenney
Quoted 22 lines · Akira Yokosawa
Quoted 1 line

From 66df1c9aaaefb2ef5ccfd0c23837b33218a24f30 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Sat, 8 Feb 2020 08:29:08 +0900
Subject: [PATCH] SMPdesign: Fix meaningless consecutive blank pages

In the introduction of Dining Philosophers, there is two-page "think about it" gap before presenting an answer.

Let's see what we need for print editions.

When the question is on an odd page, the answer can be on the next page (the other side of the question's page).
When the question is on an even page, the answer should be on the next even page to prevent it from being spotted too early.

For electronic editions, there needs to be a gap of at least one page regardless of the question's position.

As \cleardoublepage changes its behavior depending on whether it is on an odd page (one blank page) or on an even page (nothing), it can not cover the requirement for electronic editions.

Quoted 5 lines

For our purpose, the sequence of \clearpage, "((Intentional blank page)", and another \clearpage should suffice.

I have queued this, thank you!

It works as desired with the current setup because the discussion and the reveal both end up on even pages. You can check this using the "evince" PDF viewer by putting it into two-page mode (apologies for not saying so earlier, but I just now remembered myself).

Wasting the single page isn't a disaster, as you say, but could the trick shown here avoid even that?

Quoted 6 lines

https://tex.stackexchange.com/questions/6143/if-then-else-for-odd-page-even-page

I tried this (but leaving out the recommended \strictpagecheck, which might mean that there could be errors when this occurs near the beginning of a page?) and it seems to handle both cases. Please see below for a patchlet on top of your patch.

I've not tested it yet, but I think this trick should be enabled only for print editions.
I'm wondering what is the right option to distinguish print editions from electronic editions.

Quoted 4 lines

One way would be to update autodate.sh and define a boolean as true in autodate.tex when you have a tag of "Edition.nP".

Does this sound reasonable to you?

It would, except that people really do print non-print editions and sometimes they print releases or even random points in the git history. So I do not believe that we should distinguish.

But if there is ever a reliable way to produce an ereader format, then agreed, we would want to distinguish. Or if we could figure out that the reader was reading it on a smartphone.

Or am I missing a trick here?

Thanx, Paul

Quoted 38 lines

Thanks, Akira

Quoted 36 lines

If this really works, could you please fold it into your patch with any needed adjustments? If it is broken in some way, well, I do have your existing patch which does represent a much-appreciated improvement!

Thanx, Paul

------------------------------------------------------------------------

SMPdesign/partexercises.tex +6 -0
index 4ceaefe..82de2b9 100644
@@ -84,6 +84,8 @@ there will be five forks available to four philosophers.
 At least one of these four will have two forks, and will thus be able
 to eat.
 
+\clearpage  //  Comment out to see the other option.  And move it around.
+
 This general technique of numbering resources and acquiring them in
 numerical order is heavily used as a deadlock-prevention technique.
 However, it is easy to imagine a sequence of events that will result
@@ -107,8 +109,12 @@ philosophers to eat concurrently.
 Please think about ways of partitioning the Dining Philosophers Problem
 before reading further.
 
+\checkoddpage
+\ifoddpage
+\else
 \clearpage
 (Intentional blank page)
+\fi
 \clearpage
 
 \begin{figure}[tb]
#4 lore raw
Quoted 53 lines · Paul E. McKenney
Quoted 52 lines · Akira Yokosawa
Quoted 39 lines · Paul E. McKenney
Quoted 22 lines · Akira Yokosawa
Quoted 1 line

From 66df1c9aaaefb2ef5ccfd0c23837b33218a24f30 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Sat, 8 Feb 2020 08:29:08 +0900
Subject: [PATCH] SMPdesign: Fix meaningless consecutive blank pages

In the introduction of Dining Philosophers, there is two-page "think about it" gap before presenting an answer.

Let's see what we need for print editions.

When the question is on an odd page, the answer can be on the next page (the other side of the question's page).
When the question is on an even page, the answer should be on the next even page to prevent it from being spotted too early.

For electronic editions, there needs to be a gap of at least one page regardless of the question's position.

As \cleardoublepage changes its behavior depending on whether it is on an odd page (one blank page) or on an even page (nothing), it can not cover the requirement for electronic editions.

Quoted 5 lines

For our purpose, the sequence of \clearpage, "((Intentional blank page)", and another \clearpage should suffice.

I have queued this, thank you!

It works as desired with the current setup because the discussion and the reveal both end up on even pages. You can check this using the "evince" PDF viewer by putting it into two-page mode (apologies for not saying so earlier, but I just now remembered myself).

Wasting the single page isn't a disaster, as you say, but could the trick shown here avoid even that?

Quoted 6 lines

https://tex.stackexchange.com/questions/6143/if-then-else-for-odd-page-even-page

I tried this (but leaving out the recommended \strictpagecheck, which might mean that there could be errors when this occurs near the beginning of a page?) and it seems to handle both cases. Please see below for a patchlet on top of your patch.

I've not tested it yet, but I think this trick should be enabled only for print editions.
I'm wondering what is the right option to distinguish print editions from electronic editions.

Quoted 8 lines
Quoted 4 lines

One way would be to update autodate.sh and define a boolean as true in autodate.tex when you have a tag of "Edition.nP".

Does this sound reasonable to you?

It would, except that people really do print non-print editions and sometimes they print releases or even random points in the git history. So I do not believe that we should distinguish.

For e-readers, this trick would present Figure 6.4 just next to the question in contiguous display mode if the question lands on an even page, which is not ideal for first-time readers.

So I don't like to enable this trick all the time.

Or, how about enabling it for 2c layouts only, which most people would choose to print out.

Another completely different approach would be to put the answer part and Figure 6.4 into an Answer to a Quick Quiz.
Then we wouldn't need to play with \clearpage commands.

Thoughts?

Quoted 6 lines

But if there is ever a reliable way to produce an ereader format, then agreed, we would want to distinguish. Or if we could figure out that the reader was reading it on a smartphone.

Or am I missing a trick here?

It sounds like we are talking about something different, aren't we? ;-)

Thanks, Akira

Quoted 41 lines

Thanx, Paul

Quoted 38 lines

Thanks, Akira

Quoted 36 lines

If this really works, could you please fold it into your patch with any needed adjustments? If it is broken in some way, well, I do have your existing patch which does represent a much-appreciated improvement!

Thanx, Paul

------------------------------------------------------------------------

SMPdesign/partexercises.tex +6 -0
index 4ceaefe..82de2b9 100644
@@ -84,6 +84,8 @@ there will be five forks available to four philosophers.
 At least one of these four will have two forks, and will thus be able
 to eat.
 
+\clearpage  //  Comment out to see the other option.  And move it around.
+
 This general technique of numbering resources and acquiring them in
 numerical order is heavily used as a deadlock-prevention technique.
 However, it is easy to imagine a sequence of events that will result
@@ -107,8 +109,12 @@ philosophers to eat concurrently.
 Please think about ways of partitioning the Dining Philosophers Problem
 before reading further.
 
+\checkoddpage
+\ifoddpage
+\else
 \clearpage
 (Intentional blank page)
+\fi
 \clearpage
 
 \begin{figure}[tb]
#5 lore raw
Quoted 69 lines · Akira Yokosawa
Quoted 53 lines · Paul E. McKenney
Quoted 52 lines · Akira Yokosawa
Quoted 39 lines · Paul E. McKenney
Quoted 22 lines · Akira Yokosawa
Quoted 1 line

From 66df1c9aaaefb2ef5ccfd0c23837b33218a24f30 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Sat, 8 Feb 2020 08:29:08 +0900
Subject: [PATCH] SMPdesign: Fix meaningless consecutive blank pages

In the introduction of Dining Philosophers, there is two-page "think about it" gap before presenting an answer.

Let's see what we need for print editions.

When the question is on an odd page, the answer can be on the next page (the other side of the question's page).
When the question is on an even page, the answer should be on the next even page to prevent it from being spotted too early.

For electronic editions, there needs to be a gap of at least one page regardless of the question's position.

As \cleardoublepage changes its behavior depending on whether it is on an odd page (one blank page) or on an even page (nothing), it can not cover the requirement for electronic editions.

Quoted 5 lines

For our purpose, the sequence of \clearpage, "((Intentional blank page)", and another \clearpage should suffice.

I have queued this, thank you!

It works as desired with the current setup because the discussion and the reveal both end up on even pages. You can check this using the "evince" PDF viewer by putting it into two-page mode (apologies for not saying so earlier, but I just now remembered myself).

Wasting the single page isn't a disaster, as you say, but could the trick shown here avoid even that?

Quoted 6 lines

https://tex.stackexchange.com/questions/6143/if-then-else-for-odd-page-even-page

I tried this (but leaving out the recommended \strictpagecheck, which might mean that there could be errors when this occurs near the beginning of a page?) and it seems to handle both cases. Please see below for a patchlet on top of your patch.

I've not tested it yet, but I think this trick should be enabled only for print editions.
I'm wondering what is the right option to distinguish print editions from electronic editions.

Quoted 8 lines
Quoted 4 lines

One way would be to update autodate.sh and define a boolean as true in autodate.tex when you have a tag of "Edition.nP".

Does this sound reasonable to you?

It would, except that people really do print non-print editions and sometimes they print releases or even random points in the git history. So I do not believe that we should distinguish.

For e-readers, this trick would present Figure 6.4 just next to the question in contiguous display mode if the question lands on an even page, which is not ideal for first-time readers.

So I don't like to enable this trick all the time.

Quoted 8 lines

Or, how about enabling it for 2c layouts only, which most people would choose to print out.

Another completely different approach would be to put the answer part and Figure 6.4 into an Answer to a Quick Quiz.
Then we wouldn't need to play with \clearpage commands.

Thoughts?

You know, this might well be the best approach, the additional quick quizzes notwithstanding. Let me give it some thought, maybe I should just have a list of answers.

Quoted 7 lines
Quoted 5 lines

But if there is ever a reliable way to produce an ereader format, then agreed, we would want to distinguish. Or if we could figure out that the reader was reading it on a smartphone.

Or am I missing a trick here?

It sounds like we are talking about something different, aren't we? ;-)

Which can sometimes be quite productive. Sometimes. ;-)

Thanx, Paul

Quoted 43 lines

Thanks, Akira

Quoted 41 lines

Thanx, Paul

Quoted 38 lines

Thanks, Akira

Quoted 36 lines

If this really works, could you please fold it into your patch with any needed adjustments? If it is broken in some way, well, I do have your existing patch which does represent a much-appreciated improvement!

Thanx, Paul

------------------------------------------------------------------------

SMPdesign/partexercises.tex +6 -0
index 4ceaefe..82de2b9 100644
@@ -84,6 +84,8 @@ there will be five forks available to four philosophers.
 At least one of these four will have two forks, and will thus be able
 to eat.
 
+\clearpage  //  Comment out to see the other option.  And move it around.
+
 This general technique of numbering resources and acquiring them in
 numerical order is heavily used as a deadlock-prevention technique.
 However, it is easy to imagine a sequence of events that will result
@@ -107,8 +109,12 @@ philosophers to eat concurrently.
 Please think about ways of partitioning the Dining Philosophers Problem
 before reading further.
 
+\checkoddpage
+\ifoddpage
+\else
 \clearpage
 (Intentional blank page)
+\fi
 \clearpage
 
 \begin{figure}[tb]
#6 lore raw
Quoted 77 lines · Paul E. McKenney
Quoted 76 lines · Akira Yokosawa
Quoted 53 lines · Paul E. McKenney
Quoted 52 lines · Akira Yokosawa
Quoted 39 lines · Paul E. McKenney
Quoted 22 lines · Akira Yokosawa
Quoted 1 line

From 66df1c9aaaefb2ef5ccfd0c23837b33218a24f30 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Sat, 8 Feb 2020 08:29:08 +0900
Subject: [PATCH] SMPdesign: Fix meaningless consecutive blank pages

In the introduction of Dining Philosophers, there is two-page "think about it" gap before presenting an answer.

Let's see what we need for print editions.

When the question is on an odd page, the answer can be on the next page (the other side of the question's page).
When the question is on an even page, the answer should be on the next even page to prevent it from being spotted too early.

For electronic editions, there needs to be a gap of at least one page regardless of the question's position.

As \cleardoublepage changes its behavior depending on whether it is on an odd page (one blank page) or on an even page (nothing), it can not cover the requirement for electronic editions.

Quoted 5 lines

For our purpose, the sequence of \clearpage, "((Intentional blank page)", and another \clearpage should suffice.

I have queued this, thank you!

It works as desired with the current setup because the discussion and the reveal both end up on even pages. You can check this using the "evince" PDF viewer by putting it into two-page mode (apologies for not saying so earlier, but I just now remembered myself).

Wasting the single page isn't a disaster, as you say, but could the trick shown here avoid even that?

Quoted 6 lines

https://tex.stackexchange.com/questions/6143/if-then-else-for-odd-page-even-page

I tried this (but leaving out the recommended \strictpagecheck, which might mean that there could be errors when this occurs near the beginning of a page?) and it seems to handle both cases. Please see below for a patchlet on top of your patch.

I've not tested it yet, but I think this trick should be enabled only for print editions.
I'm wondering what is the right option to distinguish print editions from electronic editions.

Quoted 8 lines
Quoted 4 lines

One way would be to update autodate.sh and define a boolean as true in autodate.tex when you have a tag of "Edition.nP".

Does this sound reasonable to you?

It would, except that people really do print non-print editions and sometimes they print releases or even random points in the git history. So I do not believe that we should distinguish.

For e-readers, this trick would present Figure 6.4 just next to the question in contiguous display mode if the question lands on an even page, which is not ideal for first-time readers.

So I don't like to enable this trick all the time.

Or, how about enabling it for 2c layouts only, which most people would choose to print out.

Another completely different approach would be to put the answer part and Figure 6.4 into an Answer to a Quick Quiz.
Then we wouldn't need to play with \clearpage commands.

Quoted 5 lines
Quoted 1 line

Thoughts?

You know, this might well be the best approach, the additional quick quizzes notwithstanding. Let me give it some thought, maybe I should just have a list of answers.

Looking forward to seeing how it goes!

Quoted 10 lines
Quoted 8 lines
Quoted 6 lines

But if there is ever a reliable way to produce an ereader format, then agreed, we would want to distinguish. Or if we could figure out that the reader was reading it on a smartphone.

Or am I missing a trick here?

It sounds like we are talking about something different, aren't we? ;-)

Which can sometimes be quite productive. Sometimes. ;-)

Yeah, sometimes.

In the meantime, I'm submitting a couple of updates regarding to epigraph.sty.

Thanks, Akira

Quoted 46 lines

Thanx, Paul

Quoted 43 lines

Thanks, Akira

Quoted 41 lines

Thanx, Paul

Quoted 38 lines

Thanks, Akira

Quoted 36 lines

If this really works, could you please fold it into your patch with any needed adjustments? If it is broken in some way, well, I do have your existing patch which does represent a much-appreciated improvement!

Thanx, Paul

------------------------------------------------------------------------

SMPdesign/partexercises.tex +6 -0
index 4ceaefe..82de2b9 100644
@@ -84,6 +84,8 @@ there will be five forks available to four philosophers.
 At least one of these four will have two forks, and will thus be able
 to eat.
 
+\clearpage  //  Comment out to see the other option.  And move it around.
+
 This general technique of numbering resources and acquiring them in
 numerical order is heavily used as a deadlock-prevention technique.
 However, it is easy to imagine a sequence of events that will result
@@ -107,8 +109,12 @@ philosophers to eat concurrently.
 Please think about ways of partitioning the Dining Philosophers Problem
 before reading further.
 
+\checkoddpage
+\ifoddpage
+\else
 \clearpage
 (Intentional blank page)
+\fi
 \clearpage
 
 \begin{figure}[tb]