\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}
我想制作一个黑色圆角矩形文本框,里面有白色文字。我在 tex.stackexchange.com 上搜索后,找到了上面的代码。但是,如果文本太长,它无法换行。如何换行?
笔记:
我希望框是圆角矩形,并且一行与下一行之间没有空格。
答案1
像这样?
它是一个tcolorbox
而不是一个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}
答案2
答案3
带有小页面
\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}