In the plugin tagbar the author recomends adding some lines to the file .ctags for generating some nice latex tags. One example is
--regex-latex=/^\\section[[:space:]]*\*[[:space:]]*\{([^}]+)\}/\. \1/s,section/
the only problem I have with this is that it would match a line with a comment. A comment in latex is any line is whatever follows a %. So I tried to modify the regular expression to:
--regex-latex=/^[[:space:]]*[^%]+\\section[[:space:]]*(\[[^]]*\])?[[:space:]]*\{([^}]+)\}/\. \2/s,section/
The part that I added [[:space:]]*[^%]+ just tries eliminate the lines that have one or more space followed by the % char.
But now the problem is that a line starting with \section{whatever} will not generate any tags. Is there a way of fixing this?
I think I figured it out and it is easier than I thought:
should simply be
So instead of
[^%]+, I changed it to[^%]*. I don't think I understand why, but it seems to work.