# Cross-line inline tcolorbox

As shown in the following example, underlining a cross-line sentence can be easily done by \ul via soul.sty. Can a cross-line sentence be tcolorboxed automatically in a similar way?

\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{soul}
\usepackage{tcolorbox}
\usepackage{parskip}
\begin{document}
In order to show the expected result, allow me to add a few words here.
\ul{This is a cross-line long sentence.} Underlining a cross-line sentence is easy.

In order to show the expected result, allow me to add a few words here.
\begin{tcolorbox}[colback=red!5!white, colframe=red!75!black, right=0pt,
rightrule=0pt, on line, hbox, sharp corners=east]
This is a cross-line
\end{tcolorbox}
\begin{tcolorbox}[colback=red!5!white, colframe=red!75!black, left=0pt,
leftrule=0pt, on line, hbox, sharp corners=west]
long sentence.
\end{tcolorbox}
Can a cross-line sentence be automatically tcolorboxed this way?
\end{document}

• Aug 17, 2021 at 17:29
• @leandriis, Thanks for the pointers. I did check related questions and answers (including these two) before posting my question. Aug 17, 2021 at 17:57
• Since you already went through the construction of the two boxes with the mirrored corners, adding \ul{..} inside is the simplest solution! Aug 17, 2021 at 18:03
• There is also tex.stackexchange.com/a/125319/89417 and tex.stackexchange.com/questions/251182/… that may come close. Both don't have the outline but that might be considered an advantage given that the lines in your example end up very far apart due to the height of the tcolorbox. Aug 17, 2021 at 20:09
• @SimonDispa, Great. I will think about your suggestion. Aug 18, 2021 at 14:11