6

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}
Daniel Chávez
  • 185
  • 1
  • 6
  • 1
    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 05:40
  • You can't have line breaks in contour. The main text is inside a \mbox{}. – Ulrike Fischer Jan 30 '18 at 10:51

1 Answers1

5

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}

enter image description here

egreg
  • 1,121,712