Skip to contentSkip to conversation

Fix layout hiccups in answers to quick quizzes

PATCH Applied Akira Yokosawa 2 participants 7 messages Nov 4, 2017

lore
Share & tools
lore
#0 lore raw

cover Fix layout hiccups in answers to quick quizzes

From fa20d77f7a35114dd6bf93e362b44235b163f1ad Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sat, 4 Nov 2017 09:01:08 +0900
Subject: [PATCH 0/3] Fix layout hiccups in answers to quick quizzes

Hi Paul,

This patch set picks up some minor tweaks regarding answers to quick quizzes.

Patch #1 adds a couple of patterns to hyphen2endash.sh Patch #2 adjusts line-break position after nn-mm so that the pattern added in Patch #1 can be applied.
Patch #3 fixes some layout hiccups in answers to quick quizzes.

Thanks, Akira
--
Akira Yokosawa (3):
hyphen2endash.sh: Add patterns for 'nn-mm days' and 'nn-mm sheets' cpu/overheads: Don't break just after nn-mm
Fix layout hiccups in answers to quick quizzes

 cpu/overheads.tex             | 4 ++--
 defer/rcuapi.tex              | 7 ++++---
 defer/rcufundamental.tex      | 1 +
 memorder/memorder.tex         | 7 ++++---
 toolsoftrade/toolsoftrade.tex | 2 +-
 utilities/hyphen2endash.sh    | 6 ++++++
 6 files changed, 18 insertions(+), 9 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/3 hyphen2endash.sh: Add patterns for 'nn-mm days' and 'nn-mm sheets'

From 844896af3fefe18c0e4dd32bdf6be2c9d8a776f8 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Thu, 2 Nov 2017 22:42:14 +0900
Subject: [PATCH 1/3] hyphen2endash.sh: Add patterns for 'nn-mm days' and 'nn-mm sheets'

---
 utilities/hyphen2endash.sh | 6 ++++++
 1 file changed, 6 insertions(+)
utilities/hyphen2endash.sh +6 -0
index 29e3896..1586804 100644
@@ -23,6 +23,10 @@
 # nn-mm~microsecond -> nn--mm~microsecond
 # nn-mm~millisecond -> nn--mm~millisecond
 # nn-mm~\emp -> nn--mm~\emp
+# nn-mm days -> nn--mm~days
+# nn-mm~days -> nn--mm~days
+# nn-mm sheets -> nn--mm~sheets
+# nn-mm~sheets -> nn--mm~sheets
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -54,6 +58,8 @@ cat $1 |
 	    -e 's/\([0-9]\+\)-\([0-9]\+\)~microsecond/\1--\2~microsecond/g' \
 	    -e 's/\([0-9]\+\)-\([0-9]\+\)~millisecond/\1--\2~millisecond/g' \
 	    -e 's/\([0-9]\+\)-\([0-9]\+\)~\\emp/\1--\2~\\emp/g' \
+	    -e 's/\([0-9]\+\)-\([0-9]\+\)[ ~]days/\1--\2~days/g' \
+	    -e 's/\([0-9]\+\)-\([0-9]\+\)[ ~]sheets/\1--\2~sheets/g' \
 	    -e 's/\/\* Lines~\([0-9]\+\)--\([0-9]\+\) \*\//\/\* Lines \1-\2 \*\//g'
 
 # Last pattern is to preserve "Lines n-m" in comments within code snippet
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/3 cpu/overheads: Don't break just after nn-mm

In reply to Akira Yokosawa

From 96995ec9781970d633f554579465e9f053ec316a Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sat, 4 Nov 2017 07:44:36 +0900
Subject: [PATCH 2/3] cpu/overheads: Don't break just after nn-mm

---
 cpu/overheads.tex | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
