Skip to content

Commit

Permalink
feat(syntax): proper conceal for \text in math zones
Browse files Browse the repository at this point in the history
refer: #1968
  • Loading branch information
lervag committed May 1, 2021
1 parent 7c6b491 commit e3d1a4f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
13 changes: 13 additions & 0 deletions autoload/vimtex/syntax/core.vim
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,19 @@ function! s:match_bold_italic_math() abort " {{{1
\ contained conceal skipwhite nextgroup=texMathStyleConcArg
syntax region texMathStyleConcArg matchgroup=texDelim start="{" end="}"
\ contained contains=@texClusterMath concealends

for l:re_cmd in [
\ 'text%(normal|rm|up|tt|sf|sc)?',
\ 'intertext',
\ '[mf]box',
\]
execute 'syntax match texMathCmdText'
\ '"\v\\' . l:re_cmd . '>"'
\ 'contained skipwhite nextgroup=texMathTextConcArg'
\ 'conceal'
endfor
syntax region texMathTextConcArg matchgroup=texDelim start="{" end="}"
\ contained contains=TOP,@NoSpell concealends
endif
endfunction

Expand Down
10 changes: 10 additions & 0 deletions test/test-syntax/test-conceal.tex
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,14 @@
$\bar a$
$\bar{a}$

\begin{equation}
\text{test}
\textnormal{test $asd$}
\textrm{test}
\textup{test}
\texttt{test}
\textsf{test}
\textsc{test}
\end{equation}

\end{document}

0 comments on commit e3d1a4f

Please sign in to comment.