ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Otared Kavian <otared@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Conditional float references
Date: Wed, 25 Sep 2013 05:46:20 +0200	[thread overview]
Message-ID: <48A5B149-E292-4F8B-B6E3-5181045A3EDC@gmail.com> (raw)
In-Reply-To: <20130922210228.GJ17308@homerow>

Hi Marco,

Your macro is a wonderful help to have smart references: I have not yet tried it with references to maths formulas, theorems, lemmas and such, but Iguess it should work as well.

In order to help you nail down some small issues, here is how I used your module: 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=singlesided]
\setuppagenumbering [alternative=doublesided]

\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=fig:alpha] \externalfigure \stopplacefigure
\startplacefigure [reference=fig:beta]  \externalfigure \stopplacefigure

\page 
{\bf Test 3:}

See \smartref{figure}[fig:alpha] and \smartref{figure}[fig:gamma].

\startplacefigure [reference=fig:gamma] \externalfigure \stopplacefigure
\startplacefigure [reference=fig: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=doublesided]
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=doublesided]
then Test 2 and Test 3 do not result in the smart references expected (they both result in « See figure 1 and figure 3. » while Test 2 should give « See figure 1 and figure 3 on next page. », and Test 3 should result in « See figure 1 on previous page and figure 3. »).

Thanks again for sharing your module.

Best regards: OK

On 22 sept. 2013, at 23:02, Marco Patzer <lists@homerow.info> wrote:

> Hi,
> 
> a couple of times the question came up¹²³ 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 “see figure 1.2 at page 42” 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
> 
> ¹ http://thread.gmane.org/gmane.comp.tex.context/65295
> ² http://thread.gmane.org/gmane.comp.tex.context/59455
> ³ http://thread.gmane.org/gmane.comp.tex.context/76001
> <conditionalfloatreferences.mkvi>___________________________________________________________________________________
> 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
> ___________________________________________________________________________________

___________________________________________________________________________________
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
___________________________________________________________________________________


  parent reply	other threads:[~2013-09-25  3:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-22 21:02 Marco Patzer
2013-09-23 16:46 ` Hans Hagen
2013-09-23 22:24   ` Marco Patzer
2013-09-25  3:46 ` Otared Kavian [this message]
2013-09-25  7:29   ` Marco Patzer
2013-09-25 14:40     ` Otared Kavian
2013-09-25 15:28       ` Marco Patzer
2013-10-08 21:23 ` Marco Patzer
     [not found] <mailman.222.1379923068.18665.ntg-context@ntg.nl>
2013-09-24 11:37 ` Robert Blackstone
2013-09-24 11:48   ` Marco Patzer
     [not found] <mailman.236.1380044639.18665.ntg-context@ntg.nl>
2013-09-24 19:52 ` Robert Blackstone

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=48A5B149-E292-4F8B-B6E3-5181045A3EDC@gmail.com \
    --to=otared@gmail.com \
    --cc=ntg-context@ntg.nl \
    /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;
as well as URLs for NNTP newsgroup(s).