Trying to make an Edge of Empire Style Box
Oooo. @cis just beat me!
With time and patience you can do almost anything with tcolorbox
:
\documentclass{article}
\usepackage[sfdefault,condensed]{roboto}
\usepackage[most]{tcolorbox}
\tcbset{active/.style={colbacktitle=red!50!black}}
\newtcolorbox{rankedtalentbox}[3][]{%
enhanced,
colback=white,
colframe=black!50,
title filled=false,
titlerule=0pt,
fonttitle=\bfseries,
arc is angular,
arc=6pt,
sharp corners=northwest,
text width=3.8cm,
boxrule=1.5pt,
left=3pt,
right=3pt,
top=3pt,
bottom=9pt,
boxsep=1.5pt,
halign=flush left,
attach boxed title to top left={
xshift=3pt,
yshift*=-3pt-\tcboxedtitleheight},
boxed title style={
interior code={},
frame empty,
left=0pt,
boxrule=0pt,
sharp corners},
underlay boxed title={
\path[tcb fill title]
(title.north west) --
([xshift=-3.5pt-0.5*\tcboxedtitleheight,yshift=-3pt]frame.north east) --
([xshift=-3.5pt,yshift=-3pt-0.5*\tcboxedtitleheight]frame.north east) --
([xshift=-3.5pt-0.5*\tcboxedtitleheight,yshift=-3pt-\tcboxedtitleheight]frame.north east) --
(title.south west) -- cycle;
\path[fill=tcbcoltitle]
([xshift=-4pt-0.5*\tcboxedtitleheight,yshift=-4.5pt]frame.north east) --
([xshift=-5.5pt,yshift=-3pt-0.5*\tcboxedtitleheight]frame.north east) --
([xshift=-4pt-0.5*\tcboxedtitleheight,yshift=-1.5pt-\tcboxedtitleheight]frame.north east) --
([xshift=-2.5pt-\tcboxedtitleheight,yshift=-3pt-0.5*\tcboxedtitleheight]frame.north east) --
cycle;
\path[draw=tcbcolframe,line width=1.5pt] (frame.north) -- ++(0,3pt);
\path[draw=tcbcolframe,line width=1.5pt] (frame.south) -- ++(0,-3pt);
\path[draw=tcbcolframe,line width=1.5pt] ([xshift=-3pt]title.west) -- ++(-3pt,0);
\path[tcb fill title]
([xshift=-7.5pt,yshift=0.75pt]frame.south east) -- ++(135:4pt) --
++(-1.5cm,0) -- ++(-135:4pt) -- ++(-45:4pt) -- ++(1.5cm,0) -- cycle
[insert path={node[font=\tiny,text=tcbcoltitle]
at (current path bounding box.center) {COST #3}}];
},
active,
title=#2,
#1
}
\begin{document}
\begin{rankedtalentbox}{QUICK DRAW}{10}
Once per round draw or holster a weapon or item as an incidental.
\end{rankedtalentbox}
\end{document}
€dit: simpler.
% Box with Pins - v2.0 =====
\documentclass{book}
\usepackage[showframe=false]{geometry}
%\usepackage{lipsum}
\usepackage[most]{tcolorbox}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{calc}
\pgfkeys{/tikz/savevalue/.code 2 args={\global\edef#1{#2}}}
% Values 1/2 ===============
\pgfmathsetlengthmacro\frule{1.75pt}
\pgfmathsetlengthmacro\BoxSep{2.5pt}
\pgfmathsetlengthmacro\pin{2*\frule}
\newtcolorbox{mybox}[3][]{ %show bounding box,
% Values 2/2 ===============
width=4.25cm,
colframe=gray,
colback=white,
colbacktitle=purple,
% =====================
boxrule=\frule,
boxsep=\BoxSep, % additional value
top=0pt, left=\BoxSep, right=\BoxSep,
bottom=\BoxSep+\BoxSep, % some more space for bottom title
enhanced, % allows TikZ etc.
fontupper=\sffamily,
% Top Title =======
title=#2, % Title Text
flushleft title,
fonttitle=\color{white}\sffamily\bfseries,
attach boxed title to top={
xshift=0pt,
yshift*=-\BoxSep-\tcboxedtitleheight,
},
boxed title style={
frame empty, sharp corners,
left=0pt,
boxrule=0pt,
opacityback=0, % no default fill of title
},
underlay boxed title={ % manuell styled fill of title:
\pgfmathsetlengthmacro\s{\tcboxedtitleheight/(2*cos(45))}
\pgfmathsetlengthmacro\h{\s*sin(45)}
\path[fill=tcbcolbacktitle] (title.north west) rectangle ([xshift=-\h]title.south east) coordinate(Y1);
\path[fill=tcbcolbacktitle, draw=none] (Y1) -- ++(45:\s) coordinate(Y2) -- ++(135:\s) --cycle;
\node[draw=none, diamond, fill=white, inner sep=0.4*\h] at ([xshift=-\h-1pt]Y2){};
},
% Pin Box =======
arc is angular,
arc=5pt,
sharp corners=northwest,
finish={ % Pins =======
\path[draw=tcbcolframe, line width=0.75*\pin] (frame.north) -- +(0,\pin);
\path[draw=tcbcolframe, line width=0.75*\pin] (frame.south) -- +(0,-\pin);
\path[draw=tcbcolframe, line width=0.75*\pin] ($(frame.south west)!0.8!(frame.north west)$) -- +(-\pin,0);
% Bottom Title =======
\node[fill=tcbcolbacktitle, draw=none, font=\color{white}\sffamily\footnotesize, outer sep=0pt,
anchor=center, inner sep=1pt, yshift=0.5*\frule] at ($(frame.south)!0.45!(frame.south east)$) (btitle) {#3}; % Bottom Title Text
\path let \p1=($(btitle.north east)-(btitle.south east)$) in
\pgfextra{ \pgfmathsetlengthmacro{\H}{sin(45)*veclen(\x1,\y1)} }
[savevalue={\bh}{\H}];
\path[fill=tcbcolbacktitle, draw=none] (btitle.north east) -- +(-45:\bh) -- (btitle.south east) --cycle;
\path[fill=tcbcolbacktitle, draw=none] (btitle.north west) -- +(225:\bh) -- (btitle.south west) --cycle;
},
left skip=\pin, #1
}
\begin{document}
\begin{mybox}[]{The Top Title}{Cost 10\$}
Once per round, draw or holster a weapon or item as an incidental.
\end{mybox}
\end{document}