All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Akira Yokosawa <akiyks@gmail.com>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: perfbook@vger.kernel.org, Akira Yokosawa <akiyks@gmail.com>
Subject: [PATCH -perfbook 1/5] qqz.sty: Use \refstepcounter after leaving vmode in tcolorbox
Date: Wed, 14 Apr 2021 19:54:53 +0900	[thread overview]
Message-ID: <32203b30-45a4-fdb1-b2e3-141ffb5afc90@gmail.com> (raw)
In-Reply-To: <b1bb1f84-9195-33ab-b6d1-ac68be1dca84@gmail.com>

This avoids occasional missing destination of hyperlink with hyperref
v7.00j and later.
\refstepcounter is changed to be breakable in vertical mode, and if
it causes a page break the destination is discarded by tcolorbox.
This can be avoided by leaving vmode before using \refstepcounter.

This workaround was suggested by Ulrike Fischer in a GitHub issue
Akira opened [1].

By this change, some lines in the macro definitions need tail
comments to avoid unnecessary horizontal skips.

Also move \refstepcounter of \EQuickQuiz{} inside tcolorbox for
noqqz build.

While we are here, remove a redundant \hyperref macro in
\QuickQuizAnswer for noqqz build.  It caused a lot of warnings
from hyperref in -nq builds, which the log checker in runlatex.sh
ignores.

[1]: https://github.com/latex3/hyperref/issues/186

Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
 qqz.sty | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/qqz.sty b/qqz.sty
index 897d1ab6..0992c027 100644
--- a/qqz.sty
+++ b/qqz.sty
@@ -87,15 +87,14 @@
 \newcommand{\QuickQuizE}[1]{%
 	\refstepcounter{quickquizctr}%
 	\QuickQHeadingEnd{QQ}{QQA}{\thechapter.\thequickquizctr}}
-\newcommand{\EQuickQuiz}[1]{
-	\refstepcounter{quickquizctr}
+\newcommand{\EQuickQuiz}[1]{%
 	\begin{tcolorbox}[breakable]
-	\small\QuickQHeading{QQ}{QQA}{\thechapter.\thequickquizctr}
+	\leavevmode\refstepcounter{quickquizctr}%
+	\small\QuickQHeading{QQ}{QQA}{\thechapter.\thequickquizctr}%
 	{#1}
 }
 \newcommand{\QuickQuizAnswer}[1]{%
 	\refstepcounter{quickquizctrE}%
-	\hyperref[QQA.\thechapter.\thequickquizctr]{}%
 	\label{QQE.\thechapter.\thequickquizctrE}}
 \newcommand{\QuickQuizAnswerB}[1]{\QuickQuizAnswer{#1}}
 \newcommand{\QuickQuizAnswerM}[1]{\QuickQuizAnswer{#1}}
@@ -116,7 +115,7 @@
 \IfQqzBg{
 \newcommand{\QuickQuiz}[1]{
 	\begin{tcolorbox}[breakable]
-	\refstepcounter{quickquizctr}
+	\leavevmode\refstepcounter{quickquizctr}%
 	\small\QuickQHeading{QQ}{QQA}{\thechapter.\thequickquizctr}
 	{#1}
 }
@@ -209,7 +208,7 @@
 \IfQqzBg{
 \newcommand{\QuickQ}[1]{
 	\begin{tcolorbox}[breakable]
-	\refstepcounter{quickquizctrC}
+	\leavevmode\refstepcounter{quickquizctrC}%
 	\QuickQHeading{QQA}{QQ}{\QuickQuizAnswerChapter.\thequickquizctrC} \\
 }
 
@@ -220,7 +219,7 @@
 }{\IfNoQqz{
 \newcommand{\QuickQ}[1]{
 	\begin{tcolorbox}[breakable]
-	\refstepcounter{quickquizctrC}
+	\leavevmode\refstepcounter{quickquizctrC}%
 	\QuickQHeadingPage{QQA}{QQ}{\QuickQuizAnswerChapter.\thequickquizctrC}\\
 }
 
-- 
2.17.1



  reply	other threads:[~2021-04-14 10:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-14 10:47 [PATCH -perfbook 0/5] Updates of qqz.sty Akira Yokosawa
2021-04-14 10:54 ` Akira Yokosawa [this message]
2021-04-14 11:04 ` [PATCH -perfbook 2/5] qqz.sty: Modify -nq build to have chapterwise quiz-only section Akira Yokosawa
2021-04-14 11:09 ` [PATCH -perfbook 3/5] perfbook-lt.tex: Remove boolean qqzchpend Akira Yokosawa
2021-04-14 11:11 ` [PATCH -perfbook 4/5] howto, Makefile: Update answer to Quick Quiz 1.3 and 'make help-full' Akira Yokosawa
2021-04-14 11:12 ` [PATCH -perfbook 5/5] qqz.sty: Add page reference to QQA Appendix as the same as -nq build Akira Yokosawa
2021-04-14 17:31 ` [PATCH -perfbook 0/5] Updates of qqz.sty Paul E. McKenney
2021-04-15  3:49   ` Akira Yokosawa
2021-04-15  5:11     ` Paul E. McKenney
2021-04-15  5:47       ` Akira Yokosawa
2021-04-15 15:30         ` Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=32203b30-45a4-fdb1-b2e3-141ffb5afc90@gmail.com \
    --to=akiyks@gmail.com \
    --cc=paulmck@kernel.org \
    --cc=perfbook@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.