SublimeText / LaTeXTools

LaTeX plugin for Sublime Text
https://latextools.readthedocs.io/
2.01k stars 364 forks source link

No \cref or \cite autocompletion when using \embedinput #1412

Closed thosgood closed 5 years ago

thosgood commented 5 years ago

Not sure what details are needed, but basically as the title says: if you use \embedinput instead of \input (to embed the tex source code into the pdf) then \cref only works locally (i.e. for references within the open file) and \cite doesn't work at all ("no bib entries found").

r-stein commented 5 years ago

The \embedinput is not supported and therefore the analysis does not work correctly. In such cases a workarround is to use the comment package and use the \input command in such a comment environment.

Aside from that it looks like you did not correctly setup a multiple documents project: https://latextools.readthedocs.io/en/latest/features/#multi-file-documents

thosgood commented 5 years ago

I have %!TEX root = ../main.tex all working fine, so I'm not too sure what you mean about not correctly setting up the multiple documents. The workaround by using the comment package is great though, thank you! How hard would it be to support \embedinput? I don't know how the \cite and \cref autocompletion works, but would it be as 'simple' a fix as just 'telling them' to scan the contents of any file included via an \embedinput?

r-stein commented 5 years ago

Yes, to add it to cite and ref completions you can just add it to this list: https://github.com/SublimeText/LaTeXTools/blob/st3-4.0.0-alpha.8/latextools_utils/analysis.py#L84

You can manually edit that file by opening Preferences > Browse Packages and then navigate into the LaTeXTools folder. You will need to restart Sublime Text for that changes to have an effect.