Next: , Previous: , Up: Options   [Contents][Index]

18.3 Creating Labels

User Option: reftex-insert-label-flags

Flags governing label insertion. The value has the form

(derive prompt)

If derive is t, RefTeX will try to derive a sensible label from context. A section label for example will be derived from the section heading. The conversion of the context to a valid label is governed by the specifications given in reftex-derive-label-parameters. If derive is nil, the default label will consist of the prefix and a unique number, like ‘eq:23’.

If prompt is t, the user will be prompted for a label string. When prompt is nil, the default label will be inserted without query.

So the combination of derive and prompt controls label insertion. Here is a table describing all four possibilities:

derive prompt action
nil    nil    Insert simple label, like ‘eq:22’ or ‘sec:13’. No query.
nil    t      Prompt for label.
t      nil    Derive a label from context and insert. No query.
t      t      Derive a label from context, prompt for confirmation.

Each flag may be set to t, nil, or a string of label type letters indicating the label types for which it should be true. Thus, the combination may be set differently for each label type. The default settings ‘"s"’ and ‘"sft"’ mean: Derive section labels from headings (with confirmation). Prompt for figure and table labels. Use simple labels without confirmation for everything else.

The available label types are: s (section), f (figure), t (table), i (item), e (equation), n (footnote), N (endnote) plus any definitions in reftex-label-alist.

Hook: reftex-format-label-function

If non-nil, should be a function which produces the string to insert as a label definition. The function will be called with two arguments, the label and the default-format (usually ‘\label{%s}’). It should return the string to insert into the buffer.

Hook: reftex-string-to-label-function

Function to turn an arbitrary string into a valid label. RefTeX’s default function uses the variable reftex-derive-label-parameters.

Hook: reftex-translate-to-ascii-function

Filter function which will process a context string before it is used to derive a label from it. The intended application is to convert ISO or Mule characters into something valid in labels. The default function reftex-latin1-to-ascii removes the accents from Latin-1 characters. X-Symbol (>=2.6) sets this variable to the much more general x-symbol-translate-to-ascii.

User Option: reftex-derive-label-parameters

Parameters for converting a string into a label. This variable is a list of the following items:


Number of words to use.


Maximum number of characters in a label string.


nil: Throw away any words containing characters invalid in labels.
t: Throw away only the invalid characters, not the whole word.


nil: Never abbreviate words.
t: Always abbreviate words (see reftex-abbrev-parameters).
1: Abbreviate words if necessary to shorten label string.


String separating different words in the label.


List of words which should not be part of labels.


t: Downcase words before putting them into the label.

User Option: reftex-label-illegal-re

Regexp matching characters not valid in labels.

User Option: reftex-abbrev-parameters

Parameters for abbreviation of words. A list of four parameters.


Minimum number of characters remaining after abbreviation.


Minimum number of characters to remove when abbreviating words.


Character class before abbrev point in word.


Character class after abbrev point in word.

Next: , Previous: , Up: Options   [Contents][Index]