Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am trying to create a simple cross-reference from one page to another, e.g., in part of the document, it says, "see bears, p. 3." From the ConTeXt manual, p. 170, I was able to determine that a method for this is with \reference, in the place which is referenced to, and \at, in the place where the text refers to the place.

When I use \reference in my document, it is giving me an extra space, e.g.:

\starttext
    \section{This is a section}
        \reference[1]{This is a reference}
        This is some text.
    \section{This is another section}
        This is some more text.
\stoptext

This displays as:

1 This is a section

This is some text.

2 This is another section
This is some more text.

Notice, there is an added space between the first section and the text, while this extra space is not there.

  • Am I creating references properly? Why are there so many different commands in the manual, but all seem to do the same thing, e.g. \ref, \at, \in, etc.?
  • Why is \reference creating an extra space? How can I remove this extra space?
  • Why do I need to place some text inside curly braces in \reference[]{Some text here}?
share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

This is explained in the manual chapter 12.5 - Cross references

The command \in provides the number of a chapter, section, figure, table, etc. The command \at produces a pagenumber and \about produces a complete title. In the first two calls, the second argument is optional, and when given, is put after the number or title.

Example:

\startchapter [title=foo, reference=sec:foo]
\stopchapter

% Output: chapter 1
\in{chapter}[sec:foo]

% Output: page 42
\at{page}[sec:foo]

% Output: “Foo”
\about[sec:foo]

Note: \in and \at take optional arguments in braces, \about does not.

You can also refer to items in itemize lists:

\startitemize [n]
    \startitem [item:first]
        First
    \stopitem
    \startitem [item:second]
        Second
    \stopitem
\stopitemize

% Outputs: As in item 2.
As in \in{item}[item:second].
share|improve this answer
add comment

The usual way to create references in ConTeXt is:

\startsection[title={This is a section}, reference=sec:one]
....
\stopsection

or

\section[sec:one]{This is a section}

Although \reference is similar to LaTeX's \label, yet unlike LaTeX, you almost never use a manual \reference in ConTeXt. All commands provide some means of specifying a reference.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.