Skip to contentSkip to conversation

qqz.sty: Permit column/page break in front of Quick Quiz heading

PATCH In review Akira Yokosawa 2 participants 6 messages Mar 1, 2020 – Mar 2, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qqz.sty: Permit column/page break in front of Quick Quiz heading

From 2c4fd06827d075a04c157d150cf036db1615f268 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sun, 1 Mar 2020 21:47:45 +0900
Subject: [PATCH] qqz.sty: Permit column/page break in front of Quick Quiz heading

It turned out that the definition of \QuickQuiz needs an explicit hint (\goodbreak) for LaTeX to be able to break column/page in front of it.

---
 qqz.sty | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qqz.sty +1 -1
index eda6dc31..4dd411f6 100644
@@ -34,7 +34,7 @@
 	}
 \newcommand{\QuickQuiz}[1]{
 	\refstepcounter{quickquizctr}
-	\QuickQHeading{QQ}{QQA}{\thechapter.\thequickquizctr}}
+	\goodbreak\QuickQHeading{QQ}{QQA}{\thechapter.\thequickquizctr}}
 \newcommand{\QuickQuizAnswer}[1]{%
 	\refstepcounter{quickquizctrE}%
 	\hyperref[QQA.\thechapter.\thequickquizctr]{\rule{7pt}{7pt}}%
Signature · 1 line
2.17.1
#1 lore raw
Quoted 10 lines · Akira Yokosawa
Quoted 1 line

From 2c4fd06827d075a04c157d150cf036db1615f268 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Sun, 1 Mar 2020 21:47:45 +0900
Subject: [PATCH] qqz.sty: Permit column/page break in front of Quick Quiz heading

It turned out that the definition of \QuickQuiz needs an explicit hint (\goodbreak) for LaTeX to be able to break column/page in front of it.

Nice!

Does it make sense to also add \goodbreak at the end of a Quick Quiz, perhaps as follows? Doing so gets QQ2.11 all on one page in the two-column version.

Does it also make sense to encourage page breaks at the beginnings of Quick Quizzes in the answer chapter?

In other words, should I fold the diff below into your diff, or would doing so break something?

Thanx, Paul

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

qqz.sty +2 -2
index 4dd411f..8bd80d9 100644
@@ -39,7 +39,7 @@
 	\refstepcounter{quickquizctrE}%
 	\hyperref[QQA.\thechapter.\thequickquizctr]{\rule{7pt}{7pt}}%
 	\label{QQE.\thechapter.\thequickquizctrE}}
-\newcommand{\QuickQuizEnd}{}
+\newcommand{\QuickQuizEnd}{\goodbreak}
 
 % To create a macro referencing the previously defined quick quiz:
 %	\QuickQuizLabel{\QQname}
@@ -80,7 +80,7 @@
 \newcommand{\QuickQ}[1]{
 	\par
 	\refstepcounter{quickquizctrC}%
-	\noindent
+	\goodbreak\noindent
 	\QuickQHeading{QQA}{QQ}{\QuickQuizAnswerChapter.\thequickquizctrC} #1 ~ \\ }
 
 \newcommand{\QuickA}[1]{%
#2 lore raw
Quoted 18 lines · Paul E. McKenney
Quoted 10 lines · Akira Yokosawa
Quoted 1 line

From 2c4fd06827d075a04c157d150cf036db1615f268 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Sun, 1 Mar 2020 21:47:45 +0900
Subject: [PATCH] qqz.sty: Permit column/page break in front of Quick Quiz heading

It turned out that the definition of \QuickQuiz needs an explicit hint (\goodbreak) for LaTeX to be able to break column/page in front of it.

Nice!

Does it make sense to also add \goodbreak at the end of a Quick Quiz, perhaps as follows? Doing so gets QQ2.11 all on one page in the two-column version.

Quoted 5 lines

Does it also make sense to encourage page breaks at the beginnings of Quick Quizzes in the answer chapter?

In other words, should I fold the diff below into your diff, or would doing so break something?

2nd hunk causes the headings of Sections E.3, E.5, E.10, E.13, E.17, and E.20 to be at the bottom. So please just apply the first hunk. Also, the title and the change log need some adjustment.

Thanks, Akira

Quoted 28 lines

Thanx, Paul

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

qqz.sty +2 -2
index 4dd411f..8bd80d9 100644
@@ -39,7 +39,7 @@
 	\refstepcounter{quickquizctrE}%
 	\hyperref[QQA.\thechapter.\thequickquizctr]{\rule{7pt}{7pt}}%
 	\label{QQE.\thechapter.\thequickquizctrE}}
-\newcommand{\QuickQuizEnd}{}
+\newcommand{\QuickQuizEnd}{\goodbreak}
 
 % To create a macro referencing the previously defined quick quiz:
 %	\QuickQuizLabel{\QQname}
@@ -80,7 +80,7 @@
 \newcommand{\QuickQ}[1]{
 	\par
 	\refstepcounter{quickquizctrC}%
-	\noindent
+	\goodbreak\noindent
 	\QuickQHeading{QQA}{QQ}{\QuickQuizAnswerChapter.\thequickquizctrC} #1 ~ \\ }
 
 \newcommand{\QuickA}[1]{%
#3 lore raw
Quoted 22 lines · Akira Yokosawa
Quoted 21 lines · Paul E. McKenney
Quoted 10 lines · Akira Yokosawa
Quoted 1 line

From 2c4fd06827d075a04c157d150cf036db1615f268 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Sun, 1 Mar 2020 21:47:45 +0900
Subject: [PATCH] qqz.sty: Permit column/page break in front of Quick Quiz heading

It turned out that the definition of \QuickQuiz needs an explicit hint (\goodbreak) for LaTeX to be able to break column/page in front of it.

Nice!

Does it make sense to also add \goodbreak at the end of a Quick Quiz, perhaps as follows? Doing so gets QQ2.11 all on one page in the two-column version.

Does it also make sense to encourage page breaks at the beginnings of Quick Quizzes in the answer chapter?

Quoted 6 lines
Quoted 2 lines

In other words, should I fold the diff below into your diff, or would doing so break something?

2nd hunk causes the headings of Sections E.3, E.5, E.10, E.13, E.17, and E.20 to be at the bottom. So please just apply the first hunk. Also, the title and the change log need some adjustment.

Good point, and done! Queued and pushed.

I suspect that an appropriate "\if" statement would repair the second hunk, but on the other hand, having quick quizzes broken across lines in the answer section isn't as jarring as in the main body of the text.

Thanx, Paul

Quoted 25 lines
Quoted 25 lines

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

qqz.sty +2 -2
index 4dd411f..8bd80d9 100644
@@ -39,7 +39,7 @@
 	\refstepcounter{quickquizctrE}%
 	\hyperref[QQA.\thechapter.\thequickquizctr]{\rule{7pt}{7pt}}%
 	\label{QQE.\thechapter.\thequickquizctrE}}
-\newcommand{\QuickQuizEnd}{}
+\newcommand{\QuickQuizEnd}{\goodbreak}
 
 % To create a macro referencing the previously defined quick quiz:
 %	\QuickQuizLabel{\QQname}
@@ -80,7 +80,7 @@
 \newcommand{\QuickQ}[1]{
 	\par
 	\refstepcounter{quickquizctrC}%
-	\noindent
+	\goodbreak\noindent
 	\QuickQHeading{QQA}{QQ}{\QuickQuizAnswerChapter.\thequickquizctrC} #1 ~ \\ }
 
 \newcommand{\QuickA}[1]{%
#4 lore raw
Quoted 30 lines · Paul E. McKenney
Quoted 22 lines · Akira Yokosawa
Quoted 21 lines · Paul E. McKenney
Quoted 10 lines · Akira Yokosawa
Quoted 1 line

From 2c4fd06827d075a04c157d150cf036db1615f268 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Sun, 1 Mar 2020 21:47:45 +0900
Subject: [PATCH] qqz.sty: Permit column/page break in front of Quick Quiz heading

It turned out that the definition of \QuickQuiz needs an explicit hint (\goodbreak) for LaTeX to be able to break column/page in front of it.

Nice!

Does it make sense to also add \goodbreak at the end of a Quick Quiz, perhaps as follows? Doing so gets QQ2.11 all on one page in the two-column version.

Does it also make sense to encourage page breaks at the beginnings of Quick Quizzes in the answer chapter?

Quoted 6 lines
Quoted 2 lines

In other words, should I fold the diff below into your diff, or would doing so break something?

2nd hunk causes the headings of Sections E.3, E.5, E.10, E.13, E.17, and E.20 to be at the bottom. So please just apply the first hunk. Also, the title and the change log need some adjustment.

Quoted 5 lines

Good point, and done! Queued and pushed.

I suspect that an appropriate "\if" statement would repair the second hunk, but on the other hand, having quick quizzes broken across lines in the answer section isn't as jarring as in the main body of the text.

My guess is that the \par command in the beginning of \QuickQ implies breakable point and the extra \goodbreak confused the TeX engine.

What you want is to keep an Answer to a Quick Quiz to be in the same column/page as much as possible?

Thanks, Akira

Quoted 28 lines

Thanx, Paul

Quoted 25 lines
Quoted 25 lines

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

qqz.sty +2 -2
index 4dd411f..8bd80d9 100644
@@ -39,7 +39,7 @@
 	\refstepcounter{quickquizctrE}%
 	\hyperref[QQA.\thechapter.\thequickquizctr]{\rule{7pt}{7pt}}%
 	\label{QQE.\thechapter.\thequickquizctrE}}
-\newcommand{\QuickQuizEnd}{}
+\newcommand{\QuickQuizEnd}{\goodbreak}
 
 % To create a macro referencing the previously defined quick quiz:
 %	\QuickQuizLabel{\QQname}
@@ -80,7 +80,7 @@
 \newcommand{\QuickQ}[1]{
 	\par
 	\refstepcounter{quickquizctrC}%
-	\noindent
+	\goodbreak\noindent
 	\QuickQHeading{QQA}{QQ}{\QuickQuizAnswerChapter.\thequickquizctrC} #1 ~ \\ }
 
 \newcommand{\QuickA}[1]{%
#5 lore raw
Quoted 31 lines · Akira Yokosawa
Quoted 30 lines · Paul E. McKenney
Quoted 28 lines · Akira Yokosawa
Quoted 18 lines · Paul E. McKenney
Quoted 10 lines · Akira Yokosawa
Quoted 1 line

From 2c4fd06827d075a04c157d150cf036db1615f268 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Sun, 1 Mar 2020 21:47:45 +0900
Subject: [PATCH] qqz.sty: Permit column/page break in front of Quick Quiz heading

It turned out that the definition of \QuickQuiz needs an explicit hint (\goodbreak) for LaTeX to be able to break column/page in front of it.

Nice!

Does it make sense to also add \goodbreak at the end of a Quick Quiz, perhaps as follows? Doing so gets QQ2.11 all on one page in the two-column version.

Quoted 5 lines

Does it also make sense to encourage page breaks at the beginnings of Quick Quizzes in the answer chapter?

In other words, should I fold the diff below into your diff, or would doing so break something?

2nd hunk causes the headings of Sections E.3, E.5, E.10, E.13, E.17, and E.20 to be at the bottom. So please just apply the first hunk. Also, the title and the change log need some adjustment.

Quoted 8 lines
Quoted 5 lines

Good point, and done! Queued and pushed.

I suspect that an appropriate "\if" statement would repair the second hunk, but on the other hand, having quick quizzes broken across lines in the answer section isn't as jarring as in the main body of the text.

My guess is that the \par command in the beginning of \QuickQ implies breakable point and the extra \goodbreak confused the TeX engine.

Good point, that would do it!

Quoted 2 lines

What you want is to keep an Answer to a Quick Quiz to be in the same column/page as much as possible?

I was mostly just experimenting. Yes, readers would want the quick quiz and its answer in the same column, or, failing that, on the same page. But the quizzes+answers are too long to do that without leaving lots of ugly whitespace. So there will be breaks somewhere.

I was thinking in terms of encouraging LaTeX to keep the question part in a single column, given that the questions are normally rather short. But it certainly isn't worth having section headings at the bottom of a column!

Thanx, Paul

Quoted 30 lines

Thanks, Akira

Quoted 28 lines

Thanx, Paul

Quoted 25 lines
Quoted 25 lines

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

qqz.sty +2 -2
index 4dd411f..8bd80d9 100644
@@ -39,7 +39,7 @@
 	\refstepcounter{quickquizctrE}%
 	\hyperref[QQA.\thechapter.\thequickquizctr]{\rule{7pt}{7pt}}%
 	\label{QQE.\thechapter.\thequickquizctrE}}
-\newcommand{\QuickQuizEnd}{}
+\newcommand{\QuickQuizEnd}{\goodbreak}
 
 % To create a macro referencing the previously defined quick quiz:
 %	\QuickQuizLabel{\QQname}
@@ -80,7 +80,7 @@
 \newcommand{\QuickQ}[1]{
 	\par
 	\refstepcounter{quickquizctrC}%
-	\noindent
+	\goodbreak\noindent
 	\QuickQHeading{QQA}{QQ}{\QuickQuizAnswerChapter.\thequickquizctrC} #1 ~ \\ }
 
 \newcommand{\QuickA}[1]{%