Tcolorbox:标题框的圆角

Tcolorbox:标题框的圆角

我制作了一个盒子,tcolorbox如下所示: 在此处输入图片描述

不过,我希望“标题框”有圆角(与大框的直径相同)仅有的在左上角和右下角。我想保持右上角和左下角清晰(原样)。我该怎么做?

在此处输入图片描述

以下是 MWE:

\documentclass{article}
\usepackage[most]{tcolorbox}
\usepackage{tikz, adjustbox}
\usepackage{xcolor}

\definecolor{background_color}{rgb}{0.95,0.95,0.95}
\definecolor{icons}{HTML}{46A247}

\newtcolorbox{emph_box}[1][]{%
    enhanced,
    before skip=2mm,after skip=2mm, 
    boxrule=0.6pt,
    colback=background_color, colframe=icons, % Colors
    attach boxed title to top left={xshift=0cm,yshift*=0mm-\tcboxedtitleheight},
    varwidth boxed title*=-3cm,
    % The titlebox:
    boxed title style={frame code={%
        \path[left color=icons,right color=icons,
        middle color=icons]
        ([xshift=-0mm]frame.north west) -- ([xshift=0mm]frame.north east)
        [rounded corners=0mm]-- ([xshift=0mm,yshift=0mm]frame.north east)
        -- (frame.south east) -- (frame.south west)
        -- ([xshift=0mm,yshift=0mm]frame.north west)
        [sharp corners]-- cycle;
        },interior engine=empty,
    },
    width=\textwidth,
    arc is curved,
    arc = 1.5mm,
    fonttitle=\bfseries, 
    title={#1}
}

\begin{document}

\begin{emph_box}[Title]
    Some text
\end{emph_box}

\end{document}

答案1

您可以逐个角地决定它应该是圆形的还是尖锐的,如下所示:

\documentclass{article}
\usepackage[most]{tcolorbox}
\usepackage{tikz, adjustbox}
\usepackage{xcolor}

\definecolor{background_color}{rgb}{0.95,0.95,0.95}
\definecolor{icons}{HTML}{46A247}

\newtcolorbox{emph_box}[1][]{%
    enhanced,
    before skip=2mm,after skip=2mm, 
    boxrule=0.6pt,
    colback=background_color, colframe=icons, % Colors
    attach boxed title to top left={xshift=0cm,yshift*=0mm-\tcboxedtitleheight},
    varwidth boxed title*=-3cm,
    % The titlebox:
    boxed title style={frame code={%
        \path[left color=icons,right color=icons, middle color=icons]
        (frame.north west) [sharp corners] -- 
        (frame.north east) [rounded corners=2mm] -- 
        (frame.south east) [sharp corners] -- 
        (frame.south west) [rounded corners=2mm] -- 
        cycle;
        },interior engine=empty,
    },
    width=\textwidth,
    arc is curved,
    arc = 1.5mm,
    fonttitle=\bfseries, 
    title={#1}
}

\begin{document}

\begin{emph_box}[Title]
    Some text
\end{emph_box}

\end{document}

在此处输入图片描述

答案2

标题框可以是,tcolorbox因此您可以应用类似的选项:

\documentclass{article}
\usepackage[most]{tcolorbox}
\usepackage{tikz, adjustbox}
\usepackage{xcolor}

\definecolor{background_color}{rgb}{0.95,0.95,0.95}
\definecolor{icons}{HTML}{46A247}

\newtcolorbox{emph_box}[1][]{%
    enhanced,
    before skip=2mm,after skip=2mm, 
    boxrule=0.6pt,
    colback=background_color, colframe=icons, % Colors
    attach boxed title to top left={xshift=0cm,yshift*=0mm-\tcboxedtitleheight},
    varwidth boxed title*=-3cm,
    % The titlebox:
%    boxed title style={frame code={%
%        \path[left color=icons,right color=icons,
%        middle color=icons]
%        ([xshift=-0mm]frame.north west) -- ([xshift=0mm]frame.north east)
%        [rounded corners=0mm]-- ([xshift=0mm,yshift=0mm]frame.north east)
%        -- (frame.south east) -- (frame.south west)
%        -- ([xshift=0mm,yshift=0mm]frame.north west)
%        [sharp corners]-- cycle;
%        },interior engine=empty,
%    },
     boxed title style={sharp corners=uphill, colback=icons},
    width=\textwidth,
    arc is curved,
    arc = 1.5mm,
    fonttitle=\bfseries, 
    title={#1}
}

\begin{document}

\begin{emph_box}[Title]
    Some text
\end{emph_box}

\end{document}

在此处输入图片描述

相关内容