Command/goto
\goto
Syntax
| \goto{...}{...}[ref,ref,...] | |
| {...} | text |
| {...} | text |
| [ref,ref,...] | |
Description
This command creates a clickable link (or just normal text when interaction is not enabled).
You should not normally have to use this command. Links are better made using \in or \at, which are more conceptual (and lookup the section or page number as well).
If you want to implement some custom command for building links, this command is useful. You might also want to use the \ref command for getting the raw page number, section number, section title, etc.
The goto command takes two arguments, the first in curly braces is the text, the second in square braces is the label to link to. The second curly braces text shown above doesn't exist (it's probably there because of the way \goto allows for spaces between the arguments...).
Example
\reference[label:1]{Some text} \page[yes] % Insert page break Link to \goto{some text}[label:1].
Use with files
General
By enclosing \goto’s destination in program(#1) you have some means of launching files or programs. However, PDF readers seem to handle this inconsistently. The following test.tex will attempt to open itself. Notice that per default PDF readers stay in the current working directory.
\starttext \goto{A file}[program(test.tex)]\par % case 1: destination specified \goto{A command}[program(/usr/bin/kwrite test.tex)]\par % case 2: program and destination specified \stoptext
Behavioural study of PDF viewers
This comparison was made on Linux/x86. YMMV.
| reader | version | behaviour |
|---|---|---|
| acroread | 9.2 | Case 1 succeeds. Runs the associated mime type application on the argument.
Case 2 results in a file error. |
| okular | 0.11.2 | Case 1 succeeds. Runs the associated mime type application on the argument.
Case 2 fails. Note that calling an executable (without the file argument) will be prevented by Okular for safety reasons. |
| xpdf | 3.02 | Case 1 fails.
Case 2 succeeds: Xpdf allows execution of arbitrary commands in a shell with user privileges. |
| Google Docs | as of 2010-10-24 | Case 1 fails.
Case 2 fails. |
| mupdf | 7.2 | Case 1 fails.
Case 2 fails. |
See also
Help from ConTeXt-Mailinglist/Forum
All issues with: