# AUCTeX/RefTeX with import package in emacs, known problem from 2013 but is there a fix now?

I realized this issue with import in AUCTeX/RefTeX mode today which was also mentioned in the below thread from some years ago:

AUCTeX/RefTeX, the import package and cross reference

RefTeX apparently can not resolve the nice equation/section labels as a list to select from after a C-c-) if I would like to refer to these labels, which is extremely handy.

Since it has been some time now, I was wondering if this issue was solved with RefTeX or not.

• Can you say how the \keeppath answer is handled in auctex/reftex? That answer is more recent. – Donald Arseneau Sep 12 '20 at 7:09

I'm afraid the situation hasn't changed since then.

I suspect the editor recognition of file names used for \subimport is hopeless, because the leading portion of the path is implicit. Some different input syntax for \import and \includefrom might allow the editor to recognize files.

\makeatletter
\newcommand\keeppath[2]{% #1=\input or \include. #2=file path and name
\begingroup
\ifx\input#1\relax \def\7{\noexpand\import}\else
\ifx\include#1\relax \def\7{\noexpand\includefrom}\else
\def\7{\noexpand#1}\fi\fi % probably should be error
\filename@parse{#2}% get \filename@area, \filename@base, \filename@ext
\edef\8{\7{\filename@area}{\filename@base %
\ifx\relax\filename@ext\else .\filename@ext\fi}}%
\expandafter\endgroup\8}


Then use \keeppath\input{foo/bar} instead of \import{foo/}{bar} and use \keeppath\include{foo/bar} instead of \includefrom{foo/}{bar}.

Maybe I should add this alternate syntax to import.sty. Test it well, and if it is good, I will add it.

• I suspect the comand name \keeppath is misleading, because it changes path! Maybe \followpath? – Donald Arseneau Apr 15 '20 at 4:24