ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* The `\somewhere`-macro
@ 2015-08-08 16:06 Norbert Melzer
  2015-08-27 22:14 ` Norbert Melzer
  0 siblings, 1 reply; 2+ messages in thread
From: Norbert Melzer @ 2015-08-08 16:06 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 1589 bytes --]

The wiki states on page
http://wiki.contextgarden.net/Latex_Packages#varioref that the macro
`\somewhere` can be used to get same behaviour as varioref gives in LaTeX:

> varioref
> Context provides similar functionality using \somewhere

Some more searching around made me find
http://wiki.contextgarden.net/Command/somewhere

There I can see, that I have to provide 2 text-arguments in curly braces
and the references name in squarebrackets.

So I did exactly that in an experiment.

\somewhere{Foo}{Bar}[foo:bar]

This does create a clickable “Foo” when the reference exists somewhere in
the document, independent off the fact that this reference is on the same
page or anywhere else.

When the reference does not exists, “foo:bar” is typeset.

I am using:

```plain
$ context --version

mtx-context     | ConTeXt Process Management 0.61
mtx-context     |
mtx-context     | main context file:
/usr/local/texlive/2015/texmf-dist/tex/context/base/context.mkiv
mtx-context     | current version: 2015.05.18 12:26
```

Example:

```tex
\setupinteraction[state=start]

\starttext
\startsection[title={Foo-Bar},reference={foo:bar}]
  Blubberblubb, \somewhere{Foo}{Bar}[foo:bar].

  \input knuth

  \input knuth

  \input knuth

  \input knuth

  \input knuth

  \input knuth

  \input knuth

  \input knuth

  \input knuth

  \input knuth

  \input knuth

  \somewhere{Foo}{Bar}[foo:bar].
\stopsection

\startsection[title={Bar},reference={bar:foo}]
  \somewhere{Foo}{Bar}[foo:bar].
\stopsection
\stoptext
```

[-- Attachment #1.2: Type: text/html, Size: 2443 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: The `\somewhere`-macro
  2015-08-08 16:06 The `\somewhere`-macro Norbert Melzer
@ 2015-08-27 22:14 ` Norbert Melzer
  0 siblings, 0 replies; 2+ messages in thread
From: Norbert Melzer @ 2015-08-27 22:14 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 1805 bytes --]

Repost...

Norbert Melzer <timmelzer@gmail.com> schrieb am Sa., 08.08.2015, 18:06:

> The wiki states on page
> http://wiki.contextgarden.net/Latex_Packages#varioref that the macro
> `\somewhere` can be used to get same behaviour as varioref gives in LaTeX:
>
> > varioref
> > Context provides similar functionality using \somewhere
>
> Some more searching around made me find
> http://wiki.contextgarden.net/Command/somewhere
>
> There I can see, that I have to provide 2 text-arguments in curly braces
> and the references name in squarebrackets.
>
> So I did exactly that in an experiment.
>
> \somewhere{Foo}{Bar}[foo:bar]
>
> This does create a clickable “Foo” when the reference exists somewhere in
> the document, independent off the fact that this reference is on the same
> page or anywhere else.
>
> When the reference does not exists, “foo:bar” is typeset.
>
> I am using:
>
> ```plain
> $ context --version
>
> mtx-context     | ConTeXt Process Management 0.61
> mtx-context     |
> mtx-context     | main context file:
> /usr/local/texlive/2015/texmf-dist/tex/context/base/context.mkiv
> mtx-context     | current version: 2015.05.18 12:26
> ```
>
> Example:
>
> ```tex
> \setupinteraction[state=start]
>
> \starttext
> \startsection[title={Foo-Bar},reference={foo:bar}]
>   Blubberblubb, \somewhere{Foo}{Bar}[foo:bar].
>
>   \input knuth
>
>   \input knuth
>
>   \input knuth
>
>   \input knuth
>
>   \input knuth
>
>   \input knuth
>
>   \input knuth
>
>   \input knuth
>
>   \input knuth
>
>   \input knuth
>
>   \input knuth
>
>   \somewhere{Foo}{Bar}[foo:bar].
> \stopsection
>
> \startsection[title={Bar},reference={bar:foo}]
>   \somewhere{Foo}{Bar}[foo:bar].
> \stopsection
> \stoptext
> ```
>
>

[-- Attachment #1.2: Type: text/html, Size: 2803 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-08-27 22:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-08 16:06 The `\somewhere`-macro Norbert Melzer
2015-08-27 22:14 ` Norbert Melzer

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).