[Tex/LaTex] Error “Reconstruction failed” with soul package

errorsmacrossoul

I've got a problem with the soul package while adding a letter-spacing to a result of a command that is defined just like this:

\newcommand{\myCommand}{some text}

In the document I'd like to have the result of that command displayed with letter-spacing:

\par{\centering{\Huge
 \textbf{\myAnotherCommand{} \textsc{\so{\myCommand{}}}}
}\bigskip\par}

but I get "Package soul error: Reconstruction failed" and a black square after the text "some text". If I understand soul package documentation properly, it's a problem with "grouping hyphenatable material" or font switching commands, isn't it? Unfortunately, I've no idea how to fix it. Am I supposed to register some command with \soulregister?

I'd be grateful for any advice.

Best Answer

With pdflatex the most easy way to get letterspacing is via microtype

\usepackage{microtype}

...

\par
{\centering\Huge
 \textbf{\myAnotherCommand{} \textsc{\lsstyle \myCommand}}
 \par\bigskip}

This avoids the need to do all the involved tricks of soul. Letterspacing can be obtained via the package letterspace (included with microtype), but it doesn't hurt to load the bigger one (it's very advantageous, actually).

With XeLaTeX a similar effect can be obtained with

\addfontfeature{LetterSpace=2.0}

(the number can be chosen to suit one's needs):

\par
{\centering\Huge
 \textbf{\myAnotherCommand{} \textsc{\addfontfeature{LetterSpace=2.0} \myCommand}}
 \par\bigskip}

This particular combination might fail, because not all fonts family have a boldface small caps font.