将 newtcolorbox 的代码更改为 posterbox (tcbposter)

将 newtcolorbox 的代码更改为 posterbox (tcbposter)

我想在链接中使用漂亮的盒子:带有精美色彩的盒子

在这篇文章中,这段代码是由 newtcolorbox 定义的。你能把这段代码转移到 posterbox 吗,所以我需要创建一些框:不同的标题、不同的大小和不同的位置。一个框包含 3 列。

梅威瑟:

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

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


\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{bidentidad}
\lipsum[4]
\end{bidentidad}

\end{document}

非常感谢

答案1

您必须将所有newtcolorbox参数定义为一种tcbset样式,并在以下位置使用此样式作为选项posterbox

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

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

\tcbset{
    bidentidad/.style={
        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={#1},
    }
}

\begin{document}


\begin{tcbposter}[%
    poster={columns=3, rows=3},
    ]
    \posterbox[bidentidad=First Box]{name=A, column=1}{\lipsum[4]}
    \posterbox[bidentidad=Second Box]{name=B, column=1, column=2}{\lipsum[2]}
    \posterbox[bidentidad=Third Box]{name=C, column=1, column=3}{\lipsum[3]}
\end{tcbposter}

\end{document}

在此处输入图片描述

相关内容