我想应用以下阴影效果
在“中提出假床单效果“作为 mdframed 环境的背景。如何实现呢?
答案1
这是我只修改第一帧的建议:
\documentclass{article}
\usepackage{kantlipsum}
\usepackage[framemethod=tikz]{mdframed}
\usetikzlibrary{calc}
\mdfdefinestyle{fakesheet}{%
backgroundcolor=gray!15,
middlelinecolor=gray!15,
roundcorner=15pt,
singleextra={%
\fill[gray!60,rounded corners,]
($(P)+(0,-2.05)$) .. controls ($(P)+(0.14,-0.55)$) .. ($(P)+(0.16,-0.45)$) -- ($(P)+(-0.2,-0.4)$) -- cycle;
\draw[gray!15,line width=0.20cm] ($(P)+(-.1,-2.15)$) -- ($(P)+(-.1,-.4)$) ;
\path let \p1=(P), \p2=(O) in ({(\x1-\x2)/2},\y2) coordinate (M);
\shade[left color=gray!50,right color=gray!50,middle color=black!55,rounded corners]
($(M)+(-5.4,-0.135)$) .. controls ($(M)+(0,-0.015)$) .. ($(M)+(5.4,-0.135)$) -- ($(M)+(5.4,0.135)$) .. controls ($(M)+(0,0.135)$) .. ($(M)+(-5.4,0.135)$)-- cycle;
\draw[gray!15,line width=0.20cm] ($(M)+(-5.4,0.10)$) -- ($(M)+(5.4,0.1)$) ;
}
}
\newmdenv[style=fakesheet]{shadeenv}
\begin{document}
\kant[1]
\begin{shadeenv}
\kant[2]
\end{shadeenv}
\end{document}
可以通过选项singleextra
firstextra
等添加额外材料。例如请参见此处: