[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Compiling Individual Files in Multi-File Projects
From: |
Arash Esbati |
Subject: |
Re: Compiling Individual Files in Multi-File Projects |
Date: |
Tue, 17 Dec 2024 17:40:11 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Kourosh Kalayeh <k.kalayeh@gmail.com> 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.
Best, Arash