I already read the discussions about this error, but nothing helpfull. My MWE

%\soulregister{\cl}{7} irrelevant



% ok :
\codeinline{ {\cl{FF0000}{Hello}} }

% Package soul Error: Reconstruction failed.
\codeinline{ {\cl{FF0000}{Hellooooooooooooooooooooooooooooooooooooooooo}} }

\codeinline{ {\cl{FF0000}{Hello World}} }


the first \codeinline works fine, not the others. How can i fix it ?

  • 1
    See my answer here for a possible solution: tex.stackexchange.com/a/404905/31729. Don't use the minimal class!
    – user31729
    Jan 19, 2018 at 19:31
  • I've already try \soulregister{\sethlcolor}{7} same issue.
    – nikopol
    Jan 19, 2018 at 19:35
  • @nikopol: Your code does not reveal that you used \soulregister
    – user31729
    Jan 19, 2018 at 19:37
  • @ChristianHupfer \soulregister isn't relevant in my mwe because the issue is the same with or without it
    – nikopol
    Jan 20, 2018 at 13:57
  • @nikopol: It would have been nice to add it to the question such that others do not have to suggest \soulregister again ... but it's your question of course.
    – user31729
    Jan 20, 2018 at 17:37

2 Answers 2


In a similar situation, I found the help text provided by the soul package quite useful. It suggests to wrap the text inside an mbox. Indeed, if you change your definition to


your MWE works for me. There might be issues with hyphenation if the text inside \codeline is long. (Seems to be a limitation of soul generally.)

  • hyphenation will not work not because a limitation of soul but because there is never a line break (and so hyphenation) in a \mbox{}. Feb 2, 2018 at 10:23
  • @Ulrike: You're right. What I meant was: with the \mbox, hyphenation will not work, but without the \mbox the soul package has problems. Actually, the help text printed by soul for the OP's error says: "I came across hyphenatable material enclosed in group braces, which I can't handle". It's explained in §8 and §9 in section 2.1 of the soul manual.
    – ThV
    Feb 2, 2018 at 10:37

It won't work. The word-/syllable analyzer of soul is rather fragile and a complicated command like \textcolor throws it out of the track. If you want to color the text, you should call the color before the \hl. Small bit of colors can be hidden in a \mbox:


\definecolor{inlineFG}   {HTML}{FF0000}


% ok :



enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.