I have the following code in soul to allow underlines for letters with descenders.
\usepackage{xcolor}
\usepackage{xparse}
\usepackage{soul}
\makeatletter
\ExplSyntaxOn
\cs_new:Npn \white_text:n #1
{
\fp_set:Nn \l_tmpa_fp {#1 * .01}
\llap{\textcolor{white}{\the\SOUL@syllable}\hspace{\fp_to_decimal:N \l_tmpa_fp em}}
\llap{\textcolor{white}{\the\SOUL@syllable}\hspace{-\fp_to_decimal:N \l_tmpa_fp em}}
}
\NewDocumentCommand{\whiten}{ m }
{
\int_step_function:nnnN {1}{1}{#1} \white_text:n
}
\ExplSyntaxOff
\NewDocumentCommand{ \varul }{ D<>{5} O{0.2ex} O{0.1ex} +m } {%
\begingroup
\setul{#2}{#3}%
\def\SOUL@uleverysyllable{%
\setbox0=\hbox{\the\SOUL@syllable}%
\ifdim\dp0>\z@
\SOUL@ulunderline{\phantom{\the\SOUL@syllable}}%
\whiten{#1}%
\llap{%
\the\SOUL@syllable
\SOUL@setkern\SOUL@charkern
}%
\else
\SOUL@ulunderline{%
\the\SOUL@syllable
\SOUL@setkern\SOUL@charkern
}%
\fi}%
\ul{#4}%
\endgroup
}
\makeatother
I've tried using it for the pinyin syllable xiě but it just doesn't print the ě, resulting in this:
\begin{document}
\varul{xiě}
\end{document}
The code works fine with the character set áàéèíìóòú} but not āǎēěīǐōǒūǔǖǘǚǜ. This more or less makes sense, and I'd nonrmallyjust assume it's an ASCII thing or something. However, it works fine for actual Chinese, like so:
\begin{document}
\varul{绿} se pronuncia \varul{lǜ}
\end{document}

Why is this? And how do I fix it? Thanks!!

uleminstead ofsoulif for some reason LuaLaTeX andlua-ulisn't an option.ulemis a bit more robust, but doesn't allow automatic hyphenation (instead, you can use\-to provide hyphenation points which still works). – Skillmon Apr 12 '21 at 18:45