--- /usr/share/vim/vim64/syntax/lhaskell.vim	2006-05-23 14:03:58.000000000 +0200
+++ lhaskell.vim	2006-06-09 13:32:39.000000000 +0200
@@ -80,12 +80,23 @@
 
 " If user wants us to highlight TeX syntax, read it.
 if b:lhs_markup == "tex"
+    " Turn off the tex matcher as in documents with sections it will
+    " fail to match braces around section titles. Any other way to fix it?
+    if !exists("g:tex_no_error")
+        let g:tex_no_error = 1
+        let unlet_tex_var  = 1
+    endif
+    
     if version < 600
 	source <sfile>:p:h/tex.vim
     else
 	runtime! syntax/tex.vim
 	unlet b:current_syntax
     endif
+
+    if exists("unlet_tex_var")
+        unlet g:tex_no_error " Don't affect other buffers...
+    endif
 endif
 
 " Literate Haskell is Haskell in between text, so at least read Haskell
@@ -97,7 +108,7 @@
 endif
 
 syntax region lhsHaskellBirdTrack start="^>" end="\%(^[^>]\)\@=" contains=@haskellTop,lhsBirdTrack
-syntax region lhsHaskellBeginEndBlock start="^\\begin{code}\s*$" matchgroup=NONE end="\%(^\\end{code}.*$\)\@=" contains=@haskellTop,@beginCode
+syntax region lhsHaskellBeginEndBlock start="^\\begin{code}\s*$" matchgroup=NONE end="\%(^\\end{code}.*$\)\@=" contains=@haskellTop,@beginCode containedin=tex.*Zone
 
 syntax match lhsBirdTrack "^>" contained
 
