# [NTG-context] How to process a project residing in another directory

Marco netuse at lavabit.com
Mon Apr 16 11:12:05 CEST 2012

```On 2012-04-15 Helge Blischke <h.blischke at acm.org> 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.

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

```

More information about the ntg-context mailing list