alexeyr / company-auctex Goto Github PK
View Code? Open in Web Editor NEWThis project forked from monsanto/auto-complete-auctex
company-mode autocompletion for auctex
This project forked from monsanto/auto-complete-auctex
company-mode autocompletion for auctex
In the LaTeX source file (|^|
is the cursor position), company-auctex
does not give me the \includegraphics
option, but M-TAB
gives me this option.
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\include|^|
\end{figure}
\end{document}
I reported this to at company-mode/company-mode#578 but apparently this is an issue with company-auctex. Basically, if company-minimum-prefix-length
is 2, typing \l
and then backspacing should show no completions (there's only one prefix letter). However, with the company-auctex backend enabled, it completes every latex command.
After further investigation, it turns out that this package simply ignores company-minimum-prefix-length
entirely. \l
is completed (no backspacing) even if company-minimum-prefix-length
is set to 3.
Hi, first of all thanks for this great backend for company-mode.
When writing a TeX file, I cannot auto-complete \textbf and \emph because they are not shown in the candidates list.
Is there a way to add them to the available candidates?
I know AUCTeX provides them via keybindings, so I completely understand if you don't plan to add them.
Debugger entered--Lisp error: (invalid-function TeX-auto-add-type)
TeX-auto-add-type("label" "LaTeX")
byte-code("\300\301\302\"\210\300\303\302\"\210\300\304\302\"\210\300\305\302\306#\210\300\307\302\310#\210\300\311\302\"\210\300\312\302\"\210\300\313\302\"\210\300\314\302\315#\207" [TeX-auto-add-type "label" "LaTeX" "bibitem" "environment" "bibliography" "bibliographies" "index-entry" "index-entries" "pagestyle" "counter" "length" "savebox" "saveboxes"] 4)
require(latex)
byte-code("\300\301!\210\300\302!\210\300\303!\210\300\304!\207" [require tex latex company yasnippet] 2)
(company-auctex-init)
(progn (prelude-require-packages (quote (company-auctex))) (company-auctex-init))
(lambda nil (progn (prelude-require-packages (quote (company-auctex))) (company-auctex-init)))()
funcall((lambda nil (progn (prelude-require-packages (quote (company-auctex))) (company-auctex-init))))
eval((funcall (quote (lambda nil (progn (prelude-require-packages (quote (company-auctex))) (company-auctex-init))))))
eval-after-load("company" (progn (prelude-require-packages (quote (company-auctex))) (company-auctex-init)))
byte-code("\306\307!\210\310\311!\210\310\312!\210\313\314\315\"\210\316\317\320\321\322\323\322\324\325\326\327\330&�\210\331\211��\332\333\334\"\210\331��\335=\2035�\336�\337�\334\207" [TeX-auto-save TeX-parse-self TeX-PDF-mode system-type TeX-view-program-selection TeX-view-program-list prelude-require-packages (auctex cdlatex) require smartparens-latex cl eval-after-load "company" (progn (prelude-require-packages (quote (company-auctex))) (company-auctex-init)) custom-declare-variable prelude-latex-fast-math-entry (quote LaTeX-math-mode) "Method used for fast math symbol entry in LaTeX." :link (function-link :tag "AUCTeX Math Mode" LaTeX-math-mode) (emacs-commentary-link :tag "CDLaTeX" "cdlatex.el") :group prelude :type (choice (const :tag "None" nil) (const :tag "AUCTeX Math Mode" LaTeX-math-mode) (const :tag "CDLaTeX" cdlatex)) t set-default TeX-master nil darwin ((output-dvi "DVI Viewer") (output-pdf "PDF Viewer") (output-html "HTML Viewer")) (("DVI Viewer" "open %o") ("PDF Viewer" "open %o") ("HTML Viewer" "open %o"))] 13)
require(prelude-latex)
eval-buffer(#<buffer *load*> nil "/home/abrahamx/.emacs.d/prelude-modules.el" nil t) ; Reading at buffer position 749
load-with-code-conversion("/home/abrahamx/.emacs.d/prelude-modules.el" "/home/abrahamx/.emacs.d/prelude-modules.el" nil nil)
load("/home/abrahamx/.emacs.d/prelude-modules.el")
byte-code("\306\307�\"\210\306\307 \"\210\306\307\n\"\210\310\n!\210\311�\312�\313
!\203+�\314\315
\"\210\316\317\320
\321\322#\"\210\314\323!\210\324\325!\210\324\326!\210\324\327!\210\324\330!\210\324\331!\210\324\332!\210\324\333!\210�'\334=\203V�\324\335!\210\314\336!\210\313�(!\203f�\317�(!\210\337\340�)\"�*\313�)!\203\204�\314\315�)\"\210\316\317\320�)\321\322#\"\210\314\341�+\"\210\342\343\344\345\346#!\207" [prelude-core-dir prelude-modules-dir prelude-vendor-dir gc-cons-threshold large-file-warning-threshold prelude-personal-preload-dir add-to-list load-path prelude-add-subfolders-to-load-path 50000000 100000000 file-exists-p message "Loading personal configuration files in %s..." mapc load directory-files t "^[^#].*el$" "Loading Prelude's core..." require prelude-packages prelude-ui prelude-custom prelude-core prelude-mode prelude-editor prelude-global-keybindings darwin prelude-osx "Loading Prelude's modules..." expand-file-name "custom.el" "Prelude is ready to do thy bidding, Master %s!" prelude-eval-after-init run-at-time 5 nil prelude-tip-of-the-day system-type prelude-modules-file prelude-personal-dir custom-file current-user] 6)
load("/home/abrahamx/.emacs.d/init" t t)
#[0 "�\205\262� \306=\203��\307�\310Q\202;� \311=\204��\307�\312Q\202;�\313\307\314\315#\203*�\316\202;�\313\307\314\317#\203:�\320\nB�\321\202;�\316\322�\323�\322\211#\210�\322=\203a�\324\325\326\307�\327Q!\"\323�\322\211#\210�\322=\203`���\210�\203\243�\330�!\331\232\203\243�\332�!\211\333P\334�!\203}�\211\202\210�\334�!\203\207��\202\210�\314\262��\203\241�\335��\"\203\237�\336\337��#\210\340\341!\210��\266�\f?\205\260�\314�\323\342\322\211#)\262�\207" [init-file-user system-type delayed-warnings-list user-init-file inhibit-default-init inhibit-startup-screen ms-dos "~" "/_emacs" windows-nt "/.emacs" directory-files nil "^\\.emacs\\(\\.elc?\\)?$" "~/.emacs" "^_emacs\\(\\.elc?\\)?$" (initialization "`_emacs' init file is deprecated, please use `.emacs'") "~/_emacs" t load expand-file-name "init" file-name-as-directory "/.emacs.d" file-name-extension "elc" file-name-sans-extension ".el" file-exists-p file-newer-than-file-p message "Warning: %s is newer than %s" sit-for 1 "default"] 7 "\n\n(fn)"]()
command-line()
normal-top-level()
Since the trace showed something about Company-AucTeX, I assume that it's the right place to complain.
When I disable the prelude-latex module, everything is fine. So I am sure (as can be seen by preview-bug-report) it has something to do with either this or TeX.el
itself, which seems to be impossible.
company-auctex hasn't seen a release on MELPA stable yet. Please consider releasing company-auctex on MELPA stable.
Completing an environment like align*
by typing begali
and moving down to the begalign*
entry and hitting enter will result in:
\begin{align*}
\end{align*}*
Notice the extra asterisk after the end tag. This gets rendered and shouldn't be there. This happens with all environments that end with a *.
If I type \Psi
and trigger completion, it gets completed to $\Psi$
. However, \(
is a valid alternative to $
. We should let the user choose to use one or the other.
This seems to be the line that would need to be changed: https://github.com/alexeyr/company-auctex/blob/master/company-auctex.el#L195
I get this error when trying to use company-auctex
. This is because cl
is not required at compile time, so the case
macros used in company-auctex
(e.g. here) are not compiled, leading to this error.
I don't seem to be getting completions for section/subsection etc. Is that expected?
To fix company-mode/company-mode#578 you should replace the definition of company-auctex-prefix
with this one:
(defun company-auctex-prefix (regexp)
"Returns the prefix for matching given REGEXP."
(and (derived-mode-p 'latex-mode)
(when (looking-back regexp)
(match-string-no-properties 1))))
Using company-auctex on Emacs 24.4 with MacTex, I tried to enter a usepackage declaration by typing \u
in the document header and Emacs immediately froze and would not respond to input. I
The echo buffer started flashing many times a second between two error messages, suggesting they were being generated in a loop very quickly. One of them was "An error occured in post-command", the other was something like this:
Front-end company-pseudo-tooltip error "Args out of range: 0,21" on command post-command
There may be a couple characters of error since I had to read it while it was flashing on and off many times a second and could not select it to copy-paste.
I can work around this by typing "\zsepackage{...}" and then replacing the z.
For a document containing several .tex files would be very handy to have them all parsed for \ref
completions. To begin with, one could manually point to .tex files to look for completions by analogy with company-bibtex.
Every time I git clone my configuration of Emacs into a new machine and start Emacs, there will be error message in Emacs:
error: Unable to activate package 'company-auctex'.
Required package 'auctex-11.87' is unavailable
I know I can fix this problem by package-install auctex
manually, but is there a way that I can check if activating company-auctex package failed and then install auctex automatically?
I've trying to use the following in my init.el:
(unless (package-installed-p 'auctex)
(package-install 'auctex))
But it doesn't work at all and keeps saying the same error message everytime I start my emacs.
So how to fix this problem?
If I enable this, prettify-symbols-mode not work.
config:
(use-package company-auctex
:ensure t
:after (auctex company)
:config (company-auctex-init))
GNU Emacs 26.3 (build 1, x86_64-apple-darwin19.4.0, Carbon Version 162 AppKit 1894.4) of 2020-03-27
I find that I often have to suffer typing some similar latex codes many times in different equations or the same equation. So it will be convenient that all the codes in the existed equations in the buffer could be used as the backend for autocompletion.
It seems to me that it should be the same technique used in the autocompletion for the plain text. That is,
As I tested, company-auctex
didn't list the codes in the existed equations. It will be great if
company-auctex
could have this feature.
It would be nice to be able to complete the argument list, even when the macro has already been typed completely.
\frac{}{}
.\frac
counts as completed and it is no longer possible to complete the argument list.AUCTeX support complete behind \begin{equ
to begin{equation
with keybinding [M-TAB]
.
company-auctex should support this too.
Autocompletion won't work for \cite{foo,ba_
this can be fixed by doing something like this:
(prefix (let ((prefixes (company-auctex-prefix "\\\\cite[^[{]*\\(?:\\[[^]]*\\]\\)?{\\([^}]*\\)\\=")))
(if prefixes
(last (split-string prefixes "," t))
nil)))
I have two questions: First, I would like to know if it would require much effort to remove the yasnippet dependency and second would it be possible to have something like company-quickhelp that shows detailed information about a completion candidate?
Yasnippet seems to be more geared towards coders, therefore I use yankpad. Having a second snippet package installed doesn't seem right. Something like a quickhelp would be helpful to anyone new to latex, like me.
I am using company-auctex at win10, and I found that each time I open emacs
and try to put some math symbols. The emacs will get stuck and wait for several seconds.
I think this is related to the annotation company-auctex-symbols used, and if I comment
;;(annotation (company-auctex-symbol-annotation arg))))
this line, the problem will be solved.
I was trying to add support for the \csname NAME\endcsname
construct, and obtain an invalid expansion.
\csname somemacro\endcsname
.Typing \csnam RET should expand to \csname macroname\endcsname
, with macroname
as a snippet placeholder.
Instead it expands to \csname{}{}{}
.
As far as I can tell from the company-auctex-arg-lookup-table
, the package may currently lack the infrastructure code for supporting TeX-arg-free
and TeX-arg-literal
directly.
loading this package as indicated takes too long to load. It should be possible to load the package in only LaTex-mode using LaTex-mode-hook
It seems company-auctex
currently does not support completing label names in LaTeX. I am not talking about LaTeX commands, but rather the labels within macros like \cite{a-seminal-paper}, \label{chap1:introduction}, etc. I think it would be extremely useful to add support for such an feature where labels such as chap1:introduction and a-seminal-paper would be completed.
ac-tex-ref
provides similar functionality.
Thank you for your work on company-auctex
.
Besides predefined macros, I have a .tex
file with lots of private macro definitions.
Would it be possible to use company-auctex
's macro-finding logic and plug it into company-dabbrev-code
to get auto-completion of private macros, too?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.