
On 18 Feb 2025, at 10:13, denismaier@mailbox.org wrote:
-----Ursprüngliche Nachricht----- Von: Bruce Horrocks
Gesendet: Dienstag, 18. Februar 2025 01:00 An: ntg-context mailing list Betreff: [NTG-context] Re: Are paths resolved relative to file location or calling location? On 17 Feb 2025, at 14:42, denis.maier@unibe.ch wrote:
Hi, I have a (simplified) project structure like this: root-folder /asset /tex /results /source My tex file is stored under assets, the source is an xml file under source, the pdf should be saved under results. If I call context from within the assets folder, the pdf is created as expected, but if I call context from the results folder, I get an error message saying that the xml file is not found. As the file is created properly when I call context from the assets folder, I assume context performs lookups based on the calling location (not the file location). Is that correct? Is there a simple way to call context from the results folder and still have the sources found, or do I have to call context from the assets folder and copy/move the result afterwards? Best, Denis
I have something similar where I want to be able to either create an entire magazine from the root level or just an individual article (to send to the author for proofing) from the articles sub-directory. I spent ages looking into the project structure and eventually realised that the simple solution was to put two \usepath statements into my project.tex file. :-)
So I have:
\usepath [environments,articles] \usepath [../environments,../articles]
For you that might translate to:
\usepath [asset,asset/tex,results,source] \usepath [../asset,../asset/tex,../results,../source]
which should work from root and one level down but probably not from two levels down i.e. not from within ./asset/tex. For that you might need a third \usepath with ../../asset etc.
Thanks, Bruce. That looks promising. And when \inputing the files, do you just do \input{file.tex} or \input{dir/file.tex}. With usepath, specifying the directory shouldn't be necessary anymore, right?
I very rarely use \input. At the magazine level the individual articles are pulled in using \component[filename.tex]. Sometimes, within an article, there might need to be a \input to bring in some extra material, and I just specify the file name, without any directory part, which seems to work both for setting the whole magazine or a single article, but I've not experimented to see what the limits are. Regards, — Bruce Horrocks Hampshire, UK