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

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

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}?

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.


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

% Output: chapter 1

% Output: page 42

% Output: “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]
    \startitem [item:second]

% Outputs: As in item 2.
As in \in{item}[item:second].

The usual way to create references in ConTeXt is:

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


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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