Hi Paul, > Hi Uwe, > Uwe Brauer <o...@mat.ucm.es> writes:
> It's because the command LaTeX-environment calls the function > LaTeX-environment-menu which not only calls LaTeX-insert-environment, > but also prompts for a label to add. The following hack should take > care of this: > (defun my-after-insert-environment-hook (new-env beg end) > "Hook to run after a LaTeX environment is modified." > (unless (equal last-command 'LaTeX-environment) > (when (equal new-env "equation") > (unless (save-excursion (goto-char beg) > (search-forward "\\label{" end t)) > (save-excursion > (goto-char beg) > (forward-line 1) > (open-line 1) > (reftex-label) > (LaTeX-indent-line)))) > (when (equal (substring new-env -1) "*") > (save-restriction > (narrow-to-region beg end) > (save-excursion > (goto-char (point-min)) > (LaTeX--strip-labels)))))) Thanks, but this is the code I am already using and which causes the insertion of the two labels. -- I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel I strongly condemn Putin's war of aggression against Ukraine. I support to deliver weapons to Ukraine's military. I support the EU and NATO membership of Ukraine.
smime.p7s
Description: S/MIME cryptographic signature