2

I am now using AUCTeX 11.89.1 on emacs. When I start a beamer class document, the label is not automatically added after using C-c C-s to start a new section. I have to use C-c C-( to add the label afterwards. If I use C-c C-e to insert some environment (e.g., equation), the label is added automatically.

This does not happen in the usual article class, in which labels are automatically added. I have the following in my .emacs file,

(setq reftex-plug-into-AUCTeX t)
(add-hook 'LaTeX-mode-hook 'reftex-mode)

Do I need anything else to make it work in beamer?

P.S., I always use C-u C-c C-n to make sure that the current documentclass is recognized first.

2
  • Does it help if you add (setq LaTeX-beamer-section-labels-flag t) to your .emacs and try it again? Commented Feb 4, 2016 at 19:13
  • @ArashEsbati It works! But why this different setting?
    – davyjones
    Commented Feb 5, 2016 at 3:37

1 Answer 1

1

Some AUCTeX styles can be customized, viz.:

  • amsmath.el
  • beamer.el
  • biblatex.el
  • comment.el
  • csquotes.el
  • emp.el
  • fontspec.el
  • graphicx.el

beamer.el usesLaTeX-beamer-section-labels-flag which defaults to nil:

LaTeX-beamer-section-labels-flag is a variable defined in ‘tex-style.el’.
Its value is nil

Documentation:
If non-nil section labels are added

If you set this variable to t, AUCTeX (or RefTeX) will ask you for a label when you insert a sectioning command with C-c C-s. You can set this variable in your .emacs with

(setq LaTeX-beamer-section-labels-flag t)

or use customize with M-x customize-group RET LaTeX-style RET.

The relevant code in beamer.el is:

(unless LaTeX-beamer-section-labels-flag
  (make-local-variable 'LaTeX-section-hook)
  (setq LaTeX-section-hook
    '(LaTeX-section-heading
      LaTeX-section-title
      LaTeX-section-section)))

where LaTeX-section-label is omitted.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .