Tagbar is a useful plugin for Vim that displays tags of a source file ordered by their scope in a split window. However, if you open a LaTeX file in Vim, the Tagbar shows its chapters, sections and paragraphs correctly but they are not ordered by scope. Instead, all the chapters appear together, all the sections together and so on.
This is not a problem with Tagbar, but with the ctags program which is used by Tagbar to generate the tags. As of this writing, the ctags that ships with Ubuntu 12.04 LTS is a really old version that does not generate scope information for the tags of a LaTeX file. Thankfully, the tag scope feature for LaTeX files has been added to the main branch of ctags in 2012. Getting Tagbar to use the new version of ctags is easy:
- Uninstall the exuberant-ctags package from your Ubuntu system.
Compile ctags by using these commands:
$ autoheader $ autoconf $ ./configure $ make $ sudo make install
Now open the LaTeX file in Ubuntu and its tags should be displayed with correct scoping in Tagbar.
Tried with: Ubuntu 12.04 LTS