I want to underline consecutive sentences each with a different color within an italic text. So far, I have tried the soul package and can change the underline properties. However, I am having difficulties changing the underline color in consecutive sentences within an italic text.
Consider the following: I want each of the \ul's have a different color.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{color,soul}
\begin{document}
\setul{0.5ex}{0.3ex}
\definecolor{Green}{rgb}{0,1,0}
\setulcolor{Green}
\setul{0.5ex}{0.3ex}
\definecolor{Red}{rgb}{1,0.0,0.0}
\setulcolor{Red}
\setul{0.5ex}{0.3ex}
\definecolor{Blue}{rgb}{0,0.0,1}
\setulcolor{Blue}
\Large
\textit{
Ham followed now ecstatic use speaking exercise may repeated.
\ul{Himself he evident oh greatly my on inhabit general concern}.
\ul{It earnest amongst he showing females so improve in picture.
Mrs can hundred its greater account}.
\ul{Distrusts daughters certainly suspected convinced our
perpetual him yet.} Words did noise taken right state are since.
}
\end{document}
This is my desired output:


setulcolormust be incompatible with some packages, as your template worked for me but not when inserted in a larger project. However, I didn't need the color, so I'm not going to investigate. Just mentioning it in passing. – PatrickT Oct 10 '17 at 21:12beamer, check https://tex.stackexchange.com/questions/41683/ – fuenfundachtzig Mar 13 '21 at 13:53setulcolorwith a given external documentclass. My workaround was{\color{red} \underline{\color{blue} test}}. – Karlo Apr 01 '23 at 23:47