2

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.

1
  • Can you say how the \keeppath answer is handled in auctex/reftex? That answer is more recent. Sep 12, 2020 at 7:09

2 Answers 2

1

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.

2
  • I suspect the comand name \keeppath is misleading, because it changes path! Maybe \followpath? Apr 15, 2020 at 4:24
  • I can't tell if your change works LaTeX-wise, but RefTeX understands the notation \followpath\input{foo/bar} -- it parses the file path and name given in the argument correctly to grab the \label's and offer them for completion. Jan 26, 2022 at 12:46
0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .