reftex: Options - Creating Labels
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:
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.