# My line won't break because of package contour

I would really appreciate if someone could help me with this. I don't know how to prevent the second phrase from not breaking at the end of the line. Surely, I can break the phrase on my own (third phrase), but then it doesn't fit the whole width of the text and I have to make it fit manually. I need Latex to take care of that line break. Apparently, the reason is contour package, but I do need its very bold font.

EDIT: I simplified my code. Sorry about that.

\documentclass[10pt]{article}
\usepackage[usenames]{color}
\usepackage[outline]{contour}

\definecolor{MIR}{RGB}{187, 30, 16}

\contourlength{0.3pt}
\contournumber{20}

\newcommand{\MIR}[1]{\contour{MIR}{#1}}

\begin{document}

I only need some text width enough to prove my point, so I'll write some nonsenses.

\MIR{I only need some text width enough to prove my point, so I'll write some nonsenses.}

\MIR{I only need some text width enough to prove my point, so I'll write}\linebreak \MIR{some nonsenses.}
\end{document}

• Aside: The problem does not appear to be related to the soul package and the \ul macro. Hence, you could (should?) probably simplify your minimum working example further by leaving out all \ul-related directives and not loading the soul package. – Mico Jan 30 '18 at 5:40
• You can't have line breaks in contour. The main text is inside a \mbox{}. – Ulrike Fischer Jan 30 '18 at 10:51

You can't break lines in the scope of \contour. But you can split the words and apply \contour to each one.

\documentclass[10pt]{article}
\usepackage[usenames]{color}
\usepackage[outline]{contour}
\usepackage{xparse}

\definecolor{MIR}{RGB}{187, 30, 16}

\contourlength{0.3pt}
\contournumber{20}

\ExplSyntaxOn
\NewDocumentCommand{\MIR}{m}
{
\seq_set_split:Nnn \l_tmpa_seq { ~ } { #1 }
\seq_map_inline:Nn \l_tmpa_seq { \contour{MIR}{##1} ~ } \unskip
}
\ExplSyntaxOff

\begin{document}

I only need some text width enough to prove my point, so I'll write some nonsenses.

\MIR{I only need some text width enough to prove my point, so I'll write some nonsenses.}

\end{document}


• This works but in my original code, I also use macro \ul from soul package combined with contour. With your code, I get words individually underlined. Is there a way to get a single underline? – Daniel Chávez Jan 30 '18 at 15:03
• @DanielChávez I don't think so. – egreg Jan 30 '18 at 15:33
• Okay. I think it's great the way it is now. Thank you so much. – Daniel Chávez Jan 31 '18 at 6:22