From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/84411 Path: news.gmane.org!not-for-mail From: Otared Kavian Newsgroups: gmane.comp.tex.context Subject: Re: Conditional float references Date: Wed, 25 Sep 2013 05:46:20 +0200 Message-ID: <48A5B149-E292-4F8B-B6E3-5181045A3EDC@gmail.com> References: <20130922210228.GJ17308@homerow> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1380080783 18512 80.91.229.3 (25 Sep 2013 03:46:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 25 Sep 2013 03:46:23 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Wed Sep 25 05:46:28 2013 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([5.39.185.229]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VOg3Y-0003A4-8e for gctc-ntg-context-518@m.gmane.org; Wed, 25 Sep 2013 05:46:28 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 4E1D1101DE; Wed, 25 Sep 2013 05:44:20 +0200 (CEST) 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 1+sNZXfx-ZNG; Wed, 25 Sep 2013 05:44:18 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id B75D3101E5; Wed, 25 Sep 2013 05:44:18 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id DE6FF101E5 for ; Wed, 25 Sep 2013 05:44:17 +0200 (CEST) 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 f2MOR6E-9HLL for ; Wed, 25 Sep 2013 05:44:16 +0200 (CEST) Original-Received: from filter3-ams.mf.surf.net (filter3-ams.mf.surf.net [192.87.102.71]) by balder.ntg.nl (Postfix) with ESMTP id 85102101DE for ; Wed, 25 Sep 2013 05:44:16 +0200 (CEST) Original-Received: from mail-wi0-x22e.google.com (mail-wi0-x22e.google.com [IPv6:2a00:1450:400c:c05::22e]) by filter3-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r8P3kM2t021251 for ; Wed, 25 Sep 2013 05:46:23 +0200 Original-Received: by mail-wi0-f174.google.com with SMTP id hj3so4775528wib.7 for ; Tue, 24 Sep 2013 20:46:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; bh=U8yz0xGw8/3aIlavqhqZVs14MWrYtDJTvXpNOTLAsvQ=; b=ittiCHt8dyZ6HfcfQb2EVZOj2d9hefS6P9LLTudiL0XOJ3o9I++8p29nKiJptTysP9 sZ8Qvm7YBQME41Zko6yoiEahPsxAtfNeoT7JAKlari+eiOj5g5ZckDk7GrtWa4hjVL/i /Ujr/FGhLCDTegtlzOvMxZCOLSJ85Rd3knaYNydQarQo94uqINflRjLh5hWu1KYsre4l lQwQSXoYUI2id4Yad7gwMHUYjS/f46rgEZfdHfl2nRvN4o6Y6AqDLVN411h0PZLpjPSN XoZ7e3lbGwAMKawJUfODBmjeNtYJCRSy2A3YRm0jmp32O0yklK2liEoeZtaxsldOeMvT 5IcQ== X-Received: by 10.180.9.41 with SMTP id w9mr20924183wia.21.1380080782633; Tue, 24 Sep 2013 20:46:22 -0700 (PDT) Original-Received: from [192.168.0.20] (seg75-6-82-236-32-4.fbx.proxad.net. [82.236.32.4]) by mx.google.com with ESMTPSA id c4sm13439750wiz.0.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 24 Sep 2013 20:46:21 -0700 (PDT) In-Reply-To: <20130922210228.GJ17308@homerow> X-Mailer: Apple Mail (2.1510) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=2a00:1450:400c:c05::22e; country=IE X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 03KtfKmeU - 711704ff5b02 - 20130925 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 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-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:84411 Archived-At: Hi Marco, Your macro is a wonderful help to have smart references: I have not yet tri= ed it with references to maths formulas, theorems, lemmas and such, but Igu= ess it should work as well. In order to help you nail down some small issues, here is how I used your m= odule: I put the file you sent conditionalfloatreferences.mkvi in a folder (i.e. a directory) and then in a TeX file I put the following (= not so) minimal example excerpted from your file %%% begin smartref-test.tex \usemodule[conditionalfloatreferences] \useMPlibrary [dum] %\setuppagenumbering [alternative=3Dsinglesided] \setuppagenumbering [alternative=3Ddoublesided] \starttext {\bf Test 1:} See \smartref{figure}[fig:alpha] and \smartref{figure}[fig:gamma]. \page = {\bf Test 2:} See \smartref{figure}[fig:alpha] and \smartref{figure}[fig:gamma]. \startplacefigure [reference=3Dfig:alpha] \externalfigure \stopplacefigure \startplacefigure [reference=3Dfig:beta] \externalfigure \stopplacefigure \page = {\bf Test 3:} See \smartref{figure}[fig:alpha] and \smartref{figure}[fig:gamma]. \startplacefigure [reference=3Dfig:gamma] \externalfigure \stopplacefigure \startplacefigure [reference=3Dfig:delta] \externalfigure \stopplacefigure \page = {\bf Test 4:} See \smartref{figure}[fig:alpha] and \smartref{figure}[fig:gamma]. \page = {\bf Test 5:} See \smartref{figure}[fig:alpha] and \smartref{figure}[fig:gamma]. \stoptext %%% end smartref-test.tex The issues I noticed are the following: 1. Typesetting the file gives an error message when there is no = \setuppagenumbering[alternative=3Ddoublesided] Actually it typesets if one ignores the error message (but some issues like= the ones below remain). 2. In the above minimal example, when stating = \setuppagenumbering[alternative=3Ddoublesided] then Test 2 and Test 3 do not result in the smart references expected (they= both result in =AB See figure 1 and figure 3. =BB while Test 2 should give= =AB See figure 1 and figure 3 on next page. =BB, and Test 3 should result = in =AB See figure 1 on previous page and figure 3. =BB). Thanks again for sharing your module. Best regards: OK On 22 sept. 2013, at 23:02, Marco Patzer wrote: > Hi, > = > a couple of times the question came up=B9=B2=B3 how to create more > intelligent referencing. There are already mechanisms in the core, > namely \somewhere and \atpage but they both have drawbacks. > \somewhere happily prints its text if the figure is placed on the > same double page. In fact, no text at all should be printed if the > figure is visible. Furthermore it's a little verbose to use unless > hidden in a custom macro. \atpage on the other hand doesn't hesitate > to print =93see figure 1.2 at page 42=94 while you're on page 42. > = > I'm aware that automatic generation of reference text is problematic > since the text depends on the placement of floats which in turn > depends on the text which might result in oscillation. I'm not sure > how likely this is to occur in practice. > = > I don't know if there's interest in integrating such functionality > into the core. I attached some code, a new macro \smartref, which > takes the same arguments as \in. > = > \smartref{figure}[fig:somefigure] > = > - it prints the reference if it is on the same page > (e.g. Figure 1.2) > = > - it prints the reference and a customizable text if the reference > is on the next/previous page (e.g. Figure 1.2 on the previous page) > = > - it prints the reference and the page if the reference is further > away than one page (e.g. Figure 1.2 on page 42) > = > - it adapts to single-sided and double-sided layouts > = > = > Marco > = > =B9 http://thread.gmane.org/gmane.comp.tex.context/65295 > =B2 http://thread.gmane.org/gmane.comp.tex.context/59455 > =B3 http://thread.gmane.org/gmane.comp.tex.context/76001 > ________________________________________= ___________________________________________ > 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-co= ntext > webpage : http://www.pragma-ade.nl / http://tex.aanhet.net > archive : http://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > _________________________________________________________________________= __________ ___________________________________________________________________________= ________ If your question is of interest to others as well, please add an entry to t= he Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-cont= ext webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________= ________