Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • Great! there is a typo in the sed script: s/_/_u/g;s/</_l/g;s/>/_/g should be s/_/_u/g;s/</_l/g;s/>/_g/g Commented Feb 7 at 3:21
  • @ThierryBlanc. Thanks and well spotted. I've simplified it somewhat as the replacement characters don't have to be single characters in this instance. Commented Feb 7 at 6:21
  • It sounds like you're saying your sed script accounts for escaped braces \{ or \}. If so, it's not obvious how it's doing that so would you mind editing your answer to add an explanation for that part of the sed script? I THINK it's the ((\\.|[^{}\\])*) part of the regexp that's doing it but I don't see why that'd work. Commented Feb 7 at 12:42
  • 1
    @EdMorton, see edit. AFAICT, that should work except for the case of \\SomeStyle{something} already noted. Commented Feb 7 at 13:27
  • Ah, I think I see it now. \\. matches any escaped character so it'd match \\ if \\{ were present (so handling all pairs of contiguous \s that might exist before a {) or match \{ if that were present but not as part of \\{ (so handling a truly escaped {). Then [^{}\\] matches any singe character other than {, } or \. Putting that inside (...)* provides 0-or-more repetition so I don't see yet why that wouldn't accommodate \\SomeStyle{something}. Commented Feb 7 at 15:26