I'm using vim to write my thesis. It's a multi-document project, with most tex files in subdirectories from the master-document. I've set up a couple of \newcommands to replace the use of \section*{} in the Introduction, but when writing the sections, misspelt words aren't highlighted.

I thought it was a problem with vim-latexsuite, so I've just uninstalled it, but still, spell-checking functionality doesn't work in these sections.

For example, a MWE with the following files:-


thesis.tex :




% ...


Classes/Thesis.cls :

\ProvidesClass{Classes/Thesis}[2014/07/14 v1.2 Thesis template]

\LoadClass[pdftex, a4paper]{report}

            plainpages = false,
            bookmarksopen = true,
            bookmarksnumbered = true,
            breaklinks = true,
            colorlinks = true,
            % Colour settings from::
            % http://tex.stackexchange.com/questions/30243
            hyperindex = true,



  \markright{#1} % Get the Section name in headnotes

Intro/intro.tex :

\chapwtoc{First chapter}

this is a msisisspelt word. Some mnore mis-spellings.

\secwtoc{First section}

some more misskjkpellings.

% vim: spell spelllang=en_gb

thesis.tex.latexmain is an empty file, as suggested in the latexsuite documentation for Multiple file LaTeX projects

How do I get spell-checking to work in the intro.tex sections? Using vim 7.4 on Linux

  • Are you sure it's not just a colour scheme issue? With the default colour scheme “this” and “some” are highlighted, not so “chapwtoc” and “missdklkjpllings”. When I change the colour scheme to e.g. desert then all misspellings are highlighted.
    – Marco
    Sep 27, 2013 at 11:14
  • I'm just using the default colorscheme, but no difference with desert, or others...
    – Alex Leach
    Sep 27, 2013 at 11:17
  • The only highlighted words in intro.tex are in the vim settings line: spelllang and gb. If I use \chapter* and \section*, then it works as expected..
    – Alex Leach
    Sep 27, 2013 at 11:23
  • 1
    As yours worked, I had a look in my ~/.vimrc, and I found the culprit: let g:tex_flavor = "latex". Removing that fixes it
    – Alex Leach
    Sep 27, 2013 at 11:25
  • 8
    Indeed, seems to be a bug in tex documents, as opposed to plaintex docs. In the MWE, set filetype=tex breaks spell-checking. In my actual thesis, set filetype=plaintex fixes it.
    – Alex Leach
    Sep 27, 2013 at 12:08

2 Answers 2


You can force spell checking for tex documents by putting the following into .vim/after/ftplugin/tex.vim or .vim/after/ftplugin/tex/spelling.vim:

set spelllang=en_gb spell

Your approach to do it with modeline magic

% vim: spell spelllang=en_gb

should work too, but you need to explicitly enable modelines. (They can be a security issue.) To do so, put the following into your .vimrc:

set modeline
  • Both solutions doesn't work for me :(
    – Mr. D
    Apr 3, 2018 at 14:08
  • I'm still getting spelling errors in \href{}{}. Sep 25, 2019 at 15:15
  • That has nothing to do with this question @RaffiKhatchadourian. Please open a new one.
    – bodo
    Sep 26, 2019 at 21:27

Enable file type plugin:

echo -e 'filetype plugin on' >> ~/.vimrc
echo -e 'filetype plugin indent on' >> ~/.vimrc

Enable spell check for tex files and disable syntax:

mkdir -p ~/.vim/ftplugin/
echo -e 'set spell\nsyntax off' >> ~/.vim/ftplugin/tex.vim

To temporarily enable syntax, execute in vim:

:syn on

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.