0

I want a double %% to start my comments in latex documents. I'have found two solutions suggested

;; solution 1
(add-hook 'latex-mode-hook  '(lambda() (setq comment-start "%% ")))

;; solution 2
(add-hook 'latex-mode-hook (lambda () (setq-local comment-add 0)))

but both don't work.

1 Answer 1

2

The Auctex LaTeX mode hook is LaTeX-mode-hook (note the capitalization). So try

(add-hook 'LaTeX-mode-hook  (lambda() (setq comment-start "%% ")))

Note also that lambda expressions are self-evaluating so you don't need to quote them in this context.

I am assuming you are using M-; to comment things, otherwise comment-start does not enter into the equation.

1
  • Thanks, brilliant this works. Apr 18, 2021 at 8:22

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.