Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass{book}
- usepackage[most]{tcolorbox}
- usepackage{varwidth}
- tcbuselibrary{skins,breakable}
- usepackage{polyglossia}
- setmainlanguage{english}
- newcommand{myboxnode}[2]{%
- node[fill=#2!5!white, draw=#2!75!black, line width=.5pt,
- below right, minimum height=2em,
- text width=.8cm, align=center,
- font=bfseries] at ([xshift=3mm,yshift=-1mm]frame.north east) {#1 thetcbcounter}}
- tcbset{
- mystyle/.style 2 args={
- enhanced jigsaw, breakable,
- colback=white, colframe=white,
- sharp corners,
- boxrule = 0mm,
- top=2mm, bottom=2mm, left=2mm, right=2mm,
- % varwidth boxed title,
- tikznode boxed title={minimum width=textwidth/4-15mm-4.5mm},
- attach boxed title to top right={%
- xshift=.5mm,yshift=- tcboxedtitleheight+.5mm},
- boxed title style={%
- enhanced,
- sharp corners,
- colframe=#1!75!black,
- left=1mm, right=1mm,
- boxrule=.5mm},
- colbacktitle=#1!5!white,
- coltitle=black,
- extrude right by=-15mm,
- underlay unbroken and first={%
- myboxnode{#2}{#1};
- draw [#1!75!black,line width=.5mm]([shift={(15mm-.5pgflinewidth,-15mm+.5pgflinewidth)}]frame.north east)|-([shift={(-textwidth/4+15mm,+.5pgflinewidth)}]frame.north east);
- draw [#1!75!black,line width=.5mm]([shift={(.5pgflinewidth,-15mm+.5pgflinewidth)}]frame.north west)|-([shift={(textwidth/4,+.5pgflinewidth)}]frame.north west); },
- underlay unbroken and last={%
- draw [#1!75!black,line width=.5mm]([yshift=.25mm]frame.south west)(textwidth/4,0)--(0,0);
- draw [#1!75!black,line width=.5mm]([xshift=.25mm,yshift=.25mm]frame.south west)--+(0,15mm);
- draw [#1!75!black,line width=.5mm]([xshift=14.75mm,yshift=.25mm]frame.south east)--+(0,15mm);
- draw [#1!75!black,line width=.5mm]([yshift=.25mm]frame.south east)(3*textwidth/4,0)--(textwidth,0);
- },
- },
- mytitle/.style 2 args={
- code={%
- ifstrempty{#1}
- {tcbset{
- before upper={parshape 4
- 0pt dimexpr hsize-14mmrelax
- 0pt dimexpr hsize-14mmrelax
- 0pt dimexpr hsize-14mmrelax
- 0pt hsize}}}
- {tcbset{
- title={#1},
- before upper={vspace*{baselineskip}parshape 3
- 0pt dimexpr hsize-14mmrelax
- 0pt dimexpr hsize-14mmrelax
- 0pt hsize},
- underlay unbroken and last={
- draw [#2!75!black,line width=.5mm](frame.south east)--++(180:tcboxedtitlewidth-pgflinewidth);
- }}}
- },
- }
- }
- newtcolorbox[auto counter]{proposition}[2][]{%
- mystyle={blue}{Prop},
- mytitle={#2}{blue},
- #1}
- newtcolorbox[auto counter]{definition}[2][]{%
- mystyle={green}{Def},
- mytitle={#2}{green},
- #1}
- begin{document}
- pagestyle{empty}
- begin{definition}{}
- A non-titled definition
- vspace{2.2cm}
- end{definition}
- begin{proposition}{A long title}
- A titled proposition
- vspace{2cm}
- end{proposition}
- begin{definition}[height=2cm,label=Exlab]{A}
- A titled definition
- end{definition}
- ref{Exlab}
- end{document}
- tcbsetmacrotoheightofnodemyheight{myboxnode{#2}{#1}},
- underlay unbroken and first={%
- myboxnode{#2}{#1};
- draw [#1!75!black,line width=.5mm]([shift={(15mm-.5pgflinewidth,-dimexprmyheight+.5pgflinewidth)}]frame.north east)|-([shift={(-textwidth/4+15mm,+.5pgflinewidth)}]frame.north east);
- draw [#1!75!black,line width=.5mm]([shift={(.5pgflinewidth,-dimexprmyheight+.5pgflinewidth)}]frame.north west)|-([shift={(textwidth/4,+.5pgflinewidth)}]frame.north west); },
- underlay unbroken and last={%
- draw [#1!75!black,line width=.5mm]([yshift=.25mm]frame.south west)(textwidth/4,0)--(0,0);
- draw [#1!75!black,line width=.5mm]([xshift=.25mm,yshift=.25mm]frame.south west)--+(0,dimexprmyheight);
- draw [#1!75!black,line width=.5mm]([xshift=14.75mm,yshift=.25mm]frame.south east)--+(0,dimexprmyheight);
- draw [#1!75!black,line width=.5mm]([yshift=.25mm]frame.south east)(3*textwidth/4,0)--(textwidth,0);
- },
Add Comment
Please, Sign In to add comment