Next: Options (Referencing Labels), Previous: Options (Defining Label Environments), Up: Options

### 8.3 Creating Labels

— User Option: reftex-insert-label-flags

> Flags governing label insertion. The value has the form

>               (derive prompt)

> If deriveis `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:

> nwords
>   Number of words to use.
> maxchar
>   Maximum number of characters in a label string.
> invalid
>   `nil`: Throw away any words containing characters invalid in labels.
>   `t`: Throw away only the invalid characters, not the whole word.
> abbrev
>   `nil`: Never abbreviate words.
>   `t`: Always abbreviate words (see `reftex-abbrev-parameters`).
>   `1`: Abbreviate words if necessary to shorten label string.
> separator
>   String separating different words in the label.
> ignorewords
>   List of words which should not be part of labels.
> downcase
>   `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.

> min-chars
>   Minimum number of characters remaining after abbreviation.
> min-kill
>   Minimum number of characters to remove when abbreviating words.
> before
>   Character class before abbrev point in word.
> after
>   Character class after abbrev point in word.