I have been having persistent and incredibly annoying problems
with Auctex recognizing remembering my master document file using
emacs and doom-emacs. It was working well for a long time, but
then something broke and I have no idea what.
Here is my set up:
I have a file named main.tex in the top level of the folder which
"includes" chapter files located in a /chapters sub-folder.
I can compile from the main document but not from the included
files. I am using latexmk to compile but the issue is the same
with calling pdflatex directly. When I try to compile from an
included file, I get a bunch of errors, basically telling me that
it did not find \begin{document.
My individual chapter files identify the master as follows:
%%% Local Variables:
%%%mode: latex
%%%TeX-master: "../main"
%%% End:
My master (main) file is identified in this manner:
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
However, if I delete the local variables from the chapter file
and save it and then do C-c _ again to set the master file again,
it will compile properly and I have access to reftex but not to
all of theĀ macros and environments for the whole document.
However, this only works for the current session. Whenever, I
return, I have to remove and then re-add the local variables,
which is ridiculous.
Currently, I am using Doom-Emacs (doom 2.09, with emacs 26.3).
With my doom installation, my Auctex version is 13.0.5.2021-03-25.
My config.el in doom includes:
(setq TeX-auto-save t)
(setq TeX-parse-self t)
;; (setq-default TeX-master nil) ; Query for master file.
(setq-default TeX-master "main") ; All master files called
"master"
;;(setq-default TeX-master "../main") ; All master files called
"master"
But I have tried all combinations and it doesn't work. Is it
possible that this is a new Auctex bug, or am I really doing
something wrong here?
I would happily just compile from my "main" file, but then I don't
have access to any of the reftex, macro or environment info for
the whole document.
It just shouldn't be so complicated to identify a master document
with included files. Everything works superbly in Sublime Text
with LatexTools and in TexStudio, but I happen to really like
Auctex and Reftex. The fact that I am using org-mode makes me want
to stick with emacs / doom-emacs for all of my LaTeX work if
possible.
Any help would be greatly appreciated.
Thanks.