How to process a project residing in another directory
I try to process a ConTeXt project residing in a directory different from the current directory (where context is called), imagine e.g. a NFS mounted directory on a different host. I tried to point context to the project directory by specifying it by the command line option --path=absolute_path_to_the_directory but that did not work. Helge
On 2012-04-15 Helge Blischke
I try to process a ConTeXt project residing in a directory different from the current directory (where context is called), imagine e.g. a NFS mounted directory on a different host.
NFS is transparent to the applications and should work the same way as local directories.
I tried to point context to the project directory by specifying it by the command line option --path=absolute_path_to_the_directory but that did not work.
Works here. Example: % file: $HOME/some/dir/main.tex \startproduct main \component sec-first \stopproduct % file: $HOME/some/dir/chapters/sec-first.tex \startcomponent sec-first Foo Bar \stopcomponent % current directory: $HOME/otherdir % the following does not work context ../some/dir/main.tex % but this compiles successfully context --path=../some/dir/chapters ../some/dir/main.tex Another option is to use the \usepath and \usesubpath features. When you don't call from the directory where main.tex resides, you have to include the absolute or relative path in the \usepath argument. Example: % file: $HOME/some/dir/main.tex \startproduct main \usepath [% /home/me/some/dir/chapters,% /home/me/some/dir/environments,% %../some/dir/chapters,% %../some/dir/environments,% ] \component sec-first \stopproduct % file: $HOME/some/dir/chapters/sec-first.tex \startcomponent sec-first Foo Bar \stopcomponent % current directory: $HOME/otherdir % this works now context ../some/dir/main.tex When you call context from $HOME/some/dir, then the \usepath command simplifies to: \usepath [% chapters,% enviroments,% add all necessary directories ] Watch out the percent signs, they are essential. Question to the others: Why, in contrast to most other ConTeXt commands, is it necessary to escape the line endings in the \usepath call? Marco
On 15-4-2012 23:57, Helge Blischke wrote:
I try to process a ConTeXt project residing in a directory different from the current directory (where context is called), imagine e.g. a NFS mounted directory on a different host.
I tried to point context to the project directory by specifying it by the command line option --path=absolute_path_to_the_directory but that did not work.
mtxrun --path=... --script context ... ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Hans Hagen
On 15-4-2012 23:57, Helge Blischke wrote:
I try to process a ConTeXt project residing in a directory different from the current directory (where context is called), imagine e.g. a NFS mounted directory on a different host.
I tried to point context to the project directory by specifying it by the command line option --path=absolute_path_to_the_directory but that did not work.
mtxrun --path=... --script context ...
But what to do if the directory specified by the --path= option is not writeable for the user executing mtxrun? Helge
On 16-4-2012 15:00, Helge Blischke wrote:
Hans Hagen
writes: On 15-4-2012 23:57, Helge Blischke wrote:
I try to process a ConTeXt project residing in a directory different from the current directory (where context is called), imagine e.g. a NFS mounted directory on a different host.
I tried to point context to the project directory by specifying it by the command line option --path=absolute_path_to_the_directory but that did not work.
mtxrun --path=... --script context ...
But what to do if the directory specified by the --path= option is not writeable for the user executing mtxrun?
then put all the project files in <texroot>/texmf-project/tex/context/user, run mtxrun --generate, and run on a directory where the used can mess around Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Mon, 16 Apr 2012, Hans Hagen wrote:
On 16-4-2012 15:00, Helge Blischke wrote:
Hans Hagen
writes: On 15-4-2012 23:57, Helge Blischke wrote:
I try to process a ConTeXt project residing in a directory different from the current directory (where context is called), imagine e.g. a NFS mounted directory on a different host.
I tried to point context to the project directory by specifying it by the command line option --path=absolute_path_to_the_directory but that did not work.
mtxrun --path=... --script context ...
But what to do if the directory specified by the --path= option is not writeable for the user executing mtxrun?
then put all the project files in <texroot>/texmf-project/tex/context/user, run mtxrun --generate, and run on a directory where the used can mess around
Is there a tree, other than TEXMFHOME, which is scanned at runtime? (so that mtxrun --generate is not needed). For example, one can do the following: TEXMFHOME=path-to-project-files context filename But this overwrites the default value of TEXMFHOME. If the mtxrun --generate step were not needed, one could do the same with TEXMFPROJECT tree. Aditya
On 16-4-2012 19:28, Aditya Mahajan wrote:
But this overwrites the default value of TEXMFHOME. If the mtxrun --generate step were not needed, one could do the same with TEXMFPROJECT tree.
One can indeed use texmfhome which is checked at runtime (but a large one will take time of course esp on a network share). Here I always use texmf-project. Of course one can also use \usepath (or context --path=... which does the same). Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Hans Hagen
On 16-4-2012 19:28, Aditya Mahajan wrote:
But this overwrites the default value of TEXMFHOME. If the mtxrun --generate step were not needed, one could do the same with TEXMFPROJECT tree.
One can indeed use texmfhome which is checked at runtime (but a large one will take time of course esp on a network share).
Here I always use texmf-project.
Of course one can also use \usepath (or context --path=... which does the same).
Hans
By trial and eror I found out that context --path=... tries to run the scripts and programs within that directory which leads to abort if e.g. the calling user has no write permission there. On the other hand, inserting a \usepath[...] just after the \start... command functions as exspected. Thus, I'd propose to provide an additional option --usepath=... what does exactly that, which avoids editing the main.tex file. Helge
On Mon, 16 Apr 2012, Helge Blischke wrote:
By trial and eror I found out that context --path=... tries to run the scripts and programs within that directory which leads to abort if e.g. the calling user has no write permission there.
Can you summarize your results on the wiki?
On the other hand, inserting a \usepath[...] just after the \start... command functions as exspected.
Thus, I'd propose to provide an additional option --usepath=... what does exactly that, which avoids editing the main.tex file.
Easy to do on your own: \doifsomething{\env{usepath}} {\expanded{\usepath[\env{usepath}]}} and then call you tex file using context --arguments=usepath=/path/to/set filename Aditya
participants (4)
-
Aditya Mahajan
-
Hans Hagen
-
Helge Blischke
-
Marco