From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/100769 Path: news.gmane.org!.POSTED!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: registers: how can I place a command around the whole of the page numbers of an index term? Date: Thu, 10 May 2018 12:44:41 +0200 Message-ID: <5AF42299.2040407@gmail.com> References: <1a01ccca314c761d8af7a20045331646e08b365d.camel@fastwebnet.it> <4f0ea2b4ad4501605dca93eda0ac21722a856d5c.camel@fastwebnet.it> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0106417925903742077==" X-Trace: blaine.gmane.org 1525948991 18439 195.159.176.226 (10 May 2018 10:43:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 10 May 2018 10:43:11 +0000 (UTC) User-Agent: Postbox 5.0.25 (Macintosh/20180328) Cc: Hans Hagen To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu May 10 12:43:07 2018 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fGj2Q-0004i6-T7 for gctc-ntg-context-518@m.gmane.org; Thu, 10 May 2018 12:43:06 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 8B76A24FDC; Thu, 10 May 2018 12:44:57 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yzAVyEhwdUn6; Thu, 10 May 2018 12:44:56 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id CDE1224FDF; Thu, 10 May 2018 12:44:56 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 4244B24FDF for ; Thu, 10 May 2018 12:44:56 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KwF5UgsBa2Qo for ; Thu, 10 May 2018 12:44:55 +0200 (CEST) Original-Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 6CDE824FDC for ; Thu, 10 May 2018 12:44:45 +0200 (CEST) Original-Received: by mail-wm0-f48.google.com with SMTP id f6-v6so3166884wmc.4 for ; Thu, 10 May 2018 03:44:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to; bh=+PEfpMyoffbmumvf1/3gNaMXcuRYv6XT4PVWHPM9/xM=; b=sAxnKj2Bda/e8PL97t9jj/D6fC4Z5/xfZNvFld0OlV7A0ty7myuib4ywweOkFdn9in LP+IBMV7+i+BTBRod9JHy9xcxvQnPoCyYLyA7rneTQNKC0kspTnSX+QgfJ6IY3+iSOdh Ca1CKODeQheZm2o4y0yuobeSOG7hbaRjJwj744/41pz7iCNSuw5giB+ZVlFG0gRcT+PH 3TKIayJGEMog/q4XIUoV0IhXuGPuQmLfBRHjNGDhcDljBVY3ujD3Hsqt3UDSVwbhOYNN iikaedkW01blKj7LMINH7/F5l2H/F8wF52FiQ6PdGdNV5ndT/hfE4p7fDZ1XqJK1v3Rv ICNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to; bh=+PEfpMyoffbmumvf1/3gNaMXcuRYv6XT4PVWHPM9/xM=; b=I/jWtDEqGnUao9Lje6stvPEDuHLG8dBgoSpUi36981l2+TonyhU7TKEej1wZagnNk7 rdAfCeoHL4v3DtfGNZbE79TP8CiXYZP0EV8Vq8aG61qB/kIbf9vM7aX19wajDwoQKe80 BS5KcS+Qqb8XJfxQuw7xpWQAKghn7vJPpD5pO4n+9UP8wFHA8NxrhgOMFDkX1ADNoEQB Pe+/AAYVtYLBZ/+Uis04IsLbBdcIeu1/L2Q1RdvdrgD16ysC+QNSlL37TtMDZXER4AbY kJjvYMGVbwG7f9pkKN6MMJyaRn/MbXP9xdfht1rJOQlQiAm3ssAYZdYuELGJgQKmvMdJ VaVQ== X-Gm-Message-State: ALKqPwcWStzUGuGukEVFacj/Zqj/dni2i2fL/UzH8rgnK3+1B09sV2IQ bv+HAlx3VlnMz7AWRYcUt209AK5+ X-Google-Smtp-Source: AB8JxZodYGgHSxzEAhPoBo+5EReqKG+AfJlKAod2UkVyDLmiZxc0bJjaFqDUaQzv3uL9q7i23ukVLQ== X-Received: by 2002:a1c:cb88:: with SMTP id b130-v6mr948998wmg.78.1525949084814; Thu, 10 May 2018 03:44:44 -0700 (PDT) Original-Received: from [192.168.1.11] (x5ce38501.dyn.telefonica.de. [92.227.133.1]) by smtp.gmail.com with ESMTPSA id b11-v6sm878874wrf.50.2018.05.10.03.44.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 May 2018 03:44:44 -0700 (PDT) In-Reply-To: <4f0ea2b4ad4501605dca93eda0ac21722a856d5c.camel@fastwebnet.it> X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.16 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.org gmane.comp.tex.context:100769 Archived-At: This is a multi-part message in MIME format. --===============0106417925903742077== Content-Type: multipart/alternative; boundary="------------040106060106040008010100" This is a multi-part message in MIME format. --------------040106060106040008010100 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit The following solution which adds two additional keys (pageleft and pageright) is cleaner because it doesn’t have to overload commands. \unprotect \unexpanded\def\startregisterpages {\begingroup \dostarttagged\t!registerpages\empty \useregisterstyleandcolor\c!pagestyle\c!pagecolor \registerparameter\c!pageleft} \unexpanded\def\stopregisterpages {\registerparameter\c!pageright \dostoptagged \endgroup} \protect \setupregister [index] [n=1, alternative=A, distance=0pt, pageleft=\wordright\bgroup, pageright=\egroup] \starttext \CONTEXT\index{\ConTeXt} \page \LATEX\index{\LaTeX} \page \CONTEXT\index{\ConTeXt} \page \placeindex \stoptext Wolfgang > MF > 10. Mai 2018 um 12:35 > This is a more polite version, that lets you restore the original > macros. > > \let\origstartregisterpages=\startregisterpages% > \let\origstopregisterpages=\stopregisterpages% > \def\setupregisterpagescommand#1{% > \unexpanded\def\startregisterpages{\origstartregisterpages#1\bgroup } > \unexpanded\def\stopregisterpages{\egroup\origstopregisterpages}} > \def\resetregisterpagescommand{% > \let\startregisterpages=\origstartregisterpages% > \let\stopregisterpages=\origstopregisterpages} > > \setupregister[index][n=1,alternative=A] > > \starttext > \CONTEXT\index{\ConTeXt} > \page > \LATEX\index{\LaTeX} > \page > \CONTEXT\index{\ConTeXt} > \page > \setupregisterpagescommand{\wordright} > \placeindex > \page > \resetregisterpagescommand > \placeindex > \stoptext > > btw, Hans, are you going to add an option to \setupregister? :) > ___________________________________________________________________________________ > If your question is of interest to others as well, please add an entry > to the Wiki! > > maillist : ntg-context@ntg.nl / > http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > ___________________________________________________________________________________ --------------040106060106040008010100 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit The following solution which adds two additional keys (pageleft and pageright)
is cleaner because it doesn’t have to overload commands.


