1 Star 0 Fork 0

Sophanatprime/SomeTeXMacro

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
tcbstyle1.tex 11.57 KB
一键复制 编辑 原始数据 按行查看 历史
Sophanatprime 提交于 2023-04-08 00:12 +08:00 . update style/tcbstyle1.tex.
\definecolor{framegolden}{HTML}{455a64} % 控制外框颜色
\definecolor{framegray}{HTML}{e0e0e0} % 控制填充颜色
\newdimen\ys@frame@linewidth
\newdimen\ys@frame@radius
\newdimen\ys@frame@sep
\def\ys@frame@fill@opacity{0.2}
\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}}
\def\ys@frame@star@list@t{%
-0.7071\ys@frame@radius+0.2133\ys@frame@sep/%
-0.7071\ys@frame@radius+0.2133\ys@frame@sep/%
frame.north east,%
0.7071\ys@frame@radius-0.2133\ys@frame@sep/%
-0.7071\ys@frame@radius+0.2133\ys@frame@sep/%
frame.north west}
\def\ys@frame@star@list@b{%
0.7071\ys@frame@radius-0.2133\ys@frame@sep/%
0.7071\ys@frame@radius-0.2133\ys@frame@sep/%
frame.south west,%
-0.7071\ys@frame@radius+0.2133\ys@frame@sep/%
0.7071\ys@frame@radius-0.2133\ys@frame@sep/%
frame.south east}
\edef\ys@frame@star@list{\ys@frame@star@list@t,\ys@frame@star@list@b}
%region outer
\def\ys@frame@remove@middleline#1#2{}
\def\ys@frame@draw@middleline#1#2{%
\clip ([xshift=-\ys@frame@linewidth,#1]frame.north west)--
([xshift=\ys@frame@linewidth,#1]frame.north east)--
([xshift=\ys@frame@linewidth,#2]frame.south east)--
([xshift=-\ys@frame@linewidth,#2]frame.south west)--cycle;}
\def\ys@frame@unbrokenouter{%
\path[draw=framegolden,fill=framegray,fill opacity=\ys@frame@fill@opacity,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;}
\def\ys@frame@firstouter{%
\ys@frame@remove@middleline{yshift=.5\ys@frame@linewidth}{yshift=.7\ys@frame@linewidth}%
\path[draw=framegolden,fill=framegray,fill opacity=\ys@frame@fill@opacity,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)--
(frame.south east)--
(frame.south west)--
([yshift=-\ys@frame@radius]frame.north west)
arc(-90:0:\ys@frame@radius)--cycle;}
\def\ys@frame@middleouter{%
\ys@frame@remove@middleline{yshift=-.7\ys@frame@linewidth}{yshift=.7\ys@frame@linewidth}%
\path[draw=framegolden,fill=framegray,fill opacity=\ys@frame@fill@opacity,line width=\ys@frame@linewidth]
(frame.north west)--(frame.north east)--(frame.south east)--
(frame.south west)--cycle;}
\def\ys@frame@lastouter{%
\ys@frame@remove@middleline{yshift=-.7\ys@frame@linewidth}{yshift=-.5\ys@frame@linewidth}%
\path[draw=framegolden,fill=framegray,fill opacity=\ys@frame@fill@opacity,line width=\ys@frame@linewidth]
(frame.north west)--(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)--
(frame.north west)--cycle;}
%endregion
%region inner
\def\ys@frame@unbrokeninner{%
\path[draw=framegolden,line width=.8\ys@frame@linewidth,line cap=round]
([xshift=\ys@frame@radius+2\ys@frame@linewidth,yshift=-\ys@frame@sep]frame.north west)
--([xshift=-\ys@frame@radius-2\ys@frame@linewidth,yshift=-\ys@frame@sep]frame.north east)
([yshift=-\ys@frame@radius-2\ys@frame@linewidth,xshift=-\ys@frame@sep]frame.north east)
--([yshift=\ys@frame@radius+2\ys@frame@linewidth,xshift=-\ys@frame@sep]frame.south east)
([xshift=\ys@frame@radius+2\ys@frame@linewidth,yshift=\ys@frame@sep]frame.south west)
--([xshift=-\ys@frame@radius-2\ys@frame@linewidth,yshift=\ys@frame@sep]frame.south east)
([yshift=-\ys@frame@radius-2\ys@frame@linewidth,xshift=\ys@frame@sep]frame.north west)
--([yshift=\ys@frame@radius+2\ys@frame@linewidth,xshift=\ys@frame@sep]frame.south west);}
\def\ys@frame@firstinner{%
\path[draw=framegolden,line width=.8\ys@frame@linewidth,line cap=round]
([xshift=\ys@frame@radius+2\ys@frame@linewidth,yshift=-\ys@frame@sep]frame.north west)
--([xshift=-\ys@frame@radius-2\ys@frame@linewidth,yshift=-\ys@frame@sep]frame.north east)
([yshift=-\ys@frame@radius-2\ys@frame@linewidth,xshift=-\ys@frame@sep]frame.north east)
--([xshift=-\ys@frame@sep]frame.south east)
([yshift=-\ys@frame@radius-2\ys@frame@linewidth,xshift=\ys@frame@sep]frame.north west)
--([xshift=\ys@frame@sep]frame.south west);}
\def\ys@frame@middleinner{%
\path[draw=framegolden,line width=.8\ys@frame@linewidth,line cap=round]
([xshift=-\ys@frame@sep]frame.north east)--([xshift=-\ys@frame@sep]frame.south east)
([xshift=\ys@frame@sep]frame.north west)--([xshift=\ys@frame@sep]frame.south west);}
\def\ys@frame@lastinner{%
\path[draw=framegolden,line width=.8\ys@frame@linewidth,line cap=round]
([xshift=-\ys@frame@sep]frame.north east)
--([yshift=\ys@frame@radius+2\ys@frame@linewidth,xshift=-\ys@frame@sep]frame.south east)
([xshift=\ys@frame@radius+2\ys@frame@linewidth,yshift=\ys@frame@sep]frame.south west)
--([xshift=-\ys@frame@radius-2\ys@frame@linewidth,yshift=\ys@frame@sep]frame.south east)
([xshift=\ys@frame@sep]frame.north west)
--([yshift=\ys@frame@radius+2\ys@frame@linewidth,xshift=\ys@frame@sep]frame.south west);}
%endregion
%region corner
\def\ys@frame@unbrokencorner{%
\path[draw=framegolden,line width=1.5\ys@frame@linewidth,line cap=round]
([xshift=\ys@frame@radius-2.7\ys@frame@linewidth,yshift=-\ys@frame@sep]frame.north west)
--([xshift=\ys@frame@sep,yshift=-\ys@frame@sep]frame.north west)
--([xshift=\ys@frame@sep,yshift=-\ys@frame@radius+2.7\ys@frame@linewidth]frame.north west)
([xshift=-\ys@frame@radius+2.7\ys@frame@linewidth,yshift=-\ys@frame@sep]frame.north east)
--([xshift=-\ys@frame@sep,yshift=-\ys@frame@sep]frame.north east)
--([xshift=-\ys@frame@sep,yshift=-\ys@frame@radius+2.7\ys@frame@linewidth]frame.north east)
([xshift=-\ys@frame@radius+2.7\ys@frame@linewidth,yshift=\ys@frame@sep]frame.south east)
--([xshift=-\ys@frame@sep,yshift=\ys@frame@sep]frame.south east)
--([xshift=-\ys@frame@sep,yshift=\ys@frame@radius-2.7\ys@frame@linewidth]frame.south east)
([xshift=\ys@frame@radius-2.7\ys@frame@linewidth,yshift=\ys@frame@sep]frame.south west)
--([xshift=\ys@frame@sep,yshift=\ys@frame@sep]frame.south west)
--([xshift=\ys@frame@sep,yshift=\ys@frame@radius-2.7\ys@frame@linewidth]frame.south west);}
\def\ys@frame@firstcorner{%
\path[draw=framegolden,line width=1.5\ys@frame@linewidth,line cap=round]
([xshift=\ys@frame@radius-2.7\ys@frame@linewidth,yshift=-\ys@frame@sep]frame.north west)
--([xshift=\ys@frame@sep,yshift=-\ys@frame@sep]frame.north west)
--([xshift=\ys@frame@sep,yshift=-\ys@frame@radius+2.7\ys@frame@linewidth]frame.north west)
([xshift=-\ys@frame@radius+2.7\ys@frame@linewidth,yshift=-\ys@frame@sep]frame.north east)
--([xshift=-\ys@frame@sep,yshift=-\ys@frame@sep]frame.north east)
--([xshift=-\ys@frame@sep,yshift=-\ys@frame@radius+2.7\ys@frame@linewidth]frame.north east);}
\def\ys@frame@middlecorner{}
\def\ys@frame@lastcorner{%
\path[draw=framegolden,line width=1.5\ys@frame@linewidth,line cap=round]
([xshift=-\ys@frame@radius+2.7\ys@frame@linewidth,yshift=\ys@frame@sep]frame.south east)
--([xshift=-\ys@frame@sep,yshift=\ys@frame@sep]frame.south east)
--([xshift=-\ys@frame@sep,yshift=\ys@frame@radius-2.7\ys@frame@linewidth]frame.south east)
([xshift=\ys@frame@radius-2.7\ys@frame@linewidth,yshift=\ys@frame@sep]frame.south west)
--([xshift=\ys@frame@sep,yshift=\ys@frame@sep]frame.south west)
--([xshift=\ys@frame@sep,yshift=\ys@frame@radius-2.7\ys@frame@linewidth]frame.south west);}
%endregion
\def\ys@frame@star#1#2#3{%
\begin{scope}[shift={([xshift=#1,yshift=#2]#3)},scale=\ys@frame@ratio*0.1]
\path[draw=framegolden,fill=white,
line width=.7\ys@frame@linewidth,line join=round]
(1,1)..controls(0.3,0.5) and (-0.3,0.5)..
(-1,1)..controls(-0.5,0.3) and (-0.5,-0.3)..
(-1,-1)..controls(-0.3,-0.5) and (0.3,-0.5)..
(1,-1)..controls(0.5,-0.3) and (0.5,0.3)..(1,1)--cycle;
\path[scale=0.45,fill=framegolden,line join=round]
(1,1)..controls(0.3,0.7) and (-0.3,0.7)..
(-1,1)..controls(-0.7,0.3) and (-0.7,-0.3)..
(-1,-1)..controls(-0.3,-0.7) and (0.3,-0.7)..
(1,-1)..controls(0.7,-0.3) and (0.7,0.3)..(1,1)--cycle;
\end{scope}}
\def\ys@frame@segmentation{%
\draw[color=framegolden,path fading=ys circle]
([xshift=5\ys@frame@radius]segmentation.west) to[ornament=88]
([xshift=-5\ys@frame@radius]segmentation.east);}
\tcbset{
% 控制是否在断点处的线不画出来
ys/frame/not at break/.code=\let\ys@frame@remove@middleline\ys@frame@draw@middleline,
ys/frame/fill opacity/.store in=\ys@frame@fill@opacity,
ys/frame/draw at break/.code=\let\ys@frame@remove@middleline\@gobbletwo,
% 控制线宽
ys/frame/line width/.code={\pgfmathsetlength\ys@frame@linewidth{#1}},
ys/frame/line width=1.4pt,
% 控制圆弧大小,应为数字,而非长度
ys/frame/radius/.code={\pgfmathparse{#1}\let\ys@frame@ratio\pgfmathresult
\pgfmathsetlength\ys@frame@radius{(#1)*1em}%
\pgfmathsetlength\ys@frame@sep{(#1)*0.5ex}},
ys/frame/radius=2,
ys/frame/unbroken/.style={
interior code={%
\ys@frame@unbrokenouter % 外框
\foreach \ii/\jj/\kk in \ys@frame@star@list {\ys@frame@star{\ii}{\jj}{\kk}} % 星
\ys@frame@unbrokeninner % 内线
\ys@frame@unbrokencorner % 四角
},
interior titled code={%
\ys@frame@unbrokenouter % 外框
\foreach \ii/\jj/\kk in \ys@frame@star@list {\ys@frame@star{\ii}{\jj}{\kk}} % 星
\ys@frame@unbrokeninner % 内线
\ys@frame@unbrokencorner % 四角
}
},
ys/frame/first/.style={
interior code={%
\ys@frame@firstouter
\foreach \ii/\jj/\kk in \ys@frame@star@list@t {\ys@frame@star{\ii}{\jj}{\kk}}
\ys@frame@firstinner
\ys@frame@firstcorner},
interior titled code={%
\ys@frame@firstouter
\foreach \ii/\jj/\kk in \ys@frame@star@list@t {\ys@frame@star{\ii}{\jj}{\kk}}
\ys@frame@firstinner
\ys@frame@firstcorner},
},
ys/frame/middle/.style={
interior code={%
\ys@frame@middleouter
\ys@frame@middleinner
\ys@frame@middlecorner}
},
ys/frame/last/.style={
interior code={%
\ys@frame@lastouter
\foreach \ii/\jj/\kk in \ys@frame@star@list@b {\ys@frame@star{\ii}{\jj}{\kk}}
\ys@frame@lastinner
\ys@frame@lastcorner}
},
ys/frame style/unbroken/.style={
boxsep=2\ys@frame@sep,
left={.8\ys@frame@radius},right={.8\ys@frame@radius},
ys/frame/unbroken,title hidden,
segmentation code=\ys@frame@segmentation
},
ys/frame style/first/.style={ys/frame/first,title hidden,segmentation code=\ys@frame@segmentation},
ys/frame style/middle/.style={ys/frame/middle,segmentation code=\ys@frame@segmentation},
ys/frame style/last/.style={ys/frame/last,segmentation code=\ys@frame@segmentation},
ys style/.style={frame hidden,
ys/frame style/unbroken,
extras first={ys/frame style/first},
extras middle={ys/frame style/middle},
extras last={ys/frame style/last},
},
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Sophanatprime/SomeTeXMacro.git
git@gitee.com:Sophanatprime/SomeTeXMacro.git
Sophanatprime
SomeTeXMacro
SomeTeXMacro
main

搜索帮助