From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: perfbook@vger.kernel.org
Subject: Re: [PATCH 2/2] qqz: cross-link questions and answers
Date: Thu, 17 Sep 2015 11:34:47 -0700 [thread overview]
Message-ID: <20150917183447.GH4029@linux.vnet.ibm.com> (raw)
In-Reply-To: <1442482376-16981-3-git-send-email-pbonzini@redhat.com>
On Thu, Sep 17, 2015 at 11:32:56AM +0200, Paolo Bonzini wrote:
> This is useful even if you _are_ actually solving the quick quizzes.
> Some ebook readers in particular support hyperlinks but have very
> limited support for PDF search and back/forward.
>
> The implementation is easy; it works by adding QQ.chapter.quiz labels
> at the question and QQA.chapter.quiz at the answer. The only
> interesting point is using \edef and \getrefnumber to extract the
> chapter number for answers, in a way that can be passed to
> \hyperref. An alternative would be to just use consecutive numbering
> for the QQ and QQA labels, but I find this a little more elegant.
Very nice, people have been asking for this for some time.
On their behalf, thank you very much!!! Queued and pushed.
Thanx, Paul
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> qqz.sty | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/qqz.sty b/qqz.sty
> index ca70c56..7270468 100644
> --- a/qqz.sty
> +++ b/qqz.sty
> @@ -18,13 +18,15 @@
> \newcounter{quickquizctr}
> \newcommand{\QuickQuizAnswerChapter}{\textbf{Unknown QuickQAC!!!}}
>
> +\newcommand{\QuickQHeading}[3]{\label{#1.#3}\hyperref[#2.#3]{\textbf{Quick Quiz #3:}}}
> +
> \newcommand{\QuickQuizChapter}[2]{
> \chapter{#2}
> \label{#1}
> \setcounter{quickquizctr}{0}}
> \newcommand{\QuickQuiz}[1]{
> \stepcounter{quickquizctr}
> - \textbf{Quick Quiz \thechapter.\thequickquizctr:}}
> + \QuickQHeading{QQ}{QQA}{\thechapter.\thequickquizctr}}
> \newcommand{\QuickQuizAnswer}[1]{\rule{7pt}{7pt}}
> \newcommand{\QuickQuizEnd}{}
>
> @@ -43,12 +45,12 @@
> %% Internal interfaces generated by scripts.
>
> \newcommand{\QuickQAC}[2]{
> - \renewcommand{\QuickQuizAnswerChapter}{\ref{#1}}
> + \edef\QuickQuizAnswerChapter{\getrefnumber{#1}}
> \setcounter{quickquizctr}{0}
> \section{#2}}
>
> \newcommand{\QuickQ}[1]{
> \stepcounter{quickquizctr} ~ \\ ~ \\
> - \textbf{Quick Quiz \QuickQuizAnswerChapter.\thequickquizctr:} #1 ~ \\ }
> + \QuickQHeading{QQA}{QQ}{\QuickQuizAnswerChapter.\thequickquizctr} #1 ~ \\ }
>
> \newcommand{\QuickA}[1]{\rule{7pt}{7pt} \\ ~ \\ \textbf{Answer:} \\ }
> --
> 2.5.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe perfbook" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
prev parent reply other threads:[~2015-09-17 18:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-17 9:32 [PATCH 0/2] Small improvements to qqz.sty Paolo Bonzini
2015-09-17 9:32 ` [PATCH 1/2] qqz: avoid duplicate references Paolo Bonzini
2015-09-17 18:34 ` Paul E. McKenney
2015-09-17 9:32 ` [PATCH 2/2] qqz: cross-link questions and answers Paolo Bonzini
2015-09-17 18:34 ` Paul E. McKenney [this message]
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=20150917183447.GH4029@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=pbonzini@redhat.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox