Aerijo / autocomplete-latex

A LaTeX autocomplete provider for Atom
MIT License
10 stars 2 forks source link

autocomplete of citation commands #4

Closed werunom closed 6 years ago

werunom commented 6 years ago

Nice package! Especially since it is lighter than other packages.

The autocomplete for citation commands does not include [] for page numbers. For instance, the autocomplete for \autocite just provides \autocite{}. It would be better if it is \autocite[]{}.

PS - Hope you dont mind me raising successive issues :)

Aerijo commented 6 years ago

Thanks for being the first to raise an issue! This package feels authentic now :) Feel free to raise as many issues as you can find.

Regarding the completions, they are still very much subject to change. Bearing that in mind, I'm not sure what you mean about page numbers here. The biblatex manual p.98 says that the autocite command takes the following form:

\autocite[<prenote>][<postnote>]{<key>}

Page 94 explains that <prenote> means text that prepends the reference (similar story with postnote). I personally have never used these, so that's why they weren't there in the defaults.

On this end, I will try placing the cursor like so when it expands ($n means the nth position):

\autocomplete$2{$1}$3

This would require an extra tab press by anyone who doesn't want options, but that shouldn't be too bad. If people complain, I may revert this in the future.

On your end (at least until the next release), you could define an autocite completion yourself that does what you expect.

Also, this kind of issue is why I try to focus on customisability, so that preferences like these can be accommodated. If you still have default completions turned on, both will appear but your custom one (should be) on top. It would require a fundamental change in the way I structure completions to prevent duplicates, so <- I stopped typing here and fixed the problem. Fingers crossed it won't introduce a significant performance hit.

werunom commented 6 years ago

Thanks for your reply.

cite commands (like \cite, \autocite, \parencite, etc.) have the structure you mentioned where you pass the page-number as the postnote parameter. So, if I give \autocite[93]{matilal1989}, then I would get the citation as (Matilal 1989, 93). Now, since most of the times, citations will have page numbers, the postnote parameter is often used.

In any case, thought of suggesting this. Of course, since others might have other requirements and preferences, modifying this at my side is also a possibility.

Aerijo commented 6 years ago

Proposed change made in latest release