Nested structure of files loaded by input
![](https://secure.gravatar.com/avatar/413d18d786a923120159c1e3f02ad778.jpg?s=120&d=mm&r=g)
Hi, I have file main.tex that loads various subfiles that are placed in a subdir : \starttext \input subdir/chapter1 \stoptext Chapter1.tex itself loads some other files that are also placed in the subdir directory : \starttext \input subfile1 \stoptext Subfile1 : \starttext Asdf \stopttext Now, when in the subdir `context chapter1` and `context subfile1` both work. But in the main directory this here fails : context main -> < input file 'subfile1' is not found, quitting' What am I missing ? Does \input resolve filenames according to the CWD, not to the location itself is located ? How can I make that work? Best, Denis
![](https://secure.gravatar.com/avatar/413d18d786a923120159c1e3f02ad778.jpg?s=120&d=mm&r=g)
Ok, I can make it work with \doiffileexistselse
But is there a more elegant way ?
Von: ntg-context
![](https://secure.gravatar.com/avatar/e5aa6984b53b8925e405ebbdbc051ad9.jpg?s=120&d=mm&r=g)
Am 30.03.2021 um 09:43 schrieb denis.maier@ub.unibe.ch: What am I missing ? Does \input resolve filenames according to the CWD, not to the location itself is located ?
Nothing. You need to decide from where you want to run your files. BTW I’d strongly suggest to use the project structure (environment, products, components) in such cases, but that doesn’t change this. Hraban
![](https://secure.gravatar.com/avatar/413d18d786a923120159c1e3f02ad778.jpg?s=120&d=mm&r=g)
-----Ursprüngliche Nachricht----- Von: ntg-context
Im Auftrag von Henning Hraban Ramm Gesendet: Dienstag, 30. März 2021 10:14 An: mailing list for ConTeXt users Betreff: Re: [NTG-context] Nested structure of files loaded by input Am 30.03.2021 um 09:43 schrieb denis.maier@ub.unibe.ch: What am I missing ? Does \input resolve filenames according to the CWD, not to the location itself is located ?
Nothing. You need to decide from where you want to run your files.
Ok, thank you.
BTW I’d strongly suggest to use the project structure (environment, products, components) in such cases, but that doesn’t change this.
I use environments, but in that particular case there's no need for products and components. (OTOH, with components I probably wouldn't have noticed that things go off the rails here as \component doesn't complain about missing files...) Denis
![](https://secure.gravatar.com/avatar/e5aa6984b53b8925e405ebbdbc051ad9.jpg?s=120&d=mm&r=g)
Am 30.03.2021 um 10:23 schrieb
: BTW I’d strongly suggest to use the project structure (environment, products, components) in such cases, but that doesn’t change this.
I use environments, but in that particular case there's no need for products and components. (OTOH, with components I probably wouldn't have noticed that things go off the rails here as \component doesn't complain about missing files...)
You’re right, that’s a common trap. Got me recently when I typeset a novel and missed one chapter (component) because the filename had a typo that I didn’t copy to the product... Hraban
![](https://secure.gravatar.com/avatar/74d41c3215dcdd377343cdc47311757c.jpg?s=120&d=mm&r=g)
Hi,
I have file main.tex that loads various subfiles that are placed in a subdir :
\starttext
\input subdir/chapter1
\stoptext
Chapter1.tex itself loads some other files that are also placed in the subdir directory :
\starttext
\input subfile1
\stoptext
Subfile1 :
\starttext
Asdf
\stopttext
Now, when in the subdir `context chapter1` and `context subfile1` both work. But in the main directory this here fails : context main
-> « input file ‘subfile1’ is not found, quitting’
What am I missing ? Does \input resolve filenames according to the CWD, not to the location itself is located ?
How can I make that work?
\usepath[subdir] Wolfgang
participants (3)
-
denis.maier@ub.unibe.ch
-
Henning Hraban Ramm
-
Wolfgang Schuster