Relative path issue
I have a file sheet2.tex with
\input{../_preamble.tex}
There, I have
\loadxsimstyle{ese-exercise}
The file ../xsim.style.ese-exercise.code.tex exists.
I get
! Package xsim Error: You've requested the xsim module `style.ese-exercise'
(xsim) but it appears to be missing on your system. Maybe
(xsim) you've misspelled the name? Loading the module will
(xsim) abort on line 67
I think, the search for the file should be relative to the .tex file where the style is loaded?
I think, the search for the file should be relative to the
.texfile where the style is loaded?
No, during a (La)TeX run, the default file path is constant and it's the path of the main (or root) tex file. See discussions here. Extra search paths can be given as
\makeatletter
\def\input@path{{..}}
\makeatother
or
\ExplSyntaxOn
\seq_push:Nn \l_file_search_path_seq { .. }
\ExplSyntaxOff
Package import adds support to dynamic search path, but it's unknown whether xsim and import are compatible or not.
With ../, the file is not found either:
! Package xsim Error: You've requested the xsim module `style.../ese-exercise'
(xsim) but it appears to be missing on your system. Maybe
(xsim) you've misspelled the name? Loading the module will
(xsim) abort on line 67
Type <return> to continue.
...
l.67 \loadxsimstyle{../ese-exercise}
Because \loadxsimstyle{../ese-exercise} doesn't extract the leading directory components (here ../) from its argument, but only uses the whole argument to construct a filename xsim.style.<style name>.code.tex.
you may be interested in my solution here. I use this for everything.
https://tex.stackexchange.com/questions/664749/is-it-possible-to-have-a-search-path-for-subfiles/755392#755392