Hi Al, I noticed another problem. AUCTeX usually detects that the output file (pdf or dvi) is ready to view when the user typed C-c C-c sufficient times repeatedly. However, after your patch is applied, that feature no longer works when TeX-output-dir is non-nil. How many times the user types C-c C-c in a buffer without intermediate editing, AUCTeX always suggests "LaTeX" as default command and never suggests "View" as default. This makes C-c C-a useless.
>>>>> Al Haji-Ali <[email protected]> writes: > Testing your example, I can see the error you mentioned. As you said, > the tex engine tries to create an aux file in a "subdir" directory > which exists under master root (since that's where one is including > the file file from) but naturally does not exist under "build". > I have no idea how to fix this. It is a bizarre implementation detail > of tex engines that such directories are not created when > `--output-directory` is passed. It seems even "latexmk" when provided > with "--output-directory" fails on a first run for the same reason, > only to automatically create the "build/subdir" on a second run and > succeed. It is not ideal, but I could potentially recreate this > solution, what do you think? It seems that this is rather an inconsistency in the implementation of "--output-directory" and \include than a fault of your work, because manual invocation of "latex --output-directory=build ..." outside of AUCTeX would already cause error and could not typeset the document. I think that elisp application like AUCTeX can do very little about this issue. Generally speaking, it seems that this kind of task (=keeping the document directory clean) should be taken care of by external tool dedicated for that purpose. I came across blog posts discussing this issue[1] and summarizing such tools[2]. (Note that these posts are written in Japanese.) Actually I was made aware of subdiretory issue of \include from the post[1]. The author of these posts claims that "--output-directory" is too deficient and actually created one of the tools mentioned above, ClutTeX[3]. [1] https://blog.miz-ar.info/2016/12/latex-and-output-directory/ [2] https://blog.miz-ar.info/2016/12/running-tex/#existing-tools [3] https://blog.miz-ar.info/2016/12/cluttex/ Taking into the difficulties to make it compatible with preview-latex, I'd recommend to consider that you don't aim for a comprehensive tool but rather a tool with limited range of application, i.e., for users who don't need preview-latex and \include+subdirectory. Regards, Ikumi Keita
