带有精美色彩的盒子

带有精美色彩的盒子

有人知道如何创建这些吗?

在此处输入图片描述

在此处输入图片描述

我认为他们是使用 tcolorbox 制作的,但我找不到生成它们的方法。

答案1

一种可能性是:

在此处输入图片描述

代码:

\documentclass{article}
\usepackage[many]{tcolorbox}
\usepackage{lipsum}

\definecolor{bidentitlebg}{RGB}{158,59,255}

\newtcolorbox{ridentidad}[1][]{
  enhanced,
  frame code={
    \fill[draw=white,top color=white,bottom color=red!60]
      ([xshift=-20pt]title.north west) --
      (title.south west) --
      (title.south east) --
      ([xshift=20pt]title.north east) -- cycle;
    \draw[red,line width=0.4mm,rounded corners]
      (frame.north west) --
      (frame.south west) --
      ([xshift=-20pt]title.north west) --
      (title.south west) --
      (title.south east) --
      ([xshift=20pt]title.north east) --
      (frame.south east) --
      (frame.north east);
  },
  coltitle=red!70!black,
  colback=white,
  attach boxed title to bottom center,
  boxed title style={empty},
  fonttitle=\bfseries\sffamily,
  title=\strut Identidades,
  #1,
}

\newtcolorbox{bidentidad}[1][]{
  enhanced,
  skin=enhancedlast jigsaw,
  attach boxed title to top left={xshift=-4mm,yshift=-0.5mm},
  fonttitle=\bfseries\sffamily,
  colbacktitle=blue!45,
  colframe=red!50!black,
  interior style={
    top color=blue!10,
    bottom color=red!10
  },
  boxed title style={
    empty,
    arc=0pt,
    outer arc=0pt,
    boxrule=0pt
  },
  underlay boxed title={
    \fill[blue!45!white] 
      (title.north west) -- 
      (title.north east) -- 
      +(\tcboxedtitleheight-1mm,-\tcboxedtitleheight+1mm) -- 
      ([xshift=4mm,yshift=0.5mm]frame.north east) -- 
      +(0mm,-1mm) -- 
      (title.south west) -- cycle;
    \fill[blue!45!white!50!black] 
      ([yshift=-0.5mm]frame.north west) -- 
      +(-0.4,0) -- 
      +(0,-0.3) -- cycle;
    \fill[blue!45!white!50!black] 
      ([yshift=-0.5mm]frame.north east) -- 
      +(0,-0.3) -- 
      +(0.4,0) -- cycle; 
  },
  title={Identidades},
  #1
}

\begin{document}

\begin{ridentidad}
\lipsum[4]
\end{ridentidad}

\begin{bidentidad}
\lipsum[4]
\end{bidentidad}

\end{document}

第二个代码直接取自手册第 133 页tcolorbox

答案2

在此处输入图片描述

相同代码修改如下:

\documentclass{article}
\usepackage[many]{tcolorbox}
\usepackage{lipsum}

\definecolor{bidentitlebg}{RGB}{158,59,255}

\newtcolorbox{ridentidad}[1][]{
  enhanced,
  frame code={
    \fill[draw=white,top color=red!60,bottom color=white]
      ([xshift=-20pt]title.south west) --
      (title.north west) --
      (title.north east) --
      ([xshift=20pt]title.south east) -- cycle;
    \draw[red,line width=0.4mm,rounded corners]
      (frame.south west) --
      (frame.north west) --
      ([xshift=-20pt]title.south west) --
      (title.north west) --
      (title.north east) --
      ([xshift=20pt]title.south east) --
      (frame.north east) --
      (frame.south east);
  },
  coltitle=red!70!black,
  colback=white,
  attach boxed title to top center,
  boxed title style={empty},
  fonttitle=\bfseries\sffamily,
  title=\strut Identidades,
  #1,
}

\newtcolorbox{bidentidad}[1][]{
  enhanced,
  skin=enhancedlast jigsaw,
  attach boxed title to top left={xshift=-4mm,yshift=-0.5mm},
  fonttitle=\bfseries\sffamily,
  colbacktitle=blue!45,
  colframe=red!50!black,
  interior style={
    top color=blue!10,
    bottom color=red!10
  },
  boxed title style={
    empty,
    arc=0pt,
    outer arc=0pt,
    boxrule=0pt
  },
  underlay boxed title={
    \fill[blue!45!white] 
      (title.north west) -- 
      (title.north east) -- 
      +(\tcboxedtitleheight-1mm,-\tcboxedtitleheight+1mm) -- 
      ([xshift=4mm,yshift=0.5mm]frame.north east) -- 
      +(0mm,-1mm) -- 
      (title.south west) -- cycle;
    \fill[blue!45!white!50!black] 
      ([yshift=-0.5mm]frame.north west) -- 
      +(-0.4,0) -- 
      +(0,-0.3) -- cycle;
    \fill[blue!45!white!50!black] 
      ([yshift=-0.5mm]frame.north east) -- 
      +(0,-0.3) -- 
      +(0.4,0) -- cycle; 
  },
  title={Identidades},
  #1
}

\begin{document}

\begin{ridentidad}
\lipsum[4]
\end{ridentidad}

\begin{bidentidad}
\lipsum[4]
\end{bidentidad}

\end{document}

相关内容