我使用框架包(\usepackage{framed}
)定义了一个阴影环境,并且我想为阴影区域添加边框,我该怎么做?
例如,如何在此示例中添加边框?
\documentclass{article}
\usepackage{xcolor}
\usepackage{framed}
\definecolor{shadecolor}{rgb}{1,0,0}
\begin{document}
\begin{shaded*}
Let me have a background :(
\end{shaded*}
\end{document}
答案1
使用\renewenvironment
来\colorbox
替换\fcolorbox
:
\documentclass{article}
\usepackage[svgnames]{xcolor}
\usepackage{framed}
\colorlet{shadecolor}{Pink!50}
\colorlet{framecolor}{IndianRed}
\renewenvironment{shaded*}{%
\def\FrameCommand{\setlength{\FrameRule}{2pt}\fboxsep=\FrameSep \fcolorbox{framecolor}{shadecolor}}%
\MakeFramed {\advance\hsize-\width \FrameRestore}}%
{\endMakeFramed}
\begin{document}
\begin{shaded*}
Let me have a background :(
\end{shaded*}
\end{document}