Improve page/column breaks in Appendix E
cover Improve page/column breaks in Appendix E
Hi Paul,
I think I figured out the way to do what you wanted the other day. Instead of putting \goodbreak in \QuickQ, putting it in \QuickE looks like the right approach.
Patch 1/6 does the change.
Patch 2/6 fixes a regression in the first attempt to put \goodbreak in front of QQZ.
Patches 3/6--6/6 fix minor issues in QQAz.
Feel free to rephrase the added opening sentence in Patch 4/6.
Thanks, Akira
--
Akira Yokosawa (6):
qqz.sty: Improve page/column breaks in Appendix E
qqz.sty: Fix position of \goodbreak for accuracy of hyperlinks
toolsoftrade: Use nbsp in front of single letter variable
debugging: Add opening sentence in Answer to QQZ 11.2 defer/rcuusage: Reverse nesting of fcvref and enumerate envs SMPdesign/partexercises: Move figure env next to first paragraph in QQA
SMPdesign/partexercises.tex | 15 +++++++-------- debugging/debugging.tex | 2 ++ defer/rcuusage.tex | 4 ++-- qqz.sty | 10 +++++----- toolsoftrade/toolsoftrade.tex | 7 +++---- 5 files changed, 19 insertions(+), 19 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/6 qqz.sty: Improve page/column breaks in Appendix E
From 3f5304088091cdbc434d7dacf5835e65c79da5ca Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Thu, 5 Mar 2020 23:40:39 +0900
Subject: [PATCH 1/6] qqz.sty: Improve page/column breaks in Appendix E
For "Quick Quiz" headings to be more likely at the top of pages/ columns in Appendix E, put \goodbreak hint after the white box mark at the end of QQA.
Also tweak glue parameters to suppress the increase in the total number of pages.
--- qqz.sty | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
qqz.sty +3 -3
@@ -66,7 +66,7 @@ \Epigraph{The Answer to the Ultimate Question of Life, The Universe, and Everything.} {\emph{``The Hitchhikers Guide to the Galaxy'', Douglas~Adams}} - \setlength{\parskip}{0.0pt plus 2ex} + \setlength{\parskip}{0.0pt plus 1ex} \input{qqz} \setlength{\parskip}{0.0pt plus 1.0pt}% return to default }
@@ -85,11 +85,11 @@ \newcommand{\QuickA}[1]{% \hyperref[QQ.\QuickQuizAnswerChapter.\thequickquizctrC]{\rule{7pt}{7pt}} - \par\vspace{0.5\baselineskip plus .5ex minus .3ex} + \par\vspace{0.2\baselineskip plus .2ex minus .1ex} \noindent\textbf{Answer:} \\ } \newcommand{\QuickE}{% \hyperref[QQE.\QuickQuizAnswerChapter.\thequickquizctrC]{\ding{113}} - \vspace{1.0\baselineskip plus 2ex minus .5ex} + \goodbreak\vspace{0.7\baselineskip plus .5ex minus .2ex} }
Signature · 1 line
2.17.1
PATCH 2/6 qqz.sty: Fix position of \goodbreak for accuracy of hyperlinks
In reply to Akira YokosawaFrom 440b3f3bbdd2dc212e7f277c950338f22529f532 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Fri, 6 Mar 2020 00:05:09 +0900
Subject: [PATCH 2/6] qqz.sty: Fix position of \goodbreak for accuracy of hyperlinks
Commit 9e256de3262f ("qqz.sty: Permit column/page break in front of Quick Quiz heading") put \goodbreak after \refstepcounter{}. This caused backward hyperlinks to QQZs at the top of pages/columns to point the bottom of the previous pages/columns.
Fix this by placing \goodbreak in front of \refstepcounter{}.
--- qqz.sty | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
qqz.sty +2 -2
@@ -33,8 +33,8 @@ \label{#1} } \newcommand{\QuickQuiz}[1]{ - \refstepcounter{quickquizctr} - \goodbreak\QuickQHeading{QQ}{QQA}{\thechapter.\thequickquizctr}} + \goodbreak\refstepcounter{quickquizctr}% + \QuickQHeading{QQ}{QQA}{\thechapter.\thequickquizctr}} \newcommand{\QuickQuizAnswer}[1]{% \refstepcounter{quickquizctrE}% \hyperref[QQA.\thechapter.\thequickquizctr]{\rule{7pt}{7pt}}%
Signature · 1 line
2.17.1
PATCH 3/6 toolsoftrade: Use nbsp in front of single letter variable
In reply to Akira YokosawaFrom 415ec82df62f29b0901b124c6991f05117432835 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Fri, 6 Mar 2020 00:18:34 +0900
Subject: [PATCH 3/6] toolsoftrade: Use nbsp in front of single letter variable
--- toolsoftrade/toolsoftrade.tex | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
toolsoftrade/toolsoftrade.tex +3 -4
@@ -681,7 +681,7 @@ values of \co{x} stored by \co{lock_writer()}. \QuickQuiz{} Wait a minute here!!! Listing~\ref{lst:toolsoftrade:Demonstration of Same Exclusive Lock} - didn't initialize shared variable \co{x}, + didn't initialize shared variable~\co{x}, so why does it need to be initialized in Listing~\ref{lst:toolsoftrade:Demonstration of Different Exclusive Locks}? \QuickQuizAnswer{
@@ -689,11 +689,10 @@ values of \co{x} stored by \co{lock_writer()}. Listing~\ref{lst:toolsoftrade:Demonstration of Exclusive Locks}. Because the code in Listing~\ref{lst:toolsoftrade:Demonstration of Same Exclusive Lock} - ran first, it could rely on the compile-time initialization of - \co{x}. + ran first, it could rely on the compile-time initialization of~\co{x}. The code in Listing~\ref{lst:toolsoftrade:Demonstration of Different Exclusive Locks} - ran next, so it had to re-initialize \co{x}. + ran next, so it had to re-initialize~\co{x}. } \QuickQuizEnd Although there is quite a bit more to POSIX exclusive locking, these
Signature · 1 line
2.17.1
PATCH 4/6 debugging: Add opening sentence in Answer to QQZ 11.2
In reply to Akira YokosawaFrom dff3065e9c873a499fcc03e5c190e3e531f2199c Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Fri, 6 Mar 2020 20:40:00 +0900
Subject: [PATCH 4/6] debugging: Add opening sentence in Answer to QQZ 11.2
Beginning an answer with an enumerate list can cause the "Answer" heading to be orphaned. Avoid it by adding an opening sentence.
--- debugging/debugging.tex | 2 ++ 1 file changed, 2 insertions(+)
debugging/debugging.tex +2 -0
@@ -231,6 +231,8 @@ validation is just the right type of job for you. What test inputs should you provide to this program to test it for use with \co{time} output generated by single-threaded programs? \QuickQuizAnswer{ + Can you say ``Yes'' to all the following questions? + \begin{enumerate} \item Do you have a test case in which all the time is consumed in user mode by a CPU-bound program?
Signature · 1 line
2.17.1
PATCH 5/6 defer/rcuusage: Reverse nesting of fcvref and enumerate envs
In reply to Akira YokosawaFrom 18c81bd11d841184bee4336e78f3e9296d5f2df8 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Fri, 6 Mar 2020 20:53:01 +0900
Subject: [PATCH 5/6] defer/rcuusage: Reverse nesting of fcvref and enumerate envs
This change enables qqzreoder.pl to move the ending white box to the end of the last item in the list.
--- defer/rcuusage.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
defer/rcuusage.tex +2 -2
@@ -942,11 +942,11 @@ and line~\lnref{ret_0:b} indicates failure to delete the specified key. before releasing the lock on line~\lnref{rel2}? \end{fcvref} \QuickQuizAnswer{ - \begin{fcvref}[ln:defer:Existence Guarantees Enable Per-Element Locking] Suppose we reverse the order of these two lines. Then this code is vulnerable to the following sequence of events: \begin{enumerate} + \begin{fcvref}[ln:defer:Existence Guarantees Enable Per-Element Locking] \item CPU~0 invokes \co{delete()}, and finds the element to be deleted, executing through line~\lnref{rdunlock2}. It has not yet actually deleted the element, but
@@ -971,8 +971,8 @@ and line~\lnref{ret_0:b} indicates failure to delete the specified key. that has been freed, and, worse yet, possibly reallocated as some other type of data structure. This is a fatal memory-corruption error. - \end{enumerate} \end{fcvref} + \end{enumerate} } \QuickQuizEnd Alert readers will recognize this as only a slight variation on
Signature · 1 line
2.17.1
PATCH 6/6 SMPdesign/partexercises: Move figure env next to first paragraph in QQA
In reply to Akira YokosawaFrom 6a10517e8890a37b34c4d3dbbb91372df1906ac1 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Fri, 6 Mar 2020 21:14:19 +0900
Subject: [PATCH 6/6] SMPdesign/partexercises: Move figure env next to first paragraph in QQA
This change removes the extra indent at the beginning of the answer.
--- SMPdesign/partexercises.tex | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
SMPdesign/partexercises.tex +7 -8
@@ -134,14 +134,6 @@ the acquisition and release algorithms. Is there a better solution to the Dining Philosophers Problem? \QuickQuizAnswer{ -% -\begin{figure}[tb] -\centering -\includegraphics[scale=.7]{SMPdesign/DiningPhilosopher5PEM} -\caption{Dining Philosophers Problem, Fully Partitioned} -\QContributedBy{Figure}{fig:SMPdesign:Dining Philosophers Problem, Fully Partitioned}{Kornilios Kourtis} -\end{figure} -% One such improved solution is shown in Figure~\ref{fig:SMPdesign:Dining Philosophers Problem, Fully Partitioned}, where the philosophers are simply provided with an additional
@@ -150,6 +142,13 @@ the acquisition and release algorithms. is never any need for philosophers to wait on one another. In addition, this approach offers greatly improved disease control. +\begin{figure}[tb] +\centering +\includegraphics[scale=.7]{SMPdesign/DiningPhilosopher5PEM} +\caption{Dining Philosophers Problem, Fully Partitioned} +\QContributedBy{Figure}{fig:SMPdesign:Dining Philosophers Problem, Fully Partitioned}{Kornilios Kourtis} +\end{figure} + This solution might seem like cheating to some, but such ``cheating'' is key to finding good solutions to many concurrency problems.
Signature · 1 line
2.17.1
Quoted 11 lines · Akira Yokosawa
Hi Paul,
I think I figured out the way to do what you wanted the other day. Instead of putting \goodbreak in \QuickQ, putting it in \QuickE looks like the right approach.
Patch 1/6 does the change.
Patch 2/6 fixes a regression in the first attempt to put \goodbreak in front of QQZ.
Patches 3/6--6/6 fix minor issues in QQAz.
Feel free to rephrase the added opening sentence in Patch 4/6.
It looks fine!
Good stuff, queued and pushed, thank you!
Thanx, Paul
Quoted 20 lines
Thanks, Akira
--
Akira Yokosawa (6):
qqz.sty: Improve page/column breaks in Appendix E
qqz.sty: Fix position of \goodbreak for accuracy of hyperlinks
toolsoftrade: Use nbsp in front of single letter variable
debugging: Add opening sentence in Answer to QQZ 11.2 defer/rcuusage: Reverse nesting of fcvref and enumerate envs SMPdesign/partexercises: Move figure env next to first paragraph in QQASMPdesign/partexercises.tex | 15 +++++++-------- debugging/debugging.tex | 2 ++ defer/rcuusage.tex | 4 ++-- qqz.sty | 10 +++++----- toolsoftrade/toolsoftrade.tex | 7 +++---- 5 files changed, 19 insertions(+), 19 deletions(-)Signature · 1 line
2.17.1