0

I need to color a specific word in my document compiled with XeLaTeX engine, following this answer automatically apply special formatting to selected words in text.

\documentclass{article}
\usepackage{color,xesearch}

\SearchList*{redwords}{\textcolor{red}{#1}}{hello}

\begin{document}
This is hello and this is hellow.
\end{document}

I have Error

! Undefined control sequence. \xdef \xs@String {\xs@String h}\xs@LearnLetter l.7 Thi s is hello and this is hellow. The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., '\hobx'), type 'I' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined.

Salim Bou
  • 17,021
  • 2
  • 31
  • 76

1 Answers1

2

Same problem as in your other question. xesearch hasn't be adapted to the new number of classes.

\documentclass{article}
\usepackage{color}
\usepackage{xesearch}
\makeatletter
\chardef\xs@NatDel=4095
\XeTeXinterchartoks\xs@lrDel\xs@Classless={\xs@LearnLetter}
\XeTeXinterchartoks 4095 \xs@Classless={\xs@LearnLetter}
\XeTeXinterchartoks 4095 \xs@lrDel{\xs@EndString}
\makeatletter
\SearchList*{redwords}{\textcolor{red}{#1}}{hello}

\begin{document}
This is hello and this is hellow.
\end{document}

enter image description here

Ulrike Fischer
  • 327,261