[OS X TeX] LaTeX brain puzzle

Geoff Vallis gkv at Princeton.EDU
Wed Sep 14 13:52:21 CEST 2005

This is slightly off-topic, being a latex question in general and not  
OSX specific, but brain-teaser addicts or clever macro writers might  
have the answer.

I need to reference a table by page number. If the table has a label  
in it called mylabel then I can write: 'See the table on page \pageref 
But if the table is on the same page, or the next page, as the  
referencing sentence this looks  bit silly. In that case I would like  
to say, for example, 'see the table at the top of this page.' Thus, I  
would like a macro, let's say called \cleverref{}, that I use instead  
of \pageref{} that does the following:
  1.  If the label is on the same page as \cleverref{} itself, it  
      to 'at the top of this page'.
  2.  If the label is on the next page as \cleverref{} itself, it  
      to 'on the next page'.
  3.  Otherwise it expands to 'on page \pageref{}'.

Any ideas? Please cc me directly as well as responding to the list.

Geoff Vallis
--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>

More information about the macostex-archives mailing list