# How to get Vim Latex-suite projects (with .latexmain-files) to configure spelling in subfiles correctly

I use Latex in larger projects and I use the following file structure:

project/
mainfile.tex
mainfile.tex.latexmain
tex/
subfile1.tex
subfile2.tex
...


The command \input{tex/subfileN.tex} is used to import the content from each file in the tex/ folder. The mainfile.tex.latexmain work as expected and cross-reference completion across the project is available.

However, spite recogized correctly, spelling in each of the subfiles does not work properly. Spelling in comments follow g:tex_comment_nospell and verbatim follow g:tex_verbspell, but nothing in the document itself irrespectively of the state ofg:tex_nospell.

A little bit of exploring and I found at that by adding a \begin{document}/\end{document}-pair, the document behaves normal again. I'm assuming that latex-suite thinks that the document is stand-alone and I'm actually writing a preamble. But the preamble and \begin{document}/\end{document}-pair can be found in mainfile.tex.

To enable spelling in such projects I in practice either comment out each line or add a \begin{document}/\end{document}-pair. Neither are very good solution to the problem.

Is there a good way to get around this? Alternatively, is there another way of structuring my documents I should be using that doesn't involve me editing a file with 8000 lines?

let g:tex_nospell=1