Autocomplete bibtex in latex files does not work?


#1

Hi,
I am more or less new to Atom but feeling quit good till now. I am trying to setup Atom for writing latex so i installed the packages i need for it.

  • autocomplete-bibtex
  • language-latex
  • latex
  • pdf-view

Everything seem to work great and i even wrote my own snippets. But the bibtex is not working properly and i dont know whats wrong.

I set p autocom. -bibtex like this:

  latex: {}
  "autocomplete-bibtex":
    bibtex: [
      "D:\\Git_repo\\masterarbeit\\Masterarbeit Latex\\bib\\literatur.bib"
    ]
    resultTemplate: "\\cite{[key]}"

but it does not give me any suggestions on my bib which for example contains:

@book{fundamentals,
 author = {Elmasri, Ramez and Navathe, Sham},
 year = {2007},
 title = {Fundamentals of database systems},
 address = {Boston},
 edition = {5th ed.},
 publisher = {{Pearson Addison Wesley}},
 isbn = {032141506X}
}

but it doesnt complete me on @fundamental … or @Elmasri or anything else.

Moreover is it possible to extend the \cite template to something like this: \cite[S. $1] ([KEY]) ? Does/would this work as expected?

So what have i dont wrong? Is it the whitespace inside of the path? (well i tried a path without and it didnt change anything)


#2

@thomasjo, you’re our resident LaTeX person. Do you have any suggestions?


#3

If you need any further information let me know. Is simply included the whole folder including the bib. (guess that doesnt matter) and added everything as mentioned above. (Absolut path and so on…)


#4

You’re going to have to change the scope setting of autocomplete-bibtex to text.tex.latex, in other words

"autocomplete-bibtex":
  scope: "text.tex.latex"
  bibtex: [
    "D:\\Git_repo\\masterarbeit\\Masterarbeit Latex\\bib\\literatur.bib"
  ]
  resultTemplate: "\\cite{[key]}"

That should do the trick. If it doesn’t, you might have to twiddle ac+ fileBlacklist settings, but you shouldn’t have to.


#5
I already tried to add the scope and it did not change anything.

This is the whole config. Well scipped core.

  tabs: {}
  minimap: {}
  "keyboard-localization": {}
  "atom-ctags":
    autoBuildTagsWhenActive: true
  "autocomplete-plus": {}
  "autocomplete-clang": {}
  latex: {}
  "autocomplete-bibtex":
    bibtex: [
      "D:\\Git_repo\\masterarbeit\\Masterarbeit Latex\\bib\\literatur.bib"
    ]
    resultTemplate: "\\cite[S. $1]([KEY])"
    scope: "text.tex.latex"

#6

I’m not super-familiar with ac+, so you might actually have to prefix the scope with a period. Try changing the scope setting to .text.tex.latex.


#7

Also, open the Developer Console inside of Atom and look for errors. The autocomplete-bibtex package might not handle the space in your bibtex path properly.


#8

Thanks again. I tried the scope setting but it didn’t change anything. The Consol also does not show any errors. Moreover i tried changing the path to one without whitespaces which didn’t change it too.

I meight should move this to the github.


#9

Yeah, I don’t use the autocomplete-bibtex package myself, so I don’t really know what’s going wrong.
Try opening an issue at https://github.com/apcshields/autocomplete-bibtex with all the relevant info; OS, TeX distribution (I’m assuming MiKTeX), relevant parts of your config, etc.


#10

I will do this tomorrow. Still thanks alot for your help.