Hi, 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 And have it use the correct version. (There are more complicated scenarios too). In case there is a better way to do it, what I want is to have language- or mode- specific versions of some "boilerplate" texts. These would be in individual files. Documents elsewhere in a directory tree could reference these using a standard name and it would be picked according to the set language/mode. Thanks, John -- John Devereux
Am 30.10.2012 um 15:31 schrieb John Devereux
Hi,
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}}]
Figures: \startmodeset [en] {\setupexternalfigures[directory={fig,fig/lang_en}]} [de] {\setupexternalfigures[directory={fig,fig/lang_de}]} [default]{\setupexternalfigures[directory={fig}]} \stopmodeset Language: \startmodeset [en]{\mainlanguage[en]} [de]{\mainlanguage[de]} \stopmodeset Suffix: \define\DocumentSuffix {\doifmodeelse{en}{EN}{\doifmode{de}{DE}}} or \startmodeset [en] {\defineexpandable\DocumentSuffix{EN}} [de] {\defineexpandable\DocumentSuffix{DE}} [default]{\defineexpandable\DocumentSuffix{EN}} \stopmodeset Wolfgang
Wolfgang Schuster
Am 30.10.2012 um 15:31 schrieb John Devereux
: Hi,
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}}]
Figures:
\startmodeset [en] {\setupexternalfigures[directory={fig,fig/lang_en}]} [de] {\setupexternalfigures[directory={fig,fig/lang_de}]} [default]{\setupexternalfigures[directory={fig}]} \stopmodeset
Language:
\startmodeset [en]{\mainlanguage[en]} [de]{\mainlanguage[de]} \stopmodeset
Suffix:
\define\DocumentSuffix {\doifmodeelse{en}{EN}{\doifmode{de}{DE}}}
or
\startmodeset [en] {\defineexpandable\DocumentSuffix{EN}} [de] {\defineexpandable\DocumentSuffix{DE}} [default]{\defineexpandable\DocumentSuffix{EN}} \stopmodeset
Thank you Wolfgang, these "modesets" are neat. But it was primarily the .tex file search path I was interested in, I have figures working already, although your way is nicer. Is there something like \setuptexfilesdirectory? -- John Devereux
Am 30.10.2012 um 17:12 schrieb John Devereux
Thank you Wolfgang, these "modesets" are neat. But it was primarily the .tex file search path I was interested in, I have figures working already, although your way is nicer.
Is there something like \setuptexfilesdirectory?
You can set search directories with the \usepath ind \usesubpath commands, e.g. \usepath[de] searches components in the “de” directory \usesubpath[one,two,three] search components in the “one”, “two” and “three” subdirectories of the “de” etc. directories Wolfgang
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
Marco Patzer
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. Hmmm, alpha.tex defines component "a", beta.tex defines "b", is that right? -- John Devereux
Am 30.10.2012 um 17:24 schrieb John Devereux
Marco Patzer
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
2012-10-30 John Devereux:
It looks like \usepath is the key to what I want, thank you.
Yes, combine \usepath with the \startmodeset syntax that Wolfgang suggested and you should have a clean solution.
I don't quite understand your overall structure.
You're right. Without file names it's hard to follow, especially with the mistake I made.
Is the "*" a literal "*" with some special meaning, or are you using it as a placeholder for something?
It is a literal `*`. That means that the file name will be used as a component (or product) name.
I am not using the project/product/component system, perhaps I should look into it again.
Hmmm, alpha.tex defines component "a", beta.tex defines "b", is that right?
No, that's my fault. Of course they have to match. Marco
Marco Patzer
2012-10-30 John Devereux:
It looks like \usepath is the key to what I want, thank you.
Yes, combine \usepath with the \startmodeset syntax that Wolfgang suggested and you should have a clean solution.
I don't quite understand your overall structure.
You're right. Without file names it's hard to follow, especially with the mistake I made.
Is the "*" a literal "*" with some special meaning, or are you using it as a placeholder for something?
It is a literal `*`. That means that the file name will be used as a component (or product) name.
I am not using the project/product/component system, perhaps I should look into it again.
Hmmm, alpha.tex defines component "a", beta.tex defines "b", is that right?
No, that's my fault. Of course they have to match.
Excellent, thanks to you and Wolfgang. -- John Devereux
participants (3)
-
John Devereux
-
Marco Patzer
-
Wolfgang Schuster