0

From pre topic: style box with line

I want to use this box in tcbposter and i change it to tcbset (mystyle) but don't work

Minimal working code:

\documentclass{article}
\usepackage[left=1.0cm,right=0.3cm,top=0.5cm,bottom=0.5cm]{geometry}
\usepackage[most]{tcolorbox}
\tcbuselibrary{poster}
\newcounter{ic}
\usepackage{xcolor}
\usepackage{lipsum}
\newtcolorbox{Mybox}[2][]{%
enhanced,top=0mm,left=2pt,right=2pt,
enlarge top by=\baselineskip/2+1mm,
enlarge top at break by=0mm,pad at break=2mm,
fontupper=\normalsize,
  overlay unbroken and first={%
  \draw[fill=yellow]
   ([xshift=6pt,yshift=12pt]frame.north west) -| ++ (1,-2) 
   -- ++ (-0.5,0.3) -- ++ (-0.5,-0.3) -- cycle;
  \node[anchor=north west,text width=1cm-4pt,align=center] at ([xshift=6pt,yshift=12pt]frame.north west) 
  {#2}; 
},
breakable,arc=4mm,
%colframe=blue!80!red,colback=white,
width=\textwidth, 
before upper ={\parshape 5
1.2cm \dimexpr \hsize-1.2cm\relax
1.2cm \dimexpr \hsize-1.2cm\relax
1.2cm \dimexpr \hsize-1.2cm\relax
1.2cm \dimexpr \hsize-1.2cm\relax
0pt \hsize} ,#1}

\tcbset{
        mystyle/.style 2 args={%
        enhanced,top=0mm,left=2pt,right=2pt,
enlarge top by=\baselineskip/2+1mm,
enlarge top at break by=0mm,pad at break=2mm,
fontupper=\normalsize,
  overlay unbroken and first={%
  \draw[fill=yellow]
   ([xshift=6pt,yshift=12pt]frame.north west) -| ++ (1.6,-1.3) 
   -- ++ (-0.8,0.3) -- ++ (-0.8,-0.3) -- cycle;
  \node[anchor=north west,text width=1.6cm-4pt,align=center] at ([xshift=6pt,yshift=12pt]frame.north west) 
  {#2}; 
},
breakable,arc=4mm,
width=\textwidth,#1
%},
        #1,
    }
}

\begin{document}
\begin{Mybox}[width=5.4cm]{abc xyz}
some text some text some text some text some text some text some text some text

\end{Mybox}

\begin{tcbposter}[ poster = {columns=1, rows=3, height=14cm,width=12cm }]

%  \posterbox[colframe = red]{name=A}{\lipsum[1]}
\posterbox[colframe = red,height=5.0cm,width =4.3cm]{name=A}{abc xyz}
\posterbox[height=5.0cm,width =4.0cm, mystyle={colframe=red}{abc}]{xshift=1cm, yshift=-5cm}{xyz}
{some text some text some text some text some text some text some text some text}
\end{tcbposter}
\end{document}

Please help to change "tcbset - mystyle": can change colframe, name and x-y position, height & width of this box.

Thank in advance

1 Answer 1

1

Something like this?

\documentclass{article}
\usepackage[left=1.0cm,right=0.3cm,top=0.5cm,bottom=0.5cm]{geometry}
\usepackage[most]{tcolorbox}
\tcbuselibrary{poster}
\newcounter{ic}
\usepackage{xcolor}
\usepackage{lipsum}
\newtcolorbox{Mybox}[2][]{%
enhanced,top=0mm,left=2pt,right=2pt,
enlarge top by=\baselineskip/2+1mm,
enlarge top at break by=0mm,pad at break=2mm,
fontupper=\normalsize,
  overlay unbroken and first={%
  \draw[fill=yellow]
   ([xshift=6pt,yshift=12pt]frame.north west) -| ++ (1,-2) 
   -- ++ (-0.5,0.3) -- ++ (-0.5,-0.3) -- cycle;
  \node[anchor=north west,text width=1cm-4pt,align=center] at ([xshift=6pt,yshift=12pt]frame.north west) 
  {#2}; 
},
breakable,arc=4mm,
%colframe=blue!80!red,colback=white,
width=\textwidth, 
before upper ={\parshape 5
1.2cm \dimexpr \hsize-1.2cm\relax
1.2cm \dimexpr \hsize-1.2cm\relax
1.2cm \dimexpr \hsize-1.2cm\relax
1.2cm \dimexpr \hsize-1.2cm\relax
0pt \hsize} ,#1}

\tcbset{mystyle/.style 2 args={%
        enhanced,top=0mm,left=2pt,right=2pt,
enlarge top by=\baselineskip/2+1mm,
enlarge top at break by=0mm,pad at break=2mm,
fontupper=\normalsize,
  overlay unbroken and first={%
  \draw[fill=yellow]
   ([xshift=6pt,yshift=12pt]frame.north west) -| ++ (1.6,-1.3) 
   -- ++ (-0.8,0.3) -- ++ (-0.8,-0.3) -- cycle;
  \node[anchor=north west,text width=1.6cm-4pt,align=center] at ([xshift=6pt,yshift=12pt]frame.north west) 
  {#2}; 
},
breakable,arc=4mm,
before upper ={\parshape 3
1.8cm \dimexpr \hsize-1.8cm\relax
1.8cm \dimexpr \hsize-1.8cm\relax
0pt \hsize},#1
}}

\begin{document}
\begin{Mybox}[width=5.4cm]{abc xyz}
some text some text some text some text some text some text some text some text

\end{Mybox}
% 
\begin{tcbposter}[ poster = {columns=1, rows=3, height=14cm,width=12cm }]
% 
% %  \posterbox[colframe = red]{name=A}{\lipsum[1]}
\posterbox[colframe = red,height=5.0cm,width =8.3cm]{name=A}{abc xyz}
\posterbox[height=5.0cm,width =4.0cm, mystyle={colframe=red}{abc}]{xshift=1cm,
yshift=-5cm}%{xyz}
{some text some text some text some text some text some text some text some text}
\end{tcbposter}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .