
나는 검은색 텍스트가 있는 녹색 텍스트 상자를 만들기 위해 "color" 패키지를 사용하고 있으며 내 코드는 다음과 같습니다.
\textbf{\fcolorbox{black}{green!30}{black text on a boxed green background}}
줄 바꿈하려면 어떻게 해야 합니까?
'fcolorbox'로 래핑할 수 없는 경우 동일한 효과를 갖는 명령은 무엇이며 래핑하시겠습니까?
답변1
제가 가장 좋아하는 패키지 중 하나를 제안합니다.tcolorbox
\documentclass{article}
\usepackage{tcolorbox}
% A new `\tcbox` command
\newtcbox{\highlight}[0]{boxsep=0pt,left=0pt,top=0pt,bottom=0pt,right=0pt,boxrule=0pt,arc=0pt,auto outer arc,colback=green,width=6cm}
\begin{document}
\highlight{black text on a boxed green background}
\begin{tcolorbox}[width=6cm,colback=green]
black text on a boxed green background
\end{tcolorbox}
\begin{tcolorbox}[width=6cm,colback=green,boxrule=5pt]
black text on a boxed green background
\end{tcolorbox}
\begin{tcolorbox}[width=6cm,colback=green,arc=0pt,auto outer arc]
black text on a boxed green background
\end{tcolorbox}
\end{document}
답변2
\fcolorbox
\fbox
or 는 \mbox
수평(LR) 상자를 만들기 때문에 다음이 필요합니다.
\textbf{\fcolorbox{black}{green!30}{%
\parbox{3cm}{black text on a boxed green background}}}
3cm
필요한 너비로 교체하십시오 .