6

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?

enter image description here

\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}
6

0

Your Answer

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

Browse other questions tagged or ask your own question.