How does one get items in subdirectories or change the path that ConTeXt uses to get components, environments, and project files?
In other words, how might one set up a hypothetical directory structure like this:
garden/
project.tex
env/env.tex
components/X.tex
components/Y.tex
products/X.tex
products/B.tex
So that in products/X.tex one could load \component components/X (or \component{components/x.tex} or some working variant of those) to load the respective component. This does not seem to work, and ConTeXt logs system > jobfiles > unknown tex file 'components/X'.
Section 2.4 of the ConTeXt the manual states:
A file that is not available on the working directory is searched for on the parent directories.
Though that said, I note that when I use e.g. header.tex, put it in the garden/ directory, and reference it from a product, the actual header.tex that gets loaded is /usr/local/texlive/2014/texmf-dist/doc/latex/epslatex-fr/header.tex.
What am I missing here?
I am using ConTeXt 0.60 (2014.05.21 22:04) from MacTeX, and running context with context x.tex.
Edit
For what it's worth, the error seems to be from file-job.lua#L169, calling commands.uselibrary, and eventually (presumably) getting to file-res.lua#L29::readfilename, which ought to be doing the resolution.
Also, noting the Project Structure page of the Context Garden Wiki and Context Magazine 1101, which indicates that subpaths are permitted.
Also, when I run \enabletrackers[resolvers.readfile] I note the following is sent to the logs:
files > readfile > not found by backtracking: ../type-imp-loc.mkiv
files > readfile > not found by backtracking: ../../type-imp-loc.mkiv
files > readfile > not found by tree lookup: type-imp-loc.mkiv
files > readfile > not found by backtracking: ../type-imp-loc.tex
files > readfile > not found by backtracking: ../../type-imp-loc.tex
files > readfile > not found by tree lookup: type-imp-loc.tex
files > readfile > not found by backtracking: ../type-loc.mkiv
files > readfile > not found by backtracking: ../../type-loc.mkiv
files > readfile > not found by tree lookup: type-loc.mkiv
files > readfile > not found by backtracking: ../type-loc.tex
files > readfile > not found by backtracking: ../../type-loc.tex
files > readfile > not found by tree lookup: type-loc.tex
fonts > 'fallback modern-designsize rm 12pt' is loaded
system > jobfiles > unknown tex file 'components/X'
system > jobfiles > unknown tex file 'components/Y'
and with \enabletrackers[context.trace]:
cld > tex > f : 8 : \starttext
cld > tex > w : - : \processfilemany{components/header.tex}
cld > tex > f : 8 : \stoptext
cld > tex > w : - : \dostarttextfile{components/header}
system > jobfiles > unknown tex file 'components/header'
cld > tex > f : 8 : \dostoptextfile
The products/X.tex is:
\startproduct X
\component components/X
\endproduct
And components/X.tex:
\startcomponent X
\component components/X
\endcomponent
(I have intentionally chosen the ambiguous X for both product and component since I expect to have this conflict at some point and would rather know sooner rather than later the implications.)
So it would seem that \component is not calling the readfile resolver mechanism for some reason.
\usepath[...]and\usesubpath[...]to set the subdirectories which context should use to search for your project files. Even when you place your files in subdirectories you have to use unique names because when you multiple files with the same only one of them is used.\usepath[products,components]) as argument and you load the files in these folders with\component X(or\component[X]when you prefer this form).gardendirectory usingcontext products/X. Note that this will create the auxiliary files in thegardendirectory.\usepath[.., ../..]enables discrimination by subpath i.e.\component components/Xwill not retrieveproducts/X. Whereas\usepath[..] \usesubpath[components,products]with\component Xis ambiguous —— TeX might end up using either the products/X or components/X.