ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Norbert Melzer <timmelzer@gmail.com>
To: "ntg-context@ntg.nl" <ntg-context@ntg.nl>
Subject: The `\somewhere`-macro
Date: Sat, 08 Aug 2015 16:06:31 +0000	[thread overview]
Message-ID: <CA+bCVssDm95HLDknLxY8+fKaSBr7HbvDU+s1qQZDbd-ry2ZvVQ@mail.gmail.com> (raw)


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

             reply	other threads:[~2015-08-08 16:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-08 16:06 Norbert Melzer [this message]
2015-08-27 22:14 ` Norbert Melzer

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=CA+bCVssDm95HLDknLxY8+fKaSBr7HbvDU+s1qQZDbd-ry2ZvVQ@mail.gmail.com \
    --to=timmelzer@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).