** In TeX mode, you can use the variable tex-main-file to specify the
file for tex-file to run TeX on. (By default, tex-main-file is nil, and tex-file runs TeX on the current visited file.)

This is useful when you are editing a document that consists of multiple files. In each of the included files, you can set up a local variable list which specifies the top-level file of your document for tex-main-file. Then tex-file will run TeX on the whole document instead of just the file you are editing.