I've installed the company package in order to get an auto-completion functionality. It works well in my ESS environment, but no in latex. In fact, no completions are showed in latex buffers when I activate M-x company-mode. What could be the problem?

Here it is my .emacs config for latex

(setq TeX-parse-self t)
(setq-default TeX-master nil)

;;ispell config
(setq ispell-program-name "hunspell")
(setq ispell-local-dictionary "es_ES") ;; Change dictionaries here!
(setq ispell-local-dictionary-alist
      '(("es_ES" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil nil nil utf-8)))

(add-hook 'LaTeX-mode-hook 'visual-line-mode)
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
(add-hook 'LaTeX-mode-hook 'TeX-source-correlate-mode)

(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)
(setq TeX-PDF-mode t)

(setq TeX-output-view-style
     (("^pdf$" "." "evince -f %o")
      ("^html?$" "." "iceweasel %o"))))


Removing auto complete configuration for other environments from the init file and adding the following line solves the problem.


(use-package company
  :ensure t
  (setq company-idle-delay 0)
  (setq company-minimum-prefix-length 2)

  (global-company-mode t)
  • Do you have any company completion backend for LaTeX installed?. You will can use either company-auctex or company-math for the completions to work. See Here company-auctex or here company-math. – minibuffer Sep 16 '19 at 16:52
  • Just curious: Why don't you use the completion offered by AUCTeX itself? Try C-c C-m (or C-c RET) for macros and C-c C-e for environments? With (setq TeX-parse-self t) in your init file, you get completion support for packages you use as well (packages supported by AUCTeX). – Arash Esbati Sep 18 '19 at 6:38

As an alternative, if you use lsp-mode (https://github.com/emacs-lsp/lsp-mode), there is recent support for LaTeX via the Digestif LaTeX language server (https://github.com/astoff/digestif).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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