I have tried to set the company-backend as described on their github page and did not end up with the sweet resulting pop-up completion, in ref as in their image

My image: missing popup

their image: Sweet auto completion

What am I doing wrong? My relevant configs are as follows

(defun require-package (package &optional min-version no-refresh)
  "Install given PACKAGE, optionally requiring MIN-VERSION.
     If NO-REFRESH is non-nil, the available package lists will not be
     re-downloaded in order to locate PACKAGE."
  (if (package-installed-p package min-version)
    (if (or (assoc package package-archive-contents) no-refresh)
    (package-install package)
    (require-package package min-version t)))))

(require-package 'company)
(add-hook 'after-init-hook 'global-company-mode)
(eval-after-load "company"
(setq company-dabbrev-downcase 0)
(setq company-idle-delay 0)

(require-package 'company-reftex)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
(add-hook 'latex-mode-hook 'turn-on-reftex)   ; with Emacs latex mode
(setq reftex-plug-into-AUCTeX t)


  • Do you get to see labels in your company popup? Or is the issue that the help strings on the right-hand side are not complete? Your snippet is missing company-backends and company-math is misspelled. Is it a typo in your post? Commented Oct 8, 2020 at 15:05
  • @SwarnenduBiswas - company-backends was there. I have corrected company-math and added an image of the non-expanding/missing pop-up. Commented Oct 8, 2020 at 15:17
  • I get the popups, but admittedly not as nice as the reference image. I will post my recipe in some time. Did you try loading company-reftex before modifying company-backends? Commented Oct 8, 2020 at 15:41
  • Cool - I actually haven't checked by removing the backends. I'll do that as well later. Commented Oct 8, 2020 at 16:15

1 Answer 1


The following snippet works for me. I use use-package, so it is slightly different, but I hope it is easy enough to edit. You can evaluate this with emacs -q and then calling M-x eval-buffer on the snippet.

(require 'package)
(setq package-user-dir (expand-file-name "~/.emacs.d/elpa/")
      package-enable-at-startup nil)
(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/") t)

(unless (package-installed-p 'use-package)
  (package-install 'use-package))
  (require 'use-package))

(defcustom dotemacs-extras-directory (expand-file-name "extras"
  "Path for third-party packages and files."
  :type 'string
  :group 'dotemacs)

;; Enable Company
(use-package company
  :ensure t
  (company-idle-delay 0.0 "Recommended by lsp")
  (company-ispell-available t)
  (company-ispell-dictionary (expand-file-name "wordlist"
  :config (global-company-mode 1))

;; Enable LaTeX
(use-package tex-site
  :ensure auctex
  :mode ("\\.tex\\'" . LaTeX-mode))

(add-hook 'LaTeX-mode-hook #'reftex-mode)
(add-hook 'latex-mode-hook #'reftex-mode)

(defun sb/company-latex-mode ()
  "Add backends for latex completion in company mode."
  (use-package math-symbol-lists ; Required by ac-math and company-math
    :ensure t)
  (use-package company-math
    :ensure t)
  (use-package company-reftex
    :ensure t)
  (use-package company-bibtex
    :ensure t)
  (make-local-variable 'company-backends)
  (setq company-backends
           ;; company-tabnine
(dolist (hook '(latex-mode-hook LaTeX-mode-hook))
  (add-hook hook #'sb/company-latex-mode))

Both company-bibtex and company-reftex work. You can check the completion provider on the modeline or through M-x company-diag. The downside is that all the completions are merged, I do not know how to fix it. You can see this issue.

  • Could you please add an image of how this looks on your end. This is a partial solution, but not exactly what is being showcased on RefTex' site. Commented Oct 9, 2020 at 11:26
  • I figured it out. Apparently I've been using add-to-list wrong. If you just add use-package company-reftexto your solution I can flag it as the solution Commented Oct 9, 2020 at 12:09
  • Great. I have included use-package company-reftex. Commented Oct 9, 2020 at 12:54
  • 1
    @SwarnenduBiswas I was able to evaluate the snippet without any issues, but still am having the problem that OP mentioned. If I type \ref{ in a latex file, I see these messages: Compiling label environment definitions...done Compiling label environment definitions...done ref: info not available, use ‘C-c &’ to get it." If I do M-x c-r-l after \ref{, I do see the menu with all the labels, but it is not being called automatically for some reason. Any ideas what could cause this?
    – ttb
    Commented Feb 7, 2021 at 2:42

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.