Improve cleveref support (LaTeX-Box #137)

This commit is contained in:
Karl Yngve Lervåg 2013-10-16 10:17:08 +02:00
parent 611997ccb4
commit c1ed8da4eb
2 changed files with 18 additions and 3 deletions

View File

@ -1,5 +1,20 @@
" Add support for cleverref package (`\cref` and `\Cref`)
" Add support for cleverref package
" \Cref, \cref, \cpageref, \labelcref, \labelcpageref
syn region texRefZone matchgroup=texStatement
\ start="\\\(c\|C\)ref{"
\ start="\\\(\(label\)\?c\(page\)\?\|C\)ref{"
\ end="}\|%stopzone\>"
\ contains=@texRefGroup
" \crefrange, \cpagerefrange (these commands expect two arguments)
syn match texStatement
\ '\\c\(page\)\?refrange\>'
\ nextgroup=texRefRangeStart
syn region texRefRangeStart matchgroup=texStatement
\ start='{' end='}'
\ contains=texRefZone
\ nextgroup=texRefRangeEnd
syn region texRefRangeEnd matchgroup=texStatement
\ start='{' end='}'
\ contains=texRefZone
hi link texRefRangeStart texRefZone
hi link texRefRangeEnd texRefZone

View File

@ -19,7 +19,7 @@ call latex#util#set_default('g:latex_complete_enabled', 1)
call latex#util#set_default('g:latex_complete_close_braces', 0)
call latex#util#set_default('g:latex_complete_patterns',
\ {
\ 'ref' : '\C\\v\?\(eq\|page\|[cC]\)\?ref\*\?\_\s*{[^{}]*',
\ 'ref' : '\C\\v\?\(eq\|page\|[cC]\|labelc\)\?ref\*\?\_\s*{[^{}]*',
\ 'bib' : '\C\\\a*cite\a*\*\?\(\[[^\]]*\]\)*\_\s*{[^{}]*',
\ })
call latex#util#set_default('g:latex_errorformat_show_warnings', 1)