Please refer to this answer for all the gory details.
post set of characters in
-[:space:].,:!?;'\")}\\[ i.e. dash, the
:space: character class, period, comma, colon, exclamation mark, question mark, semicolon, single quote, double quote, closing paren, closing brace, backslash or opening square bracket. Any of those after a closing emphasis character (
= in your examples above) will mark the end of the emphasis region.
In your case, you want to add the dollar sign
$ to the
post set, but you also want to add it to the
pre set: that way, the example
=s[=$i$=]= will work as you want it to work. For the other example, you want
s (or perhaps any alpha char) to be in the
post set. So in your init file, define
org-emphasis-regexp-components as follows (and make sure that it is defined before you load Org mode):
This makes your examples work, but depending on your needs, it might not be enough or it might be too much: you might need to add additional characters or classes to the
post sets, but you might also find that different examples require conflicting definitions, in which case you might be stuck: this variable might be too blunt an instrument to resolve some situations.