## Simple latex ctags and taglist

Just a quick update because I find this incredibly useful

# ctags

Exuberant ctags is a great tool for navigating code. Unfortunately it does not have support for latex. You can add the following code to ~/.ctags to add support for some simple latex tags:
 --langdef=latex --langmap=latex:.tex --regex-latex=/\\label\{([^}]*)\}/\1/l,label/ --regex-latex=/\\section\{([^}]*)\}/\1/s,section/ --regex-latex=/\\subsection\{([^}]*)\}/\1/t,subsection/ --regex-latex=/\\subsubsection\{([^}]*)\}/\1/u,subsubsection/ --regex-latex=/\\section\*\{([^}]*)\}/\1/s,section/ --regex-latex=/\\subsection\*\{([^}]*)\}/\1/t,subsection/ --regex-latex=/\\subsubsection\*\{([^}]*)\}/\1/u,subsubsection/ 

This adds tags for sections, subsections, subsubsections and labels. Even though this is very basic, I find it’s all I need for editing latex documents.

# taglist

taglist is a nice plugin for vim which autogenerates tags using exuberant-ctags and can list all the tags in a file in a separate window.

 let tlist_tex_settings = 'latex;l:labels;s:sections;t:subsections;u:subsubsections' 

Also, since I use the ‘-‘ and ‘:’ characters a lot in my labels, I find it useful to add those characters to iskeyword
 set iskeyword=@,48-57,_,-,:,192-255 
iskeyword defines what characters are considered to be a part of the same word by commands like ‘w’ and ‘CTRL-]’

That’s it!

~ by hellfeuer on November 16, 2009.

### 3 Responses to “Simple latex ctags and taglist”

1. Thanks . Very usefull to navigate latex file with vim😀

2. works.. thx!

3. Thanks !

You can add “^\s*” before =/ to avoid listing commented sections, and allow spaces before \section. Example :

“–regex-latex=/^\s*\\section\{([^}]*)\}/\1/s,section/”