I am using xelatex and trying to italicize a text segment that includes a comma. The only way ahead that I know of is by using xesearch and its command SearchList. It works for the most part, but if the phrase includes a comma I simply can't seem to pass the entire phrase as a single argument to the command (by escaping the comma). Here is an example of what I am trying to do:
\documentclass[11pt, a4paper]{article}
\usepackage{xesearch}
\begin{document}
a, b, abc, b, a, b, c
\SearchList*{list1}{\textit{#1}}{a, b}
a, b, abc, b, a, b, c
\StopList{list1}
\end{document}
Doing this matches the a's but does not italicize the b's anywhere. The culprit seems to be the space in front of the b that is passed as an argument to SearchList. Removing the space so that the line now reads
\SearchList*{list1}{\textit{#1}}{a,b}
results in the single a and b's being italicized (as expected).
However, I am specifically trying to italicize the segment "a, b" (with a comma and a space between the letters), ignoring other instances of the letter b. All the occurrences of "a, b" -- two in this case -- should be italicized.
I have tried adding braces following the advice found here: how do I escape a comma? although I must admit that I don't fully understand escape sequences in latex. This is what I have tried:
\documentclass[11pt, a4paper]{article}
\usepackage{xesearch}
\begin{document}
a, b, abc, b, a, b, c
\UndoBoundary{,}
\SearchList*{list1}{\textit{#1}}{{a, b}}
a, b, abc, b, a, b, c
\StopList{list1}
\MakeBoundary{,}
\end{document}
This seems to not do anything. Any help would be appreciated.
,
from the delimiters, but spaces are different.