ref is not consistent with multiple files
Hi, I have encountered an issue with the autocompletion of ref and eqref.
suppose I have the following structure: sections/ | section1.tex | section2.tex main.tex
section1.tex
% !TEX root = ../main.tex
\begin{equation}
\label{eq:1}
a=b
\end{equation}
% place1
section2.tex
% !TEX root = ../main.tex
\begin{equation}
\label{eq:2}
a=b
\end{equation}
% place2
main.tex
\section{Section1}
\label{sec:section1}
\import{sections/}{section1.tex}
\section{Section2}
\label{sec:section2}
\import{sections/}{section2.tex}
% place3
in this layout: \ref{ at place1 and 2 just suggest the equations of their files, \ref{ at place3 suggests only the section labels.
Funny thing is: When changing % !TEX root = ../main.tex to %!TEX root = ../main.tex place1 and 2 suggestions are just the sections, without even the eq: from the own file.
I think this is supposed to be a bug. Expected behaviour from my side would be that the space on the latex magic comments does not matter and everything from all files is included.
I don't know how its handled internally, but you could just parse the aux file of the main.tex for the newlables. There should be the complete list. (Caveat: does not work live, only after compilation)
Thanks in advance, Flo
Edit: similar Issues: #11 , this would explaine the issue with the space if references are handled the same way, but I don't understand enough to explain the rest.
Edit2: Atom: 1.6.1 Latexer: 0.3.0
Thanks for the bug report.
The correct tex directive is %!TEX root = ../main.tex without the space, so the package is functioning properly with that.
The labels are found by reading the files that you have included and opened. There are two bugs here. One is that the \import is not implemented. The second is, like you mentioned, that somehow the eq:1 and eq:2 are being missed. This seems really weird.
Perhaps parsing the aux file might be a good idea. I will have to look into it. In the meantime, if you fancy having a crack, then feel free to submit a PR.
Hi,
I'm working with a document that has a similar directory structure but does not use import and I'm getting the same issue i.e. the labels from the section files are missing.
Instead of importing the sections in root directly, it uses sections/main.tex as an intermediate.
The directory structure looks like this:
sections/
| main.tex
| sec_1.tex
| sec_2.tex
root.tex
Now, since it uses the include and input commands, all paths are relative to the root file.
I've looked into latexer's code and it appears that my bug is caused by the labels finding code looking for \input/\include'ed files relative to the current file instead of the root file.
It would be nice to see support for subfile as well.