xsim icon indicating copy to clipboard operation
xsim copied to clipboard

Relative path issue

Open koppor opened this issue 9 months ago • 3 comments

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?

koppor avatar May 11 '25 15:05 koppor

I think, the search for the file should be relative to the .tex file 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.

muzimuzhi avatar May 11 '25 17:05 muzimuzhi

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}

koppor avatar May 11 '25 19:05 koppor

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.

muzimuzhi avatar May 11 '25 22:05 muzimuzhi

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

ptoche avatar Dec 23 '25 02:12 ptoche