cpu/overheads.tex +2 -2
index bd4c814..366b071 100644
@@ -290,8 +290,8 @@ cycles, as shown in the ``Global Comms'' row.
 	How can I possibly get my head around them?
 \QuickQuizAnswer{
 	Get a roll of toilet paper.
-	In the USA, each roll will normally have somewhere around 350-500
-	sheets.
+	In the USA, each roll will normally have somewhere around
+	350-500 sheets.
 	Tear off one sheet to represent a single clock cycle, setting it aside.
 	Now unroll the rest of the roll.
 
Signature · 1 line
2.7.4
#3 lore raw

Re: [PATCH 2/3] cpu/overheads: Don't break just after nn-mm

Quoted 6 lines · Akira Yokosawa
Quoted 1 line

From 96995ec9781970d633f554579465e9f053ec316a Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Sat, 4 Nov 2017 07:44:36 +0900
Subject: [PATCH 2/3] cpu/overheads: Don't break just after nn-mm

You lost me with this one. Shouldn't there be a non-breaking space between the "350-500" and the "sheets"? Or is there some magic here that I am missing?

Thanx, Paul

Quoted 23 lines
---
 cpu/overheads.tex | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
cpu/overheads.tex +2 -2
index bd4c814..366b071 100644
@@ -290,8 +290,8 @@ cycles, as shown in the ``Global Comms'' row.
 	How can I possibly get my head around them?
 \QuickQuizAnswer{
 	Get a roll of toilet paper.
-	In the USA, each roll will normally have somewhere around 350-500
-	sheets.
+	In the USA, each roll will normally have somewhere around
+	350-500 sheets.
 	Tear off one sheet to represent a single clock cycle, setting it aside.
 	Now unroll the rest of the roll.
 
Signature · 1 line
2.7.4
#4 lore raw

Re: [PATCH 2/3] cpu/overheads: Don't break just after nn-mm

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

From 96995ec9781970d633f554579465e9f053ec316a Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Sat, 4 Nov 2017 07:44:36 +0900
Subject: [PATCH 2/3] cpu/overheads: Don't break just after nn-mm

You lost me with this one. Shouldn't there be a non-breaking space between the "350-500" and the "sheets"? Or is there some magic here that I am missing?

I intentionally chose normal space because the preceding number is 3 digits and "sheets" can't be hyphenated. It can cause large underfil in 2c layout.
In the current Answer, line breaking is done at different places in both 1c and 2c layout, so it doesn't matter at the moment.

Also, non-breaking spaces can be enforced by a script something like hypen2endash.sh. The added pattern in Patch #1 does the conversion to nbsp. (I use this script for mostly 1c layout.)

Thoughts?

Thanks, Akira

Quoted 28 lines

Thanx, Paul

Quoted 23 lines
---
 cpu/overheads.tex | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
cpu/overheads.tex +2 -2
index bd4c814..366b071 100644
@@ -290,8 +290,8 @@ cycles, as shown in the ``Global Comms'' row.
 	How can I possibly get my head around them?
 \QuickQuizAnswer{
 	Get a roll of toilet paper.
-	In the USA, each roll will normally have somewhere around 350-500
-	sheets.
+	In the USA, each roll will normally have somewhere around
+	350-500 sheets.
 	Tear off one sheet to represent a single clock cycle, setting it aside.
 	Now unroll the rest of the roll.
 
Signature · 1 line
2.7.4
#5 lore raw

Re: [PATCH 2/3] cpu/overheads: Don't break just after nn-mm

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

From 96995ec9781970d633f554579465e9f053ec316a Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Sat, 4 Nov 2017 07:44:36 +0900
Subject: [PATCH 2/3] cpu/overheads: Don't break just after nn-mm

You lost me with this one. Shouldn't there be a non-breaking space between the "350-500" and the "sheets"? Or is there some magic here that I am missing?

I intentionally chose normal space because the preceding number is 3 digits and "sheets" can't be hyphenated. It can cause large underfil in 2c layout.
In the current Answer, line breaking is done at different places in both 1c and 2c layout, so it doesn't matter at the moment.

Quoted 5 lines

Also, non-breaking spaces can be enforced by a script something like hypen2endash.sh. The added pattern in Patch #1 does the conversion to nbsp. (I use this script for mostly 1c layout.)

Thoughts?

OK, I am finally seeing the connection between this change and the change to the sripts. So, yes, it has no direct effect on LaTeX, but does have an indirect effect after the scripts have run. And some quick-quiz answers do look much better as well!

I applied and pushed all three, thank you

Quoted 31 lines

Thanks, Akira

Quoted 28 lines

Thanx, Paul

Quoted 23 lines
---
 cpu/overheads.tex | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
cpu/overheads.tex +2 -2
index bd4c814..366b071 100644
@@ -290,8 +290,8 @@ cycles, as shown in the ``Global Comms'' row.
 	How can I possibly get my head around them?
 \QuickQuizAnswer{
 	Get a roll of toilet paper.
-	In the USA, each roll will normally have somewhere around 350-500
-	sheets.
+	In the USA, each roll will normally have somewhere around
+	350-500 sheets.
 	Tear off one sheet to represent a single clock cycle, setting it aside.
 	Now unroll the rest of the roll.
 
Signature · 1 line
2.7.4
#6 lore raw

PATCH 3/3 Fix layout hiccups in answers to quick quizzes

In reply to Akira Yokosawa

From fa20d77f7a35114dd6bf93e362b44235b163f1ad Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sat, 4 Nov 2017 08:34:01 +0900
Subject: [PATCH 3/3] Fix layout hiccups in answers to quick quizzes

---
 defer/rcuapi.tex              | 7 ++++---
 defer/rcufundamental.tex      | 1 +
 memorder/memorder.tex         | 7 ++++---
 toolsoftrade/toolsoftrade.tex | 2 +-
 4 files changed, 10 insertions(+), 7 deletions(-)
defer/rcuapi.tex +4 -3
index d4e434d..55811a1 100644
@@ -367,9 +367,10 @@ returns a value that must be passed into the corresponding
 	In practice, however, doing this is almost certainly a bad idea.
 	In particular, the code shown in
 	Listing~\ref{lst:defer:Multistage SRCU Deadlocks}
-	could still result in deadlock.
-
+	could still result in deadlock.%
+%
 \begin{listing}[htbp]
+\scriptsize
 {
 \begin{verbbox}
   1 idx = srcu_read_lock(&ssa);
@@ -387,7 +388,7 @@ returns a value that must be passed into the corresponding
 \theverbbox
 \caption{Multistage SRCU Deadlocks}
 \label{lst:defer:Multistage SRCU Deadlocks}
-\end{listing}
+\end{listing}%
 %
 } \QuickQuizEnd
 
defer/rcufundamental.tex +1 -0
index 4c16478..f2cfab2 100644
@@ -750,6 +750,7 @@ versions of the list active at a given time.
 	Listing~\ref{lst:defer:Concurrent RCU Deletion}.
 
 \begin{listing}[htbp]
+\scriptsize
 {
 \begin{verbbox}
   1 spin_lock(&mylock);
memorder/memorder.tex +4 -3
index 3ba4d3a..0e823d4 100644
@@ -1854,8 +1854,8 @@ exists (1:r1=1 /\ 1:r2=0)
 \theverbbox
 \caption{Litmus Test Distinguishing Multicopy Atomic From Other Multicopy Atomic}
 \label{lst:memorder:Litmus Test Distinguishing Multicopy Atomic From Other Multicopy Atomic}
-\end{listing}
-
+\end{listing}%
+%
 	Listing~\ref{lst:memorder:Litmus Test Distinguishing Multicopy Atomic From Other Multicopy Atomic}
 	(\path{C-MP-OMCA+o-o-o+o-rmb-o.litmus})
 	shows such a test.
@@ -2299,7 +2299,8 @@ exists (1:r2=0 /\ x1=2)
 \theverbbox
 \caption{R Litmus Test With Write Memory Barrier (No Ordering)}
 \label{lst:memorder:R Litmus Test With Write Memory Barrier (No Ordering)}
-\end{listing}
+\end{listing}%
+%
 	Wrong.
 
 	Listing~\ref{lst:memorder:R Litmus Test With Write Memory Barrier (No Ordering)}
toolsoftrade/toolsoftrade.tex +1 -1
index d37a295..7d3e038 100644
@@ -727,7 +727,7 @@ by \co{lock_writer()} while holding the lock.
 	The reason that ``x = 0'' was output was that \co{lock_reader()}
 	acquired the lock first.
 	Had \co{lock_writer()} instead acquired the lock first, then
-	the output would have been ``x = 3''.
+	the output would have been \mbox{``x = 3''}.
 	However, because the code fragment started \co{lock_reader()} first
 	and because this run was performed on a multiprocessor,
 	one would normally expect \co{lock_reader()} to acquire the
Signature · 1 line
2.7.4