我想要得到如图所示的效果。框的上下边框是可选的。我试过了\colorbox
,但不起作用。
\documentclass{report}
\usepackage{color}
\definecolor{bg}{RGB}{255,249,227}
%\usepackage[most]{tcolorbox}
\begin{document}
Following are some items:
\colorbox{bg}{\begin{itemize}
\item Item 1
\item Item 2
\item Item 3
\end{itemize}
}
\end{document}
答案1
使用tcolorbox
。
\documentclass{article}
\usepackage{lipsum}
\usepackage[most]{tcolorbox}
\definecolor{bg}{RGB}{255,249,227}
\begin{document}
\lipsum[1]
\begin{tcolorbox}[enhanced jigsaw,colback=bg,boxrule=0pt,arc=0pt]
\begin{itemize}
\item Item 1
\item Item 2
\item Item 3
\end{itemize}
\end{tcolorbox}
\end{document}
带有上线和下线:
\documentclass{article}
\usepackage{lipsum}
\usepackage[most]{tcolorbox}
\definecolor{bg}{RGB}{255,249,227}
\newtcolorbox{mybox}[1][]{%
enhanced jigsaw,
%oversize,
colback=bg,
boxrule=0pt,
overlay unbroken and first ={%
\draw[line width=0.2pt,double=bg,draw=bg!70!black,
double distance=1pt,] (frame.north west) -- (frame.north east);
\draw[line width=0.2pt,double=bg,draw=bg!70!black,
double distance=1pt,] (frame.south west) -- (frame.south east);},
breakable,
arc=0pt,outer arc=0pt,
#1}%
\begin{document}
\lipsum[1]
\begin{mybox}
\begin{itemize}
\item Item 1
\item Item 2
\item Item 3
\end{itemize}
\end{mybox}
\end{document}