Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8679297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:56:12+00:00 2026-06-12T20:56:12+00:00

Say I hava a LaTeX document open in Vim, and I want to highlight

  • 0

Say I hava a LaTeX document open in Vim, and I want to highlight every occurence of

{\color{red} ... }

(where the dots are supposed to symbolize some contents), that is, I want to have {\color{red}, } and everything between these highlighted. This I have done with

:syn region WarningMsg start=+{\\color{red}+ end=+}+

but I have the problem that, if I write something like {\color{red} some{thing} important}, then it is only {\color{red} some{thing} which gets highlighted, because Vim of course mathces the first occurrence of }. How can I make this Highlighting rule so that it skips matching curly brackets? Even multiple levels of such.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T20:56:13+00:00Added an answer on June 12, 2026 at 8:56 pm

    For clarity it is better to give each syntax region a bespoke name, and then link it to a standard colour group. I have renamed your original region redTeX.

    You need to define a second region, innerBrace, defining the braces you want to ignore, and mark this region as transparent. Then redTeX should be marked to contain the transparent region, which it will then ignore.

    syn region innerBrace start=+{+ end=+}+ transparent contains=redTeX
    syn region redTeX start=+{\\color{red}+ end=+}+ contains=innerBrace
    hi link redTeX WarningMsg
    

    Note that in this case there is the added subtlety that redTeX itself matches as an innerBrace. I fixed this by marking innerBrace as containing redTeX.

    Hope that makes sense!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have a Telerik MVC Grid, AJAX bound and I want to put
Say I want to draw a Ball in the scene and here are two
I'm borrowing the slice meaning from C++. Let's say I hava a simple POJO
Say I have a byte array with 100,000 bytes in it. I want to
Say in my js file I want to have var NO = 0; var
Say my web app has two spring cron jobs scheduled to run every minute/hour.
I hava an editor template for, let's say, date: @model DateTime @section AdditionalJavaScript2 {
Say I have some pixel buffer associated with variable: CVPixelBufferRef a; I want to
Say I want to test this module: import osutils def check_ip6(xml): ib_output = osutils.call('iconfig
I hava a UIButton. And for my button I want to set image with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.