1
\documentclass{article}
\usepackage[most]{tcolorbox}
\tcbset{ 
    boxsep=4pt, left=0pt,right=0pt,top=0pt,bottom=0pt,
    colframe=white,colback=black,  
    highlight math style={enhanced}
}
\begin{document}
        \noindent\tcbox{\textcolor{white}{Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello }}
\end{document}

I want make black rounded rectangle textbox with white text inside. After I search in tex.stackexchange.com, I found code above. But, if the text is too long, it cannot break into next line. How to break it?

enter image description here

NOTE:

I want the box is rounded rectangle and no white space between one line into next line.

2

3 Answers 3

2

Like this?

enter image description here

It's a tcolorbox instead of a tcbox

\documentclass{article}
\usepackage[most]{tcolorbox}
\tcbset{ 
    boxsep=4pt, left=0pt,right=0pt,top=0pt,bottom=0pt,
    colframe=white,colback=black,  
    highlight math style={enhanced}
}
\begin{document}
   \begin{tcolorbox}[colupper=white]Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello 
   \end{tcolorbox}
\end{document}
0

You can use the soul package for this:

\documentclass{article}
\usepackage{xcolor,soul}
\sethlcolor{black}

\begin{document}
        \noindent{\color{white}\hl{Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello }}
\end{document}

enter image description here

1
  • I want the box is rounded rectangle and no white space between one line into next line. Apr 11, 2022 at 12:12
0

With minipage

    \documentclass{article}
    \usepackage[most]{tcolorbox}
    \tcbset{ 
        boxsep=4pt, left=0pt,right=0pt,top=0pt,bottom=0pt,
        colframe=white,colback=black,  
        highlight math style={enhanced}
    }
    \begin{document}
    \noindent\tcbox{%
        \begin{minipage}{\linewidth}
            \textcolor{white}{Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello }
        \end{minipage}%
    }
    \end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .