Consider the following project structure

| -- part
|    | -- fileWithLabels.tex
|    | -- fileWithRefs.tex
| -- main.tex

Is it possible using Sublime Text 3 and LaTeXTools to achieve auto completion using references to labels in a different file that is not the main file, if the files are included using \import of the import package?

You easily find the solution of passing the main.tex to every file, like this

%!TEX root = ../main.tex

This works great, if I simply \input the files, but with \import only labels in the main.tex are offered by the drop-down menu of LaTeXTools, but not for example from the fileWithLabels.tex while editing the fileWithRefs.tex.

Abandoning import also seems not to be a good solution, because it is damn useful for nested structures that may be restructured in future (although already the %!TEX root = ... breaks this feature).

  • The import package is not supported by LaTeXTools (version 3.12.11). You can avoid the tex root comment by using project ans project settings – r-stein Dec 26 '16 at 22:56
  • @r-stein: Pity! Do you know whether it is planned in the future? Because import seems to me a very crucial package for large projects. Or is there a good alternative I missed? – marlam Dec 27 '16 at 10:02
  • LaTeXTools is moving to a centralized document analysis #611 and integrates it into the completion commands #956 instead of rewritting the simple document scan in each command. This offers more complex document structure commands as \import. Hence it is not directly planned, but will be easy and reasonable to add after that refactoring. Unfortunatly there is currently not a good alternative except implementing it on your own. – r-stein Dec 27 '16 at 12:11

Support of the import package is now on the plan #990 and will most likely be added in the next minor release (3.13.0).

Until then I made a branch (pkgimport_merge) on github, which merges the pull requests to support the import package. You can download that branch (ensure you have selected that branch) as zip, unpack it, and replace the LaTeXTools package in the SublimeText packages directory. You can access that directory in ST by selecting Preferences>Browse Packages... . If you are familiar with git, you can also directly clone it:

git clone https://github.com/r-stein/LaTeXTools.git -b pkgimport_merge

If you see an issue please let me know by adding a comment to the pull request.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.