9.2 Specifying which file to compile

In the example described previously, if you are editing intro/intro.tex and press \ll, then you still want Latex-Suite to compile main.tex, because intro/intro.tex is merely a fragment which is \input'ed into main.tex. If the master file is already specified using the *.latexmain convention described previously, then Latex-Suite will automatically compile the master file when you are editing any of its \input'ed fragments. Thus pressing \ll while editing intro/intro.tex will compile main.tex.

If you wish to use some different logic to specify the main file name, you can specify a custom expression via the Tex_MainFileExpression variable. This is a string containing a valid vim expression. In addition, you can use a variable modifier which is in the format used for |filename-modifiers|, for example, ':p:h'. You should utilize this variable to modify the filename of the main file.

let g:Tex_MainFileExpression = 'MainFile(modifier)'
function! MainFile(fmod)
    if glob('*.latexmain') != ''
        return fnamemodify(glob('*.latexmain'), a:fmod)
        return ''