From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/72567 Path: news.gmane.org!not-for-mail From: "Meer, H. van der" Newsgroups: gmane.comp.tex.context Subject: Re: referencing Date: Sun, 20 Nov 2011 20:26:59 +0000 Message-ID: <40618C2C-86AE-4ED1-AD5D-3B8AE0732149@uva.nl> References: <34E24576-0864-4263-B44A-711118D75BEB@xs4all.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1321820834 11383 80.91.229.12 (20 Nov 2011 20:27:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 20 Nov 2011 20:27:14 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Nov 20 21:27:10 2011 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RSDyo-0003XN-G9 for gctc-ntg-context-518@m.gmane.org; Sun, 20 Nov 2011 21:27:10 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 1601ECB11D; Sun, 20 Nov 2011 21:27:10 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id L+IgvQSRS7fa; Sun, 20 Nov 2011 21:27:06 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 82FFECB110; Sun, 20 Nov 2011 21:27:06 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 291A3CB110 for ; Sun, 20 Nov 2011 21:27:05 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ZKKmd4hbwxi6 for ; Sun, 20 Nov 2011 21:27:03 +0100 (CET) Original-Received: from filter1-til.mf.surf.net (filter1-til.mf.surf.net [194.171.167.217]) by balder.ntg.nl (Postfix) with ESMTP id 470B8CB10D for ; Sun, 20 Nov 2011 21:27:03 +0100 (CET) Original-Received: from holleman.uva.nl (holleman.uva.nl [146.50.108.228]) by filter1-til.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id pAKKR0Zp010694 for ; Sun, 20 Nov 2011 21:27:00 +0100 Original-Received: from ketelaar.uva.nl ([fe80::cc61:4c73:c438:df97]) by holleman.uva.nl ([146.50.108.228]) with mapi id 14.01.0339.001; Sun, 20 Nov 2011 21:27:00 +0100 Thread-Topic: [NTG-context] referencing Thread-Index: AQHMp6ya0Y3oJvTBvU69y6DILsgDdpW2CBIAgAAdU4A= In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [82.95.102.36] Content-ID: <8DC19BC1FE26BA46B643C13BA6091893@uva.nl> X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=146.50.108.228; country=NL; region=07; city=Amsterdam; latitude=52.3500; longitude=4.9167; http://maps.google.com/maps?q=52.3500,4.9167&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 08FXwr0SX - 1b0124d71480 - 20111120 X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.217 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:72567 Archived-At: Thanks Wolfgang for the code. Just in case it is of use I concocted my variation on this theme. Now this simply replaces the \in, \at and \about macro's with one that does not show on the page where the link originates, but behaves as of old everywhere else. I introduced the unskip in order to remove the space that ruins the end of a line when there is nothing to display. For example from \in{see there}[ref]. <--this period would otherwise acquire a space before it. \def\SamePageDo#1[#2]% {\doifreferencefoundelse{#2} {\ifnum\referencepagestate=1 \unskip%\unknown % reference is on the same page \else #1[#2]% \fi} {\unskip}} % reference not found \let\oldin=\in \let\oldat=\at \let\oldabout=\about \def\in{\SamePageDo\oldin} \def\at{\SamePageDo\oldat} \def\about{\SamePageDo\oldabout} Hans van der Meer On 20 nov. 2011, at 19:42, Wolfgang Schuster wrote: > > Am 20.11.2011 um 18:46 schrieb Hans van der Meer: > >> I have the following question about references. >> >> Using for example \at one can say somehting like "see on \at{page}[ref] for the figure.. >> But when the figure is one the same page it seems a bit superfluous to reference to it. In the same manner it is a bit of an overkill to put a hyperlink to the page where this link resides itself. >> >> It is clear that ConTeXt knows if it is on the same page as is referenced, because then a link is coloured with contrastcolor instead of color. >> >> Now the question: how easy/difficult is it to either suppress such an \at-reference or switch between chosen alternate texts for links on or off the same page as the referenced item? > > \def\SamePage[#1]% > {\doifreferencefoundelse{#1} > {\ifnum\referencepagestate=1 > \unknown % reference is on the same page > \else > \at[#1]% > \fi} > {\donothing}} > > \starttext > > \pagereference[one] > \pagereference[two] > > One: \SamePage[one] > > \page > > Two: \SamePage[one] > > \stoptext > > Wolfgang ___________________________________________________________________________________ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________