On Tue, Mar 31, 2026 at 09:22 (+0200), Arash Esbati wrote:
> Jim <[email protected]> writes:
>> Here are my files:
>> latex-standalone-main.tex:
>> ---------- cut here -------------
>> \documentclass{article}
>> \usepackage{standalone}
>> \usepackage{amsmath} % Load necessary packages in the main file
>> \begin{document}
>> \section{My Document}
>> Here is my first picture:
>> \includestandalone{latex-standalone-subfile}
>> \end{document}
>> ---------- cut here -------------
>> latex-standalone-subfile.tex
>> ---------- cut here -------------
>> \documentclass{standalone} % This is in the subfile
>> \usepackage{amsmath} % This is in the subfile
>> \begin{document}
>> % Content of the picture/figure
>> An equation $a+b=c$.
>> \end{document} % This is in the subfile
>> ---------- cut here -------------
>> I have indented and commented the LaTeX control sequences in the subfile so
>> we can see (I hope!) where each line comes from.
>> Now I edit the subfile, and set TeX-master to the main file.
> Sorry if my comment is off, but I always thought that with standalone,
> *all* files have this file local variable:
> %%% Local Variables:
> %%% mode: LaTeX
> %%% TeX-master: t
> %%% End:
> So in your latex-standalone-subfile.tex, you don't set `TeX-master' to
> latex-standalone-main.tex.
Arash,
that may be the case, although in that case it removes functionality which
I think would be useful.
Namely, if you are editing the sub-file, and it has TeX-master set to the
master file, you can compile that chapter (or whatever portion it
represents) with
C-c C-b
and while still in that file, you can compile the whole document with
C-C C-b.
I am beginning to think that navel gazing about how LaTeX does things and
how to adapt what is essentially LaTeX-specific code to ConTeXt might be
the wrong and difficult way to do this.
Here's an idea: I write one or two ConTeXt-specific functions, and at (to
be determined) points in (maybe) TeX-command-region (and analogously
TeX-command-buffer) we do something like
(if <this-is-ConTeXt-source>
(ConTeXt-command-region)
<all the current LaTeX stuff>)
I realize this could cause a bit of code duplication, which is not
desirable, but it might be expeditious.
Arash and Ikumi: what do you think about this idea?
Do you think this is a reasonable way to go, or does the
idea seem like the wrong solution to the problem?
Thanks.
Jim