2

When inserting an equation with C-c C-e it prompts if a label is wanted, if the label is wanted it inserts \label{eq:1}. Is it possible to modify this prompt to allow me to enter the label name similar to when a figure element is added?

TL;DR, Any ideas on how to make the prompt to ask me what to put as the label after inserting an equation with C-c C-e.

0

1 Answer 1

2

This is controlled by reftex-insert-label-flags. Its default value is ("s" "sft") meaning that section labels are derived from headings, after confirmation, and figure and table labels are prompted for.

You can add an "e" to the last string to get a prompt for equations or you can use t (not in " " quotes) to be prompted for all labels. My standard setting is

("s" t)

meaning section labels are auto-generated, but require confirmation from me, and all other labels are prompted for, with their standard prefix provided.

See the documentation of RefTeX for further details.

4
  • Using (setq reftex-label-alist '("s" t)) gives me reftex-splice-symbols-into-list: Cannot treat symbol t in reftex-label-alist. After looking at the reftex documentation I have tried using (setq reftex-label-alist '(("eq" ?e "eq:" "~\\label{%s}" nil nil))) but this doesnt seem to work as expected. Any ideas? Commented Mar 29, 2018 at 14:46
  • Upon closer inspection I dont think reftex-label-alist is what I'm looking for. It seems to add behaviour to reftex-reference as apposed to modifying the behaviour of the LaTex-environment when equation is the input. Commented Mar 29, 2018 at 15:07
  • Sorry, I typed in the wrong variable. It is reftex-insert-label-flags, so either customize this or use (setq reftex-insert-label-flags '("s" t)) Commented Mar 29, 2018 at 16:16
  • Thank you! I've spent longer than I'd like to admit trying to figure this one out. Commented Mar 29, 2018 at 17:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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