It is sometimes useful to know how to tweak the highlighting settings. One situation of annoying editor highlighting that arises is for example when you define a custom verbatim type of environment using say the moreverb, or listings packages. When I did this I found that "$" characters in my code lists (say for bash or Perl script code listings) were seen by Kile as unmatched math delimiters. This does not arise when you use the standard \begin{verbatim}...\end{verbatim} environment because Kate/Kile know about that environment, so they treat unpaired dollar characters as just plain verbatim text.
So to fix my custom environment I had to tweak the syntax highlighting rules for Kate. The place to do this is here:
$HOME/.kde/share/apps/katepart/syntax/latex.xml
This is where your "latex.xml" syntax highlighting rules for Kile are found (at least on my system (Fedora) they were located here in my Kate highlighting rules directory, it might be a little different for other distributions or earlier KDE releases?).
A quick way to incorporate rules for a new verbatim style of environment is to just search this "latex.xml" file for the keyword "verbatim", and wherever it occurs as an argument in a
<RegExpr String="...
string then replace the text "verbatim|" with "verbatim|mylisting|", for example, if your custom code lisiting environment is named "mylisting". Save and reopen Kile and then your editor should have verbatim style highlighting correct for all your
\begin{mylisting}
...
\end{mylisting}
segments, even if you have unpaired "$" characters in it. Of course you won't get any fancy code highlighting this way. It would be nicer to somehow tell Kate/Kile to highlight your \begin{mylisting}...\end{mylisting} segments according to the rules for the code language that the environment contains, e.g., C++ highlighting for lists of C/C++ code, and Perl highlighting for all the Perl code listings and so on. Interestingly this is possible in your output LaTeX dvi with packages like listings, but not so easy for your latex editor.
If anyone knows how to create rules for this for Kate/Kile then I'd like to know! It would probably involve some XML gymnastics because it amounts to having Perl or C or other language syntax highlighting within subregions of a file that is marked for LaTeX native syntax highlighting---not an easy thing to do I'd bet!
Of course i don't really care, it's the final processed LaTeX dvi that I really want to have smart highlighting, my editor can be damned
