On Dec 17, 2024, at 11:40-0500 Arash Esbati <[email protected]> wrote:

> Kourosh Kalayeh <[email protected]> writes:
>
>> Effectively, I’d like C-c C-a to compile the subfile when working
>> within a subfile, and to compile the whole document when invoked in
>> the main parent file (main.tex).
>>
>> Is there a straightforward way to achieve this behavior in AUCTeX?
>
> Not that I'm aware of.  You can try to convert your files using the
> subfiles.sty.  From its manual:
>
>   • If LaTeX is run on the subfile, the line
>     \documentclass[..]{subfiles} is replaced by the preamble of the main
>     file (including its \documentclass command). The rest of the subfile
>     is processed normally.
>
>   • If LaTeX is run on the main file, the subfile is loaded like with an
>     \input command, except that the preamble of the subfile up to
>     \begin{document} as well as \end{document} and the lines following
>     it are ignored.
>
> AUCTeX has support for subfiles.sty, so your workflow should work.  I
> think the only catch is that you have to set `TeX-master' to t for all
> files, incl. the subfiles.

Thanks, will give it a shot at some point.

Kourosh 

Reply via email to