From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from e39.co.us.ibm.com ([32.97.110.160]:50853 "EHLO e39.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751104AbbIQSev (ORCPT ); Thu, 17 Sep 2015 14:34:51 -0400 Received: from /spool/local by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 17 Sep 2015 12:34:51 -0600 Received: from b03cxnp08028.gho.boulder.ibm.com (b03cxnp08028.gho.boulder.ibm.com [9.17.130.20]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 383FC3E4003E for ; Thu, 17 Sep 2015 12:34:49 -0600 (MDT) Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t8HIXf3o55902290 for ; Thu, 17 Sep 2015 11:33:41 -0700 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t8HIYmP5008836 for ; Thu, 17 Sep 2015 12:34:48 -0600 Date: Thu, 17 Sep 2015 11:34:47 -0700 From: "Paul E. McKenney" Subject: Re: [PATCH 2/2] qqz: cross-link questions and answers Message-ID: <20150917183447.GH4029@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com References: <1442482376-16981-1-git-send-email-pbonzini@redhat.com> <1442482376-16981-3-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1442482376-16981-3-git-send-email-pbonzini@redhat.com> Sender: perfbook-owner@vger.kernel.org List-ID: To: Paolo Bonzini Cc: perfbook@vger.kernel.org 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 > --- > 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 >