In responding to how to typeset a Long underscore in LaTeX, I attempted to use a \phantom with \ul, but end up Argument of \makeph@nt has an extra }. So, what is the proper way to use a \phantom command in such a situation.
\documentclass{article}
\usepackage{xcolor}%
\usepackage{soul}%
\newcommand{\UnderlineText}[2][red]{\setulcolor{#1}\ul{#2}}%
\begin{document}
Signature: \UnderlineText[blue]{Sign here}
%Signature: \UnderlineText[blue]{\phantom{Sign here}}% Error if un-commented.
\end{document}
soulreads the content of its macros token (or brace group) by token and so splits the\phantomand its argument apart. It has an internal list of macro to officially support (like the\textxxformat macros), but fails on macros unknown to it (it can't know how many arguments they have). Wrapping the whole thing in braces will makesoultake it as one unit. However, line breaking might not be done for these (AFAIKsoulboxes all single units). – Martin Scharrer Aug 03 '11 at 08:18