\unprotect

\unexpanded\def\startregisterpages
  {\begingroup
   \dostarttagged\t!registerpages\empty
   \useregisterstyleandcolor\c!pagestyle\c!pagecolor
   \registerparameter\c!pageleft}

\unexpanded\def\stopregisterpages
  {\registerparameter\c!pageright
   \dostoptagged
   \endgroup}

\protect

\setupregister
  [index]
  [n=1,
   alternative=A,
   distance=0pt,
   pageleft=\wordright\bgroup,
   pageright=\egroup]

\starttext
\CONTEXT\index{\ConTeXt}
\page
\LATEX\index{\LaTeX}
\page
\CONTEXT\index{\ConTeXt}
\page
\placeindex
\stoptext


Wolfgang
10. Mai 2018 um 12:35
This is a more polite version, that lets you restore the original
macros.

\let\origstartregisterpages=\startregisterpages%
\let\origstopregisterpages=\stopregisterpages%
\def\setupregisterpagescommand#1{%
\unexpanded\def\startregisterpages{\origstartregisterpages#1\bgroup }
\unexpanded\def\stopregisterpages{\egroup\origstopregisterpages}}
\def\resetregisterpagescommand{%
\let\startregisterpages=\origstartregisterpages%
\let\stopregisterpages=\origstopregisterpages}

\setupregister[index][n=1,alternative=A]

\starttext
\CONTEXT\index{\ConTeXt}
\page
\LATEX\index{\LaTeX}
\page
\CONTEXT\index{\ConTeXt}
\page
\setupregisterpagescommand{\wordright}
\placeindex
\page
\resetregisterpagescommand
\placeindex
\stoptext

btw, Hans, are you going to add an option to \setupregister? :)
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________

--------------040106060106040008010100-- --===============0106417925903742077== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f --===============0106417925903742077==--