vspinu / company-math

Completion back-ends for for math unicode symbols and latex tags
124 stars 8 forks source link

Comparison with company-auctex #9

Closed SimonBoulier closed 7 years ago

SimonBoulier commented 8 years ago

Hi. How does company-math compares with company-auctex? Can we use both at the same time? Thank you!

vspinu commented 8 years ago

company-math provides comprehensive completion for math symbols. It relies on math-symbol-lists and provides unicode symbol insertion. Even its basic (LaTeX only) math symbol list is more comprehensive than that of AucTeX.

Besides math symbols company-math provides a backend for latex commands (company-latex-commands) but that's not the main feature. I am not familiar with company-auctex but I would guess it has a better support for latex commands and environments because it relies on dynamic auctex completions. So my suggestion would be to use company-math-symbols-latex or company-math-symbols-unicode for mathematical symbols completion and company-auctex for everything else.

You should be able to use both company-math and company-backends together in a group backend. See how company-auctex does it and company-math instalation instructions.

@alexeyr might have something to add to this.

vspinu commented 8 years ago

So for example you might try the following grouped backend:

'(company-math-symbols-latex company-auctex-macros company-auctex-environments)
SimonBoulier commented 8 years ago

Thank you very much. I realized that I didn't succeed in installing correctly company-math.

Here is an extract of my .emacs:

(require 'company) (add-hook 'after-init-hook 'global-company-mode) (setq company-idle-delay 0.3) (add-to-list 'company-backends 'company-math-symbols-unicode) (defun my-latex-mode-setup () (setq-local company-backends (append '((company-math-symbols-latex company-latex-commands)) company-backends))) (add-hook 'LaTex-mode-hook 'my-latex-mode-setup)

After that only company-math-symbols-unicode appears in the list company-backends, but not the grouped (company-math-symbols-latex company-latex-commands). LaTex-mode-hook seems ok as some other modes are activated by it. Any idea what is wrong?

vspinu commented 8 years ago

You misspelled your hook. It should be LaTeX-mode-hook.

SimonBoulier commented 8 years ago

Ouch! Sorry for being so distracted. Correcting the hook doesn't load company-math-symbols-unicode. It works if I group the three in the hook. Is it the standard way to go? If so, we could clarify activation instructions... Thanks again in any case.