[vim/vim] inconsistent LaTeX \texttt highlighting - highlighted as an ordinary command when within parentheses (Issue #16228)

47 views
Skip to first unread message

Adam Jenča

unread,
Dec 15, 2024, 4:18:43 PM12/15/24
to vim/vim, Subscribed

Steps to reproduce

  1. create a .tex file with the following content:
\documentclass{article}
\begin{document}
\texttt{test}
(\texttt{test})
(  \texttt{test}   )
\texttt{test})
((blahblah)\\
\texttt{test}
\texttt{test}
)
(lorem ipsum)
\texttt{test}
( \textit{test} \textbf{test})
\end{document}
  1. \texttt will be highlighted as an ordinary command when in parentheses
    image.png (view on web)

Expected behaviour

All instances of \texttt{} get highlighted the same way (green)

Version of Vim

9.1.8166

Environment

OS: Arch Linux
Kernel: x86_64 Linux 6.12.1-arch1-1
Terminal: konsole 24.08.
Shell: bash 5.2.37

Logs and stack traces

No response


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/16228@github.com>

ycm

unread,
Dec 15, 2024, 4:45:54 PM12/15/24
to vim/vim, Subscribed

To be clear this is not specific to \texttt, it seems to apply to \textbf, etc. that fall under texTypeStyle.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/16228/2544112661@github.com>

Charles Campbell

unread,
Dec 16, 2024, 3:35:14 AM12/16/24
to vim...@googlegroups.com
ycm (Vim Github Repository) wrote:
>
> To be clear this is not specific to |\texttt|, it seems to apply to
> |\textbf|, etc. that fall under |texTypeStyle|.
>
>
Please try the attached patch to syntax/tex.vim

Chip Campbell
ptch

Christian Brabandt

unread,
Dec 16, 2024, 3:36:44 AM12/16/24
to vim/vim, Subscribed

Please try the following patch: https://groups.google.com/g/vim_dev/c/R3-V6KrQsHc/m/lqCPuFSEAgAJ


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/16228/2544923881@github.com>

Adam Jenča

unread,
Dec 16, 2024, 9:10:25 AM12/16/24
to vim/vim, Subscribed

Didn't work, sorry.
Additionally, \textbf and \textit are now also broken:
image.png (view on web)


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/16228/2545729155@github.com>

Charles Campbell

unread,
Dec 16, 2024, 3:09:08 PM12/16/24
to vim...@googlegroups.com
ycm (Vim Github Repository) wrote:
>
> To be clear this is not specific to |\texttt|, it seems to apply to
> |\textbf|, etc. that fall under |texTypeStyle|.
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/vim/vim/issues/16228#issuecomment-2544112661>.
> You are receiving this because you are subscribed to this
> thread.Message ID: <vim/vim/issues/16228/25441...@github.com>
>
> --
> --
> You received this message from the "vim_dev" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google
> Groups "vim_dev" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to vim_dev+u...@googlegroups.com
> <mailto:vim_dev+u...@googlegroups.com>.
> To view this discussion visit
> https://groups.google.com/d/msgid/vim_dev/vim/vim/issues/16228/2544112661%40github.com
> <https://groups.google.com/d/msgid/vim_dev/vim/vim/issues/16228/2544112661%40github.com?utm_medium=email&utm_source=footer>.
ptch

JordL

unread,
Jan 17, 2025, 4:45:13 PMJan 17
to vim/vim, Subscribed

Hello,

I manage to get it working by adding texEmphStyle to texMatchGroup used by texParen for matching text:

screenPatchLatexTextttVim.png (view on web)

Italic and Bold were already added to texMatchGroup, that should explain why the behavior was different. Here is a patch:

patchTexttt.txt

Also I notice that texEmphGroup is used around line 430 but not defined, while texBoldGroup and texItalGroup groups are used and defined. Maybe there is another case where the highlighting may fail.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/16228/2599266046@github.com>

Christian Brabandt

unread,
Jan 18, 2025, 12:12:39 PMJan 18
to vim/vim, Subscribed

Closed #16228 as completed via 2cb8246.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/16228/issue_event/15986258659@github.com>

Christian Brabandt

unread,
Jan 18, 2025, 12:13:49 PMJan 18
to vim/vim, Subscribed

Thanks, I included your patch and added a syntax group. I couldn't really credit you, since you had no activity in your github profile and no email address.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/16228/2599793961@github.com>

Reply all
Reply to author
Forward
0 new messages