I'm using Emacs 23.1.1, with AUCTeX plugged in, to edit my .tex
files, but I'm having a small problem with my amsmath
environments.
The current document I'm editing is divided into multiple files. Only the main file contains the \usepackage{amsmath}
command. When I'm editing the main file, auctex automatically detects amsmath, and so all commands work perfectly. When I'm editing one of the embedded files (which don't have amsmath loaded, they don't even have a preamble), AUCTeX does not implement any of the amsmath command.
For instance, if I press C-c C-e
the environments available don't include any of the amsmath
specific environments. Even if I manually type in "align", AUCTeX will open an align
environment but won't label it. I know I can manually define environments for AUCTeX to remember and label in my .emacs file, but they still won't behave well with RefTeX (the M-RET
key doesn't behave correctly).
Each embedded file has the following lines at the end of the file, but it didn't help:
%% Local Variables:
%% mode: LaTeX
%% tex-main-file: "../main.tex"
%% TeX-master: "../main.tex"
%% End
Also, if I add the \usepackage{amsmath}
line at the beginning of the embedded file, then auctex behaves exactly like it should. Obviously I can't just declare a package in the middle of the document, and LaTeX returns errors and doesn't compile.
Is there something I can do to get auctex to load amsmath-behavior for the embedded files? Or maybe I can just force AUCTeX to load amsmath
on every file (even those that don't declare the package)?
EDIT: I failed to reproduce this at home. Since I'm testing with the same files I used at work, all seems to indicate the problem is with the .emacs file I use at work. I'll look through it and try to find what's causing the problem, or post it here if needed. Unfortunately, I'll only be able to access it by Monday (I think a power surge at my workplace might have shut down my machine there, cause my ssh
attempts are having no success).