使用 tcolorbox
,实现了一部分,四个星的内部还要着色有点麻烦。
\documentclass{ctexart}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, calc, fadings, decorations.markings}
\usepackage{pgfornament}
\usepackage[many]{tcolorbox}
\makeatletter
\definecolor{framegolden}{HTML}{FFA500}
\definecolor{framegray}{HTML}{302E22}
\newdimen\ys@frame@linewidth
\newdimen\ys@frame@radius
\pgfdeclarehorizontalshading{ys@fade@circle}{500bp}
{color(0bp)=(pgftransparent!100); color(25bp)=(pgftransparent!100);
color(45bp)=(pgftransparent!0); color(55bp)=(pgftransparent!0);
color(75bp)=(pgftransparent!100); color(100bp)=(pgftransparent!100)}
\pgfdeclarefading{ys circle}{\pgfuseshading{ys@fade@circle}}
\tcbset{
ys/frame/line width/.code={\pgfmathsetlength\ys@frame@linewidth{#1}},
ys/frame/line width=1.4pt,
ys/frame/radius/.code={\pgfmathsetlength\ys@frame@radius{(#1)*1em}},
ys/frame/radius=2,
ys/frame style/.style={
interior code={
% 外框
\path[draw=framegolden,fill=framegray,fill opacity=.2,line width=\ys@frame@linewidth]
([xshift=\ys@frame@radius]frame.north west)--([xshift=-\ys@frame@radius]frame.north east)
arc(-180:-90:\ys@frame@radius)--
([yshift=-\ys@frame@radius]frame.north east)--([yshift=\ys@frame@radius]frame.south east)
arc(90:180:\ys@frame@radius)--
([xshift=-\ys@frame@radius]frame.south east)--([xshift=\ys@frame@radius]frame.south west)
arc(0:90:\ys@frame@radius)--
([yshift=\ys@frame@radius]frame.south west)--([yshift=-\ys@frame@radius]frame.north west)
arc(-90:0:\ys@frame@radius)--cycle;
% 内线
\path[draw=framegolden,line width=.8\ys@frame@linewidth,line cap=round]
([xshift=\ys@frame@radius+2\ys@frame@linewidth,yshift=-1ex]frame.north west)
--([xshift=-\ys@frame@radius-2\ys@frame@linewidth,yshift=-1ex]frame.north east)
([yshift=-\ys@frame@radius-2\ys@frame@linewidth,xshift=-1ex]frame.north east)
--([yshift=\ys@frame@radius+2\ys@frame@linewidth,xshift=-1ex]frame.south east)
([xshift=\ys@frame@radius+2\ys@frame@linewidth,yshift=1ex]frame.south west)
--([xshift=-\ys@frame@radius-2\ys@frame@linewidth,yshift=1ex]frame.south east)
([yshift=-\ys@frame@radius-2\ys@frame@linewidth,xshift=1ex]frame.north west)
--([yshift=\ys@frame@radius+2\ys@frame@linewidth,xshift=1ex]frame.south west);
% 四角
\path[draw=framegolden,line width=1.5\ys@frame@linewidth,line cap=round]
([xshift=\ys@frame@radius-2.7\ys@frame@linewidth,yshift=-1ex]frame.north west)
--([xshift=1ex,yshift=-1ex]frame.north west)
--([xshift=1ex,yshift=-\ys@frame@radius+2.7\ys@frame@linewidth]frame.north west)
([xshift=-\ys@frame@radius+2.7\ys@frame@linewidth,yshift=-1ex]frame.north east)
--([xshift=-1ex,yshift=-1ex]frame.north east)
--([xshift=-1ex,yshift=-\ys@frame@radius+2.7\ys@frame@linewidth]frame.north east)
([xshift=-\ys@frame@radius+2.7\ys@frame@linewidth,yshift=1ex]frame.south east)
--([xshift=-1ex,yshift=1ex]frame.south east)
--([xshift=-1ex,yshift=\ys@frame@radius-2.7\ys@frame@linewidth]frame.south east)
([xshift=\ys@frame@radius-2.7\ys@frame@linewidth,yshift=1ex]frame.south west)
--([xshift=1ex,yshift=1ex]frame.south west)
--([xshift=1ex,yshift=\ys@frame@radius-2.7\ys@frame@linewidth]frame.south west);
},
segmentation code={
\draw[color=framegolden,path fading=ys circle]
([xshift=5\ys@frame@radius]segmentation.west) to[ornament=88]([xshift=-5\ys@frame@radius]segmentation.east);
},
},
ys style/.style={frame hidden,ys/frame style},
}
\makeatother
\begin{document}
\begin{tcolorbox}[enhanced,ys style]
\centering
\medskip
{\zihao{-3}\bfseries 引蝶之章\ 第一幕}
\par\bigskip
{\zihao{2}\bfseries 奈何蝶飞去}
\par\medskip
\tcblower
\centering
\tcbox[enhanced,frame hidden,top=0pt,bottom=0pt,left=4.5em,right=4.5em,
interior code={\path[fill=framegolden,path fading=ys circle](interior.north west) rectangle (interior.south east);},
]{已开启}
\end{tcolorbox}
\end{document}
问 有偿定制文本框,用于定理类环境,或者单独的盒子也行!