Hi Jim,

>>>>> Jim <[email protected]> writes:
> Sorry, please allow me to better explain.

> I am sorry I did not make that clear enough in my original message, when I
> said
>>> All of the chapter files \input the introCTX_env.tex file
> I should have made it clearer that they use "../introCTX_env.tex" to find
> the environment file.

> If I do remove the "../" from
>         \environment ../introCTX_env.tex
> then C-c C-b does work, because now _region_.tex will refer to a file in
> the same directory, which is where introCTX_env.tex is found.

Now I think I understand the culprit. You use \environment rather than
\input to pull in the content "../introCTX_env.tex". I suppose
\environment is ConTeXt specific and it works with "true" relative path
specification unlike \input.

I think similar problems don't occur for LaTeX and plain-TeX; for those
two engines, when I use \input command in the sub file, the path must
supplied as if "the current directory is the top directory" instead of
the directory of the sub file. In this case,
\input introCTX_env.tex
rather than
\input ../introCTX_env.tex
. (I expect the situation is the same for even ConTeXt if you use \input
instead of \environment)

>> While it is true that _region_.tex is created in the top directory, the
>> TeX-master specification "../introCTX.tex" in it is harmless because
>> "context" command invoked by C-c C-r ignores the commented line.

> It isn't harmless (in this case) because with TeX-master set to a file in
> the parent directory, AUCTeX makes the compile happen in the wrong
> (top-level) directory, from where "../introCTX_env.tex" doesn't exist.

If I understand correctly, `TeX-master' has nothing to do with this
issue. It is the behavior of \environmet that is involved. In my
opinion, the location for _region_.tex isn't wrong because it must be
there for \input to work correctly.

Assuming my above thought is right, I think it is difficult to address
this issue reliably. AUCTeX has to parse the content when it creates
_region_.tex and modify the all occurrences of relative path of
\environment command.

> Now that I have (hopefully!) made that clearer, do you see the issue?

> And, if so, do you know how I should approach this?  In other words, what
> is The Right Thing to do in cases like this.

Does ConTeXt has mechanism similar to LaTeX preamble? AUCTeX assumes, in
LaTeX document, that the contents before
\begin{document}
is common for all region compilation and add them at the top of
_region_.tex so that preamble is processed by "latex" command. If
ConTeXt has counterpart of LaTeX preamble and there is an explicit
delimiter like
\begin{document}, you can put \environment before that delimiter and set
`TeX-header-end' to a regular expression to match the delimiter. Then
C-c C-r would work.

Ikumi Keita
#StandWithUkraine #StopWarInUkraine
#Gaza #StopGenocide #CeasefireNOW
#IProtestAgainstTrumpAndNetanyahu'sAttackOnIran,WhichViolatesInternationalLaw

Reply via email to