I would like to have the text between curly braces appear highlighted in lightpink in my TexWorks editor. I don't have a cs background, and this is as far as I've got. I've added the following to my syntax-patterns file:

lightpink   N   /\{([^}]+)\}/g

but it does not appear to work. My question is two parts:

  1. Is this even doable? I sometimes have expressions between curly braces, for example


    Ideally I'd like only "thyme" to appear in light pink. There's already default syntax color for \index, {, \textit, and }}.

  2. If this is doable, what should my regular expression be?

Thanks so much!

  • I know nothing about TexWorks, but your regular expression won't work in general. It doesn't handle nested braces like {abc{pqr}xyz} - it will match {abc{pqr}. I don't think a RE can do this, because the RE can't "count" the number of nested {'s and skip over the correct number of }'s. – alephzero Jul 11 '18 at 21:19
  • I see. I'm sorry, I don't have a cs background. Is it possible to just highlight anything between a { and }? As in if there's a {, look to see if it's eventually followed by a }, and if so, select that text? – sml Jul 12 '18 at 17:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.