Search code examples
latexsublimetext2bibtex

Latextools does not display cite keys if .tex file is in subfolder


The wonderful LatexTools plugin for Sublime Text 2 autocompletes references when using \cite. Everything works perfectly when the .bib filed is in the same folder as the .tex file, and the .tex file includes the \bibliography command.

Unfortunately, for my larger projects, I keep my chapter .tex files in a subfolder. The \bibliography command only appears once in the master .tex file, and the .bib file lives with the master .tex file.

Is there a way to "point" LatexTools to my bibliography for all of the sub .tex files which do not include the \bibliography command, so that I can get autocomplete working?


Solution

  • LatexTools searches for a root file that is specified in the subfile you are editing. When it finds such a file, it will look for bibliography related commands there and load the corresponding data. You provide the root file by placing the line

    %!TEX root = ../my_main_file.tex

    in the (first line of the) subfile.