100 有偿定制文本框,用于定理类环境,或者单独的盒子也行!

发布于 2022-07-27 08:26:20

偶然间看到了1210的问题无人问津,故而有此一问.请问,应该如何定制如下图的文本框,我苦思冥想良久,考虑了tcolorbox结合tkiz以及纯tikz这两种方案,都没办法实现,太棘手了,这是我能力问题,我的tikz太差了,不会用,故而想请问专家,这个文本框用latex能定制成功吗?我是实在没办法了,但是又很想要这个盒子,故而,我想有偿定制这个盒子,希望有能力的专家或者大佬能帮帮我!原盒子是原神游戏的弹窗,故而应该使用的HTML语言,所以真的很想知道tikz集合tcolorbox的实现方式.这个盒子典雅端庄,充满了中国文化气息,确实让我一眼就爱上了,虽然我不玩游戏.
原神弹窗盒子.png

查看更多

关注者
0
被浏览
1.4k
雾月
雾月 2022-07-27
这家伙很懒,什么也没写!

使用 tcolorbox,实现了一部分,四个星的内部还要着色有点麻烦。

image.png

\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}
3 个回答
鱼香肉丝没有鱼先生
脾气不好,别来惹我!!!

tikz 画了一下,可以自己搬到 tcolorbox 里面

\documentclass[margin=.5cm]{standalone}
\usepackage{tikz,ctex}
\usepackage{fontawesome5}
\usetikzlibrary{arrows.meta,calc}

\begin{document}

\begin{tikzpicture}[thick]
\draw[] (0.4,0) arc(0:90:0.4) -- (0,1.6) arc(-90:0:0.4) --(5.6,2) arc(180:270:0.4) --(6,0.4) arc(90:180:0.4) --cycle;


\foreach \x in {(45:0.382),($(0,2)+(-45:0.382)$),($(6,2)+(225:0.382)$),($(6,0)+(135:0.382)$)}
{
  \node[inner sep=0pt,] at \x 
  {
   \begin{tikzpicture}
    \draw[fill=white,thick,rotate=45,line join=round,x=0.12cm,y=0.12cm] (1,0) to [out=180,in=-90] (0,1) to [out=-90,in=0] (-1,0) to[out=0,in=90] (0,-1) to[out=90,in=180] (1,0)--cycle;
   \end{tikzpicture}
  };
}

\draw[] (0.3,0.075) -| (0.075,0.3);
\draw[] (0.075,1.7) |- (0.3,2-0.075);
\draw[] (5.7,2-0.075) -| (6-0.075,1.7);
\draw[] (6-0.075,0.3) |- (5.7,0.075);

\draw[] (0.075,0.5) -- (0.075,1.5);
\draw[] (0.5,2-0.075) -- (5.5,2-0.075);
\draw[] (6-0.075,1.5) -- (6-0.075,0.5);
\draw[] (5.5,0.075) -- (0.5,0.075);


\node[font=\kaishu\bfseries] at (3,1.1) {奈何蝶飞去};
\node[font=\kaishu\bfseries,scale=0.6] at (3,1.5) {引蝶之章 第一幕};
\draw[line cap=round] (2,0.8) -- (4,0.8)node[midway,fill=white,inner sep=2pt,scale=0.6]{\faGg};

\node[font=\kaishu\bfseries,scale=0.6] at (3,0.45){已开启};
\end{tikzpicture}

\end{document}

QQ截图20220727100628.png

另外,楼上@u40 啸行的答案很有参考性!!!

啸行
啸行 2022-07-27
这家伙很懒,什么也没写!

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览