使用 tcolorbox 创建的框架添加了白孔

使用 tcolorbox 创建的框架添加了白孔

考虑这个问题在右下角添加带有阴影的折痕有了好心用户@Ignasi 的回答,以及@John Kormylo、@Cicada 和@Ignasi 最近对 的使用的评论overpic

在此处输入图片描述

\documentclass{article}
\usepackage[most]{tcolorbox}
\usepackage{pifont}
\newtcolorbox{mybox}[2][]{%
    colback=teal!10,
    coltitle=black,
    colframe=teal!30,
    fonttitle=\bfseries,
    title=#2, 
    sharp corners,
    rounded corners=southeast,
    arc is angular,
    arc=3mm,
    boxrule=0pt,
    enhanced,
    overlay={\node[font=\Huge, text=cyan!70!black] at ([yshift=-4mm]interior.north west) {\ding{228}};},
    underlay={
        \path[fill=tcbcolback!80!black] ([yshift=3mm]interior.south east)--++(-0.4,-0.1)--++(0.1,-0.2);
        \path[draw=tcbcolframe,shorten <=-0.05mm,shorten >=-0.05mm] ([yshift=3mm]interior.south east)--++(-0.4,-0.1)--++(0.1,-0.2);
    },
    drop fuzzy shadow,
    #1
    }

\usepackage{lipsum}
\begin{document}
\begin{mybox}{An example}
\lipsum[1]
\end{mybox}
\end{document}

如果可以的话,可以轻松地编辑 MWE(具有与第一幅图像相同的结构),在底部增加折痕,并像本图一样有白孔,而无需更改格式和符号ding

在此处输入图片描述

答案1

这里使用了tcolorbox选项。interior titled code app={<tikz code>}

\documentclass{article}
\usepackage[most]{tcolorbox}
\usetikzlibrary{calc}
\usepackage{pifont}

\makeatletter
\newtcolorbox{mybox}[2][]{%
    colback=teal!10,
    coltitle=black,
    colframe=teal!30,
    fonttitle=\bfseries,
    title=#2, 
    sharp corners,
    rounded corners=southeast,
    arc is angular,
    arc=3mm,
    boxrule=0pt,
    enhanced,
    overlay={
        \node[font=\Huge, text=cyan!70!black] at ([yshift=-4mm]interior.north west) {\ding{228}};
    },
    underlay={
        \path[fill=tcbcolback!80!black] ([yshift=3mm]interior.south east) -- ++(-0.4,-0.1) -- ++(0.1,-0.2);
        \path[draw=tcbcolframe,shorten <=-0.05mm,shorten >=-0.05mm] ([yshift=3mm]interior.south east) -- ++(-0.4,-0.1) -- ++(0.1,-0.2);
    },
    interior titled code app={
        \path[save path=\mytcb@dots]
          let \p1=($(interior.north) - (interior.south)$),
              \n{r}={\kvtcb@leftupper+\kvtcb@boxsep},
              \n1={int(scalar((\y1)/5mm))},
          in
            ([xshift=.5*\n{r},yshift=-\n{r}+2.5mm]interior.south west)
            foreach \i in {1, 2, ..., \n1} {
              ++(0mm, +5mm) circle (.23*\n{r})
            };
         \begin{scope}
            \clip[use path=\mytcb@dots];
            \fill[black, opacity=0.25, use path=\mytcb@dots];
            \fill[white, transform canvas={xshift=.3mm,yshift=-.3mm}, use path=\mytcb@dots];
         \end{scope}
    },
    drop fuzzy shadow,
    #1
}
\makeatother

\usepackage{lipsum}
\begin{document}
\begin{mybox}{An example}
\lipsum[1]
\end{mybox}
\end{document}

在此处输入图片描述

相关内容