Am 30.10.2012 um 17:24 schrieb John Devereux <j...@devereux.me.uk>:

> Marco Patzer <home...@lavabit.com> writes:
> 
>> 2012-10-30 John Devereux:
>> 
>>> What is the correct way to set or modify the search path for tex files?
>>> 
>>> I want to make it mode-dependent. For example, for figures I have
>>> something like
>>> 
>>> \doifmode{en} 
>>> {\def\FigDirLanguage{fig/lang_en}\def\DocumentSuffix{EN}\mainlanguage[en]}
>>> \doifmode{de} 
>>> {\def\FigDirLanguage{fig/lang_de}\def\DocumentSuffix{DE}\mainlanguage[de]}
>>> 
>>> [...]
>>> 
>>> \setupexternalfigures[directory={fig,{\FigDirLanguage},{../fig},{../\FigDirLanguage}}]
>>> 
>>> 
>>> I want to be able to do for example
>>> 
>>> \input disclaimer
>> 
>> You can either trigger on the language or on the mode. The directory
>> structure looks like this
>> 
>>    text/en/alpha.tex
>>    text/en/beta.tex
>>    text/de/alpha.tex
>>    text/de/beta.tex
>>    images/en
>>    images/de
>> 
>> You can create the individual files as components and create a
>> product file:
>> 
>>    \startproduct *
>> 
>>      \mainlanguage [de]
>>      \project [project]
>> 
>>      \component [a]
>>      \component [b]
>> 
>>    \stopproduct
>> 
>> and a project file:
>> 
>>    \startproject *
>> 
>>      \startmode [*en]
>>      \usepath
>>        [text/en]
>>      \setupexternalfigures
>>        [directory={images/en}]
>>      \stopmode
>> 
>>      \startmode [*de]
>>      \usepath
>>        [text/de]
>>      \setupexternalfigures
>>        [directory={images/de}]
>>      \stopmode
>> 
>>    \stopproject
>> 
>> To trigger by language, you use *en, *de, etc. To trigger by mode,
>> you use the mode name, in that case you can move the \mainlanguage
>> call to the corresponding language setup.
>> 
>> 
>> Marco
> 
> Hello Marco,
> 
> It looks like \usepath is the key to what I want, thank you. I don't
> quite understand your overall structure. Is the "*" a literal "*" with
> some special meaning, or are you using it as a placeholder for
> something? Sorry if I am being dense.
> 
> I am not using the project/product/component system, perhaps I should
> look into it again.

When you write a component file (assume it name is alpha.tex) you would begin 
the file with

  \startcomponent alpha

where \startcomponent takes the name of the current file as argument, the name 
of
the file is tired in the command \currentcomponent. In MkIV you can replace the 
name
with “*” and context would still print the correct name with \currentcomponent.


The asterisk in modes indicates that you use a system mode which created by 
system,
i.e. when you put \mainlanguage[en] in your document context enables the mode 
“*en”.

The opposite of this are user modes which are enable by the user itself with 
\enablemode[…].

> Hmmm, alpha.tex defines component "a", beta.tex defines "b", is that right?

No, that should be a typo because the command takes the name of the file as 
argument like \input but it doesn’t stop the processing when the file isn’t 
available.

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to