Fix syntax problem with \emph (fixes #245 and #272)

This commit is contained in:
Karl Yngve Lervåg 2015-11-11 11:25:52 +01:00
parent 54d0207a07
commit 42e851ab3f
3 changed files with 15 additions and 4 deletions

View File

@ -14,7 +14,8 @@ endif
" {{{1 Add conceal for \emph
if has('conceal') && get(g:, 'tex_conceal', 'b') =~# 'b'
syntax region texItalStyle
\ matchgroup=texTypeStyle start="\\emph\s*{" end="}" concealends
\ matchgroup=texTypeStyle start="\\emph\s*{" end="}"
\ concealends contains=@texItalGroup
endif
" }}}1

View File

@ -66,8 +66,18 @@ function! vimtex#change#get_command(...) " {{{1
let l:char = l:line[l:position[1]-1]
" Lists of relevant syntax regions
let l:commands = ['texStatement', 'texTypeSize', 'texTypeStyle', 'texBeginEnd']
let l:argument = ['texMatcher', 'texRefZone', 'texBeginEndName']
let l:commands = [
\ 'texStatement',
\ 'texTypeSize',
\ 'texTypeStyle',
\ 'texBeginEnd',
\ ]
let l:argument = [
\ 'texMatcher',
\ 'texItalStyle',
\ 'texRefZone',
\ 'texBeginEndName',
\ ]
for l:syntax in reverse(map(call('synstack', l:position),
\ 'synIDattr(v:val, ''name'')'))

View File

@ -1,4 +1,4 @@
\documentclass{minimal}
\begin{document}
\emph{$a+1$}
\emph{Italized text and $a+1$.}
\end{document}