Frame corners in tcolorbox
Författare
Senan Sekhon
Last Updated
för 2 år sedan
Licens
Creative Commons CC BY 4.0
Sammanfattning
A template for corner pieces of framed boxes, based on tcolorbox.
A template for corner pieces of framed boxes, based on tcolorbox.
\documentclass[10pt]{extarticle}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{framed}
\usepackage[normalem]{ulem}
\usepackage{indentfirst,ragged2e}
\usepackage[T1]{fontenc}
\usepackage{lmodern,mathrsfs}
\usepackage[inline,shortlabels]{enumitem}
\setlist{topsep=2pt,itemsep=2pt,parsep=0pt,partopsep=0pt}
\usepackage[dvipsnames]{xcolor}
\usepackage[utf8]{inputenc}
\usepackage[a4paper,top=0.5in,bottom=0.2in,left=0.5in,right=0.5in,footskip=0.3in,includefoot]{geometry}
\usepackage{multicol}
\usepackage[most]{tcolorbox}
\tcbuselibrary{minted} % tcolorbox minted library, required to use the "minted" tcb listing engine (this library is not loaded by the option [most])
\usepackage{tikz,tikz-3dplot,tikz-cd,tkz-tab,tkz-euclide,tikzsymbols,pgf,pgfplots}
\pgfplotsset{compat=newest}
\usepackage{minted} % Allows input of raw code, such as Python code
\usepackage[colorlinks]{hyperref}
\usepackage[nameinlink]{cleveref}
\tcbset{
%%%%%% HALF frame corner styles (produces half a corner) %%%%%%
% North West frame corner - Left segment only
frame corner northwest left/.style n args={5}{
frame code app={
\shade[top color={#4},bottom color={#5}]
([xshift={-#3},yshift={-#1}]frame.north west)
--++(0,{#1+#3})
--++({#2},{-#2})
--++(0,{-#1+#2-#3})
--cycle;
}
},
% North West frame corner - Top segment only
frame corner northwest top/.style n args={5}{
frame code app={
\shade[left color={#4},right color={#5}]
([xshift={#1},yshift={#3}]frame.north west)
--++({-#1-#3},0)
--++({#2},{-#2})
--++({#1-#2+#3},0)
--cycle;
}
},
% North East frame corner - Right segment only
frame corner northeast right/.style n args={5}{
frame code app={
\shade[top color={#4},bottom color={#5}]
([xshift={#3},yshift={-#1}]frame.north east)
--++(0,{#1+#3})
--++({-#2},{-#2})
--++(0,{-#1+#2-#3})
--cycle;
}
},
% North East frame corner - Top segment only
frame corner northeast top/.style n args={5}{
frame code app={
\shade[right color={#4},left color={#5}]
([xshift={-#1},yshift={#3}]frame.north east)
--++({#1+#3},0)
--++({-#2},{-#2})
--++({-#1+#2-#3},0)
--cycle;
}
},
% South West frame corner - Left segment only
frame corner southwest left/.style n args={5}{
frame code app={
\shade[bottom color={#4},top color={#5}]
([xshift={-#3},yshift={#1}]frame.south west)
--++(0,{-#1-#3})
--++({#2},{#2})
--++(0,{#1-#2+#3})
--cycle;
}
},
% South West frame corner - Bottom segment only
frame corner southwest bottom/.style n args={5}{
frame code app={
\shade[left color={#4},right color={#5}]
([xshift={#1},yshift={-#3}]frame.south west)
--++({-#1-#3},0)
--++({#2},{#2})
--++({#1-#2+#3},0)
--cycle;
}
},
% South East frame corner - Right segment only
frame corner southeast right/.style n args={5}{
frame code app={
\shade[bottom color={#4},top color={#5}]
([xshift={#3},yshift={#1}]frame.south east)
--++(0,{-#1-#3})
--++({-#2},{#2})
--++(0,{#1-#2+#3})
--cycle;
}
},
% South East frame corner - Bottom segment only
frame corner southeast bottom/.style n args={5}{
frame code app={
\shade[right color={#4},left color={#5}]
([xshift={-#1},yshift={-#3}]frame.south east)
--++({#1+#3},0)
--++({-#2},{#2})
--++({-#1+#2-#3},0)
--cycle;
}
},
}
\tcbset{
%%%%%% FULL frame corner styles (produces a full corner) %%%%%%
% North West frame corner - Both segments (left and top)
frame corners northwest/.style n args={5}{
frame corner northwest left={#1}{#2}{#3}{#4}{#5},
frame corner northwest top={#1}{#2}{#3}{#4}{#5},
},
% North East frame corner - Both segments (right and top)
frame corners northeast/.style n args={5}{
frame corner northeast right={#1}{#2}{#3}{#4}{#5},
frame corner northeast top={#1}{#2}{#3}{#4}{#5},
},
% South West frame corner - Both segments (left and bottom)
frame corners southwest/.style n args={5}{
frame corner southwest left={#1}{#2}{#3}{#4}{#5},
frame corner southwest bottom={#1}{#2}{#3}{#4}{#5},
},
% South East frame corner - Both segments (right and bottom)
frame corners southeast/.style n args={5}{
frame corner southeast right={#1}{#2}{#3}{#4}{#5},
frame corner southeast bottom={#1}{#2}{#3}{#4}{#5},
},
%%%%%% DOUBLE frame corner styles (produces two full corners) %%%%%%
% North frame corners (North West and North East)
frame corners north/.style n args={5}{
frame corners northwest={#1}{#2}{#3}{#4}{#5},
frame corners northeast={#1}{#2}{#3}{#4}{#5},
},
% South frame corners (South West and South East)
frame corners south/.style n args={5}{
frame corners southwest={#1}{#2}{#3}{#4}{#5},
frame corners southeast={#1}{#2}{#3}{#4}{#5},
},
% West frame corners (North West and South West)
frame corners west/.style n args={5}{
frame corners northwest={#1}{#2}{#3}{#4}{#5},
frame corners southwest={#1}{#2}{#3}{#4}{#5},
},
% East frame corners (North East and South East)
frame corners east/.style n args={5}{
frame corners northeast={#1}{#2}{#3}{#4}{#5},
frame corners southeast={#1}{#2}{#3}{#4}{#5},
},
% Downhill frame corners (North West and South East)
frame corners downhill/.style n args={5}{
frame corners northwest={#1}{#2}{#3}{#4}{#5},
frame corners southeast={#1}{#2}{#3}{#4}{#5},
},
% Uphill frame corners (South West and North East)
frame corners uphill/.style n args={5}{
frame corners southwest={#1}{#2}{#3}{#4}{#5},
frame corners northeast={#1}{#2}{#3}{#4}{#5},
},
%%%%%% QUADRUPLE frame corner style (produces all four full corners) %%%%%%
% Uphill frame corners (South West and North East)
frame corners all/.style n args={5}{
frame corners northwest={#1}{#2}{#3}{#4}{#5},
frame corners northeast={#1}{#2}{#3}{#4}{#5},
frame corners southwest={#1}{#2}{#3}{#4}{#5},
frame corners southeast={#1}{#2}{#3}{#4}{#5},
},
}
\tcbset{
%%%%%% HALF frame rounded corner styles (produces half a corner) %%%%%%
% North West frame rounded corner - Left segment only
frame rounded corner northwest left/.style n args={6}{
frame code app={
\shade[top color={#5},bottom color={#6}]
([xshift={-#3},yshift={-#1}]frame.north west)
--++(0,{#1+#3-#4})
arc(180:135:{#4})
--++({#2},{-#2})
arc(135:180:{#4-sqrt(2)*#2})
--++(0,{-#1-#3+#4})
--cycle;
}
},
% North West frame rounded corner - Top segment only
frame rounded corner northwest top/.style n args={6}{
frame code app={
\shade[left color={#5},right color={#6}]
([xshift={#1},yshift={#3}]frame.north west)
--++({-#1-#3+#4},0)
arc(90:135:{#4})
--++({#2},{-#2})
arc(135:90:{#4-sqrt(2)*#2})
--++({#1+#3-#4},0)
--cycle;
}
},
% North East frame rounded corner - Right segment only
frame rounded corner northeast right/.style n args={6}{
frame code app={
\shade[top color={#5},bottom color={#6}]
([xshift={#3},yshift={-#1}]frame.north east)
--++(0,{#1+#3-#4})
arc(0:45:{#4})
--++({-#2},{-#2})
arc(45:0:{#4-sqrt(2)*#2})
--++(0,{-#1-#3+#4})
--cycle;
}
},
% North East frame rounded corner - Top segment only
frame rounded corner northeast top/.style n args={6}{
frame code app={
\shade[right color={#5},left color={#6}]
([xshift={-#1},yshift={#3}]frame.north east)
--++({#1+#3-#4},0)
arc(90:45:{#4})
--++({-#2},{-#2})
arc(45:90:{#4-sqrt(2)*#2})
--++({-#1-#3+#4},0)
--cycle;
}
},
% South West frame rounded corner - Left segment only
frame rounded corner southwest left/.style n args={6}{
frame code app={
\shade[bottom color={#5},top color={#6}]
([xshift={-#3},yshift={#1}]frame.south west)
--++(0,{-#1-#3+#4})
arc(-180:-135:{#4})
--++({#2},{#2})
arc(-135:-180:{#4-sqrt(2)*#2})
--++(0,{#1+#3-#4})
--cycle;
}
},
% South West frame rounded corner - Bottom segment only
frame rounded corner southwest bottom/.style n args={6}{
frame code app={
\shade[left color={#5},right color={#6}]
([xshift={#1},yshift={-#3}]frame.south west)
--++({-#1-#3+#4},0)
arc(-90:-135:{#4})
--++({#2},{#2})
arc(-135:-90:{#4-sqrt(2)*#2})
--++({#1+#3-#4},0)
--cycle;
}
},
% South East frame rounded corner - Right segment only
frame rounded corner southeast right/.style n args={6}{
frame code app={
\shade[bottom color={#5},top color={#6}]
([xshift={#3},yshift={#1}]frame.south east)
--++(0,{-#1-#3+#4})
arc(0:-45:{#4})
--++({-#2},{#2})
arc(-45:0:{#4-sqrt(2)*#2})
--++(0,{#1+#3-#4})
--cycle;
}
},
% South East frame rounded corner - Bottom segment only
frame rounded corner southeast bottom/.style n args={6}{
frame code app={
\shade[right color={#5},left color={#6}]
([xshift={-#1},yshift={-#3}]frame.south east)
--++({#1+#3-#4},0)
arc(-90:-45:{#4})
--++({-#2},{#2})
arc(-45:-90:{#4-sqrt(2)*#2})
--++({-#1-#3+#4},0)
--cycle;
}
},
}
\tcbset{
%%%%%% FULL frame rounded corner styles (produces a full corner) %%%%%%
% North West frame rounded corner - Both segments (left and top)
frame rounded corners northwest/.style n args={6}{
frame rounded corner northwest left={#1}{#2}{#3}{#4}{#5}{#6},
frame rounded corner northwest top={#1}{#2}{#3}{#4}{#5}{#6},
},
% North East frame rounded corner - Both segments (right and top)
frame rounded corners northeast/.style n args={6}{
frame rounded corner northeast right={#1}{#2}{#3}{#4}{#5}{#6},
frame rounded corner northeast top={#1}{#2}{#3}{#4}{#5}{#6},
},
% South West frame rounded corner - Both segments (left and bottom)
frame rounded corners southwest/.style n args={6}{
frame rounded corner southwest left={#1}{#2}{#3}{#4}{#5}{#6},
frame rounded corner southwest bottom={#1}{#2}{#3}{#4}{#5}{#6},
},
% South East frame rounded corner - Both segments (right and bottom)
frame rounded corners southeast/.style n args={6}{
frame rounded corner southeast right={#1}{#2}{#3}{#4}{#5}{#6},
frame rounded corner southeast bottom={#1}{#2}{#3}{#4}{#5}{#6},
},
%%%%%% DOUBLE frame rounded corner styles (produces two full corners) %%%%%%
% North frame rounded corners (North West and North East)
frame rounded corners north/.style n args={6}{
frame rounded corners northwest={#1}{#2}{#3}{#4}{#5}{#6},
frame rounded corners northeast={#1}{#2}{#3}{#4}{#5}{#6},
},
% South frame rounded corners (South West and South East)
frame rounded corners south/.style n args={6}{
frame rounded corners southwest={#1}{#2}{#3}{#4}{#5}{#6},
frame rounded corners southeast={#1}{#2}{#3}{#4}{#5}{#6},
},
% West frame rounded corners (North West and South West)
frame rounded corners west/.style n args={6}{
frame rounded corners northwest={#1}{#2}{#3}{#4}{#5}{#6},
frame rounded corners southwest={#1}{#2}{#3}{#4}{#5}{#6},
},
% East frame rounded corners (North East and South East)
frame rounded corners east/.style n args={6}{
frame rounded corners northeast={#1}{#2}{#3}{#4}{#5}{#6},
frame rounded corners southeast={#1}{#2}{#3}{#4}{#5}{#6},
},
% Downhill frame rounded corners (North West and South East)
frame rounded corners downhill/.style n args={6}{
frame rounded corners northwest={#1}{#2}{#3}{#4}{#5}{#6},
frame rounded corners southeast={#1}{#2}{#3}{#4}{#5}{#6},
},
% Uphill frame rounded corners (South West and North East)
frame rounded corners uphill/.style n args={6}{
frame rounded corners southwest={#1}{#2}{#3}{#4}{#5}{#6},
frame rounded corners northeast={#1}{#2}{#3}{#4}{#5}{#6},
},
%%%%%% QUADRUPLE frame rounded corner style (produces all four full corners) %%%%%%
% Uphill frame rounded corners (South West and North East)
frame rounded corners all/.style n args={6}{
frame rounded corners northwest={#1}{#2}{#3}{#4}{#5}{#6},
frame rounded corners northeast={#1}{#2}{#3}{#4}{#5}{#6},
frame rounded corners southwest={#1}{#2}{#3}{#4}{#5}{#6},
frame rounded corners southeast={#1}{#2}{#3}{#4}{#5}{#6},
},
}
% verbbox environment, for showing verbatim text next to code output (for package documentation and user learning purposes)
\NewTCBListing{verbbox}{ !O{} }{
listing engine=minted,
minted language=latex,
boxrule=1pt,sidebyside,skin=bicolor,
colback=gray!10,colbacklower=white,valign=center,
top=2pt,bottom=2pt,left=2pt,right=2pt,
#1
} % Last argument allows more tcolorbox options to be added
\usepackage[explicit]{titlesec}
\titleformat{\section}{\normalfont\sffamily\Large\bfseries}{\thesection}{12pt}{#1}
\newcommand{\Disp}{\displaystyle}
\newcommand{\qe}{\hfill\(\bigtriangledown\)}
\DeclareMathAlphabet\mathbfcal{OMS}{cmsy}{b}{n}
\setlength{\parindent}{0in}
\setlength{\parskip}{0pt}
\setlength{\columnseprule}{0pt}
\newcommand{\ind}{\hspace{0.2in}} % override the indent setting
\makeatletter
\g@addto@macro\normalsize{
\setlength\abovedisplayskip{3pt}
\setlength\belowdisplayskip{3pt}
\setlength\abovedisplayshortskip{0pt}
\setlength\belowdisplayshortskip{0pt}}
\makeatother
\makeatletter
% Redefining the title block
\renewcommand\maketitle{
\null\vspace{6mm}
\begin{center}
{\Huge\sffamily\bfseries\selectfont\@title}\\
\vspace{6mm}
{\Large\sffamily\selectfont\@author}\\
\vspace{6mm}
{\large\sffamily\selectfont\@date}
\end{center}
\vspace{6mm}
}
% Adapted from https://tex.stackexchange.com/questions/483953/how-to-add-new-macros-like-author-without-editing-latex-ltx?noredirect=1&lq=1
\makeatother
\title{Frame corners in \texttt{tcolorbox}}
\author{Senan Sekhon}
\date{April 14, 2023}
% Created April 12, 2023
\begin{document}
\maketitle
\begin{tcolorbox}[enhanced,frame hidden,
frame corners all={5mm}{2pt}{1pt}{black}{white}]
This template provides \texttt{tcolorbox} styles for ``frame corners'', i.e. corner pieces of a frame.\\
These are fully customizable and compatible with other \texttt{tcolorbox} options, \emph{except} that they cannot be rendered with the \texttt{standard} engine. As a result, any \texttt{tcolorbox} that uses any of these styles must also contain one of the following options:
\vspace{-10pt}
\begin{multicols}{4}\centering\ttfamily
enhanced
bicolor
enhanced jigsaw
bicolor jigsaw
\end{multicols}
\end{tcolorbox}
These styles are based on the \href{https://ctan.org/pkg/tcolorbox}{\texttt{tcolorbox}} package and the Ti\textit{k}Z/PGF drawing engines.\\
There are two classes of styles available in this template, the \texttt{frame corner} styles (which produce \textbf{sharp} corners) and the \texttt{frame rounded corner} styles (which produce \textbf{rounded} corners). They are to be called as follows:
\vspace{10pt}
\texttt{frame corner }\underline{type}\texttt{=\{}$\langle length\rangle$\texttt{\}\{}$\langle thickness\rangle$\texttt{\}\{}$\langle distance\rangle$\texttt{\}\{}$\langle corner\, color\rangle$\texttt{\}\{}$\langle edge\, color\rangle$\texttt{\}}
\vspace{10pt}
\texttt{frame rounded corner }\underline{type}\texttt{=\{}$\langle length\rangle$\texttt{\}\{}$\langle thickness\rangle$\texttt{\}\{}$\langle distance\rangle$\texttt{\}\{}$\langle radius\rangle$\texttt{\}\{}$\langle corner\, color\rangle$\texttt{\}\{}$\langle edge\, color\rangle$\texttt{\}}
\vspace{10pt}
The \underline{type} refers to the corner of the box, which may be any of the \textcolor{blue!80!black}{eight keys} outside the box below:
\begin{center}
\begin{tikzpicture}[every node/.style={font=\footnotesize\ttfamily}]
\draw (-4,-2) rectangle (4,2); % The box (frame)
% The eight keys for frame corner and frame corner styles
\node[above left,rotate=75,blue!80!black] at (-4,2) {north west left};
\node[above right,blue!80!black] at (-4,2) {north west top};
\node[above right,rotate=-75,blue!80!black] at (4,2) {north east right};
\node[above left,blue!80!black] at (4,2) {north east top};
\node[above right,rotate=90,blue!80!black] at (-4,-2) {south west left};
\node[below right,blue!80!black] at (-4,-2) {south west bottom};
\node[above left,rotate=-90,blue!80!black] at (4,-2) {south east right};
\node[below left,blue!80!black] at (4,-2) {south east bottom};
% The four frame corners (reference points)
\fill[red!80!black] (-4,2) circle (2pt);
\draw[latex-,shorten <=5pt,red!80!black] (-4,2)--(-3.5,1.5) node[below right]{(frame.north west)};
\fill[red!80!black] (4,2) circle (2pt);
\draw[latex-,shorten <=5pt,red!80!black] (4,2)--(3.5,1.5) node[below left]{(frame.north east)};
\fill[red!80!black] (-4,-2) circle (2pt);
\draw[latex-,shorten <=5pt,red!80!black] (-4,-2)--(-3.5,-1.5) node[above right]{(frame.south west)};
\fill[red!80!black] (4,-2) circle (2pt);
\draw[latex-,shorten <=5pt,red!80!black] (4,-2)--(3.5,-1.5) node[above left]{(frame.south east)};
% Node at the center of the box
\node at (0,0) {\normalfont\small The box denotes the frame of the \texttt{tcolorbox}.};
\end{tikzpicture}
\end{center}
\begin{itemize}
\item The \texttt{frame corner} styles have 5 arguments, the first 3 of which are lengths and the last 2 are colors.
\item The \texttt{frame rounded corner} styles have 6 arguments, the first 4 of which are lengths and the last 2 are colors.
\end{itemize}
\begin{multicols}{2}
\begin{tcolorbox}[blanker,center title,center upper,
title={Arguments for \texttt{frame corner}},coltitle=black
]
\begin{tikzpicture}[every node/.style={font=\ttfamily}]
\draw (-0.1,0.1)--(0.1,-0.1) (-0.1,-0.1)--(0.1,0.1); % X marking (frame.north west)
\fill (0,0) circle (1pt); % Dot marking (frame.north west)
% Shading the left and top segments
\shade[top color=BrickRed,bottom color=JungleGreen] (-1,-2)--(-1,1)--(-0.7,0.7)--(-0.7,-2)--cycle;
\shade[left color=BrickRed,right color=JungleGreen] (2,1)--(-1,1)--(-0.7,0.7)--(2,0.7)--cycle;
% Label for the length argument #1
\draw[thick,RedViolet,decoration={brace,raise=2pt},decorate] (-1,-2)--node[left=3pt]{\#1} (-1,1);
\draw[thick,RedViolet,decoration={brace,mirror,raise=2pt},decorate] (2,1)--node[above=3pt]{\#1} (-1,1);
% Label for the thickness argument #2
\draw[thick,OliveGreen,decoration={brace,mirror,raise=2pt},decorate] (-1,-2)--node[below=3pt]{\#2} (-0.7,-2);
\draw[thick,OliveGreen,decoration={brace,raise=2pt},decorate] (2,1)--node[right=3pt]{\#2} (2,0.7);
% Label for the distance argument #3
\draw[thick,Tan,decoration={brace,mirror,raise=2pt},decorate] (-1,-0.2)--node[below=3pt]{\#3} (0,-0.2);
\draw[thick,Tan,decoration={brace,raise=2pt},decorate] (0.2,1)--node[right=3pt]{\#3} (0.2,0);
% Label for the corner color #4
\node[rotate=45,font=\scriptsize\ttfamily] at (-1.2,1.2) {color=\#4};
% Label for the edge color #5
\node[right,font=\scriptsize\ttfamily] at (-0.7,-1.8) {color=\#5};
\node[right,rotate=-90,font=\scriptsize\ttfamily] at (1.8,0.7) {color=\#5};
\end{tikzpicture}
\end{tcolorbox}
\begin{tcolorbox}[blanker,center title,center upper,
title={Arguments for \texttt{frame rounded corner}},coltitle=black
]
\begin{tikzpicture}[every node/.style={font=\ttfamily}]
\draw (-0.1,0.1)--(0.1,-0.1) (-0.1,-0.1)--(0.1,0.1); % X marking (frame.north west)
\fill (0,0) circle (1pt); % Dot marking (frame.north west)
% Shading the left and top segments
\shade[top color=BrickRed,bottom color=JungleGreen] (-1,-2)--(-1,0.2) arc(180:135:0.8)--++(0.2,-0.2) arc(135:180:{0.8-0.2*sqrt(2)})--(-0.7,-2)--cycle;
\shade[left color=BrickRed,right color=JungleGreen] (2,1)--(-0.2,1) arc(90:135:0.8)--++(0.2,-0.2) arc(135:90:{0.8-0.2*sqrt(2)})--(2,0.7)--cycle;
% Label for the length argument #1
\draw[thick,RedViolet,decoration={brace,raise=2pt},decorate] (-1,-2)--node[left=3pt]{\#1} (-1,1);
\draw[thick,RedViolet,decoration={brace,mirror,raise=2pt},decorate] (2,1)--node[above=3pt]{\#1} (-1,1);
% Label for the thickness argument #2
\draw[thick,OliveGreen,decoration={brace,mirror,raise=2pt},decorate] (-1,-2)--node[below=3pt]{\#2} (-0.7,-2);
\draw[thick,OliveGreen,decoration={brace,raise=2pt},decorate] (2,1)--node[right=3pt]{\#2} (2,0.7);
% Label for the distance argument #3
\draw[thick,Tan,decoration={brace,mirror,raise=2pt},decorate] (-1,-0.4)--node[below=3pt]{\#3} (0,-0.4);
\draw[thick,Tan,decoration={brace,raise=2pt},decorate] (0.4,1)--node[right=3pt]{\#3} (0.4,0);
% Label for the radius argument #4
\draw[thick,Cerulean,decoration={brace,mirror,raise=2pt},decorate] (-1,0.2)--node[below=3pt,xshift=4pt]{\#4} (-0.2,0.2);
\draw[thick,Cerulean,decoration={brace,raise=2pt},decorate] (-0.2,1)--node[right=3pt,yshift=-4pt]{\#4} (-0.2,0.2);
% Label for the corner color #5
\node[rotate=45,font=\scriptsize\ttfamily] at (-1.2,1.2) {color=\#5};
% Label for the edge color #6
\node[right,font=\scriptsize\ttfamily] at (-0.7,-1.8) {color=\#6};
\node[right,rotate=-90,font=\scriptsize\ttfamily] at (1.8,0.7) {color=\#6};
\end{tikzpicture}
\end{tcolorbox}
\end{multicols}
\vspace{-10pt}
In both diagrams, the $\times$ marks the upper-left corner of the frame, i.e. the coordinate \texttt{(frame.north west)}.
\newpage
\section{Sharp corners}
The style \texttt{frame corners all} produces \emph{all} corner pieces. Below is a complete example:
\begin{verbbox}[righthand ratio=0.4]
\begin{tcolorbox}[enhanced,frame hidden,
frame corners all={5mm}{2pt}{1pt}{red}{white}]
This is a \texttt{tcolorbox}.\\
This is some additional text.
\end{tcolorbox}
\end{verbbox}
The following styles produce \emph{one half} of a corner piece. For example, \texttt{frame corner northwest left} produces the \emph{left} portion of the upper-left corner piece, while \texttt{frame corner northwest top} produces the \emph{top portion}.
\begin{multicols}{2}
\tcbset{enhanced,frame hidden,fontupper=\ttfamily}
\begin{tcolorbox}[frame corner northwest left={5mm}{2pt}{1pt}{red}{white}]
frame corner northwest left
\end{tcolorbox}
\begin{tcolorbox}[frame corner northeast right={5mm}{2pt}{1pt}{red}{white}]
frame corner northeast right
\end{tcolorbox}
\begin{tcolorbox}[frame corner southwest left={5mm}{2pt}{1pt}{red}{white}]
frame corner southwest left
\end{tcolorbox}
\begin{tcolorbox}[frame corner southeast right={5mm}{2pt}{1pt}{red}{white}]
frame corner southeast right
\end{tcolorbox}
%%%%%%%% %%%%%%%% %%%%%%%%
\begin{tcolorbox}[frame corner northwest top={5mm}{2pt}{1pt}{red}{white}]
frame corner northwest top
\end{tcolorbox}
\begin{tcolorbox}[frame corner northeast top={5mm}{2pt}{1pt}{red}{white}]
frame corner northeast top
\end{tcolorbox}
\begin{tcolorbox}[frame corner southwest bottom={5mm}{2pt}{1pt}{red}{white}]
frame corner southwest bottom
\end{tcolorbox}
\begin{tcolorbox}[frame corner southeast bottom={5mm}{2pt}{1pt}{red}{white}]
frame corner southeast bottom
\end{tcolorbox}
\end{multicols}
The following styles produce \emph{one full} corner piece. For example, \texttt{frame corners northwest} produces the full upper-left corner piece (both the left and top portions).
\begin{multicols}{2}
\tcbset{enhanced,frame hidden,fontupper=\ttfamily}
\begin{tcolorbox}[frame corners northwest={5mm}{2pt}{1pt}{red}{white}]
frame corners northwest
\end{tcolorbox}
\begin{tcolorbox}[frame corners southwest={5mm}{2pt}{1pt}{red}{white}]
frame corners southwest
\end{tcolorbox}
%%%%%%%% %%%%%%%% %%%%%%%%
\begin{tcolorbox}[frame corners northeast={5mm}{2pt}{1pt}{red}{white}]
frame corners northeast
\end{tcolorbox}
\begin{tcolorbox}[frame corners southeast={5mm}{2pt}{1pt}{red}{white}]
frame corners southeast
\end{tcolorbox}
\end{multicols}
The following styles produce \emph{two full} corner pieces.
\begin{multicols}{2}
\tcbset{enhanced,frame hidden,fontupper=\ttfamily}
\begin{tcolorbox}[frame corners north={5mm}{2pt}{1pt}{red}{white}]
frame corners north
\end{tcolorbox}
\begin{tcolorbox}[frame corners west={5mm}{2pt}{1pt}{red}{white}]
frame corners west
\end{tcolorbox}
\begin{tcolorbox}[frame corners uphill={5mm}{2pt}{1pt}{red}{white}]
frame corners uphill
\end{tcolorbox}
%%%%%%%% %%%%%%%% %%%%%%%%
\begin{tcolorbox}[frame corners south={5mm}{2pt}{1pt}{red}{white}]
frame corners south
\end{tcolorbox}
\begin{tcolorbox}[frame corners east={5mm}{2pt}{1pt}{red}{white}]
frame corners east
\end{tcolorbox}
\begin{tcolorbox}[frame corners downhill={5mm}{2pt}{1pt}{red}{white}]
frame corners downhill
\end{tcolorbox}
\end{multicols}
You can also combine options:
\begin{verbbox}[righthand ratio=0.4]
\begin{tcolorbox}[enhanced,frame hidden,
frame corners northwest={5mm}{2pt}{5pt}{red}{white},
frame corners northeast={5mm}{2pt}{1pt}{green}{gray},
frame corners southwest={8mm}{1pt}{0pt}{blue}{yellow},
frame corner southwest bottom={5mm}{3pt}{6pt}{black}{red}]
This is a \texttt{tcolorbox}.\\
This is some additional text.
\end{tcolorbox}
\end{verbbox}
\newpage
\section{Rounded corners}
The style \texttt{frame rounded corners all} produces \emph{all} corner pieces. Below is a complete example:
\begin{verbbox}[righthand ratio=0.4]
\begin{tcolorbox}[enhanced,frame hidden,
frame rounded corners all={5mm}{2pt}{1pt}{5pt}{blue}{white}]
This is a \texttt{tcolorbox}.\\
This is some additional text.
\end{tcolorbox}
\end{verbbox}
The following styles produce \emph{one half} of a corner piece. For example, \texttt{frame rounded corner northwest left} produces the \emph{left} portion of the upper-left corner piece, while \texttt{frame rounded corner northwest top} produces the \emph{top portion}.
\begin{multicols}{2}
\tcbset{enhanced,frame hidden,fontupper=\ttfamily}
\begin{tcolorbox}[frame rounded corner northwest left={5mm}{2pt}{1pt}{5pt}{blue}{white}]
frame rounded corner northwest left
\end{tcolorbox}
\begin{tcolorbox}[frame rounded corner northeast right={5mm}{2pt}{1pt}{5pt}{blue}{white}]
frame rounded corner northeast right
\end{tcolorbox}
\begin{tcolorbox}[frame rounded corner southwest left={5mm}{2pt}{1pt}{5pt}{blue}{white}]
frame rounded corner southwest left
\end{tcolorbox}
\begin{tcolorbox}[frame rounded corner southeast right={5mm}{2pt}{1pt}{5pt}{blue}{white}]
frame rounded corner southeast right
\end{tcolorbox}
%%%%%%%% %%%%%%%% %%%%%%%%
\begin{tcolorbox}[frame rounded corner northwest top={5mm}{2pt}{1pt}{5pt}{blue}{white}]
frame rounded corner northwest top
\end{tcolorbox}
\begin{tcolorbox}[frame rounded corner northeast top={5mm}{2pt}{1pt}{5pt}{blue}{white}]
frame rounded corner northeast top
\end{tcolorbox}
\begin{tcolorbox}[frame rounded corner southwest bottom={5mm}{2pt}{1pt}{5pt}{blue}{white}]
frame rounded corner southwest bottom
\end{tcolorbox}
\begin{tcolorbox}[frame rounded corner southeast bottom={5mm}{2pt}{1pt}{5pt}{blue}{white}]
frame rounded corner southeast bottom
\end{tcolorbox}
\end{multicols}
The following styles produce \emph{one full} corner piece. For example, \texttt{frame rounded corners northwest} produces the full upper-left corner piece (both the left and top portions).
\begin{multicols}{2}
\tcbset{enhanced,frame hidden,fontupper=\ttfamily}
\begin{tcolorbox}[frame rounded corners northwest={5mm}{2pt}{1pt}{5pt}{blue}{white}]
frame rounded corners northwest
\end{tcolorbox}
\begin{tcolorbox}[frame rounded corners southwest={5mm}{2pt}{1pt}{5pt}{blue}{white}]
frame rounded corners southwest
\end{tcolorbox}
%%%%%%%% %%%%%%%% %%%%%%%%
\begin{tcolorbox}[frame rounded corners northeast={5mm}{2pt}{1pt}{5pt}{blue}{white}]
frame rounded corners northeast
\end{tcolorbox}
\begin{tcolorbox}[frame rounded corners southeast={5mm}{2pt}{1pt}{5pt}{blue}{white}]
frame rounded corners southeast
\end{tcolorbox}
\end{multicols}
The following styles produce \emph{two full} corner pieces.
\begin{multicols}{2}
\tcbset{enhanced,frame hidden,fontupper=\ttfamily}
\begin{tcolorbox}[frame rounded corners north={5mm}{2pt}{1pt}{5pt}{blue}{white}]
frame rounded corners north
\end{tcolorbox}
\begin{tcolorbox}[frame rounded corners west={5mm}{2pt}{1pt}{5pt}{blue}{white}]
frame rounded corners west
\end{tcolorbox}
\begin{tcolorbox}[frame rounded corners uphill={5mm}{2pt}{1pt}{5pt}{blue}{white}]
frame rounded corners uphill
\end{tcolorbox}
%%%%%%%% %%%%%%%% %%%%%%%%
\begin{tcolorbox}[frame rounded corners south={5mm}{2pt}{1pt}{5pt}{blue}{white}]
frame rounded corners south
\end{tcolorbox}
\begin{tcolorbox}[frame rounded corners east={5mm}{2pt}{1pt}{5pt}{blue}{white}]
frame rounded corners east
\end{tcolorbox}
\begin{tcolorbox}[frame rounded corners downhill={5mm}{2pt}{1pt}{5pt}{blue}{white}]
frame rounded corners downhill
\end{tcolorbox}
\end{multicols}
You can also combine options and add extra Ti\textit{k}Z/PGF options:
\begin{verbbox}[righthand ratio=0.25]
\begin{tcolorbox}[enhanced,frame hidden,
frame code={\draw (frame.south east) circle (1mm);}, % circle in the corner
frame rounded corner northwest top={7mm}{5pt}{3pt}{3pt}{green}{blue},
frame rounded corner northeast right={10mm}{1pt}{1pt}{12pt}{orange}{teal},
frame rounded corner southwest left={10mm}{3pt}{6pt}{9pt}{violet}{white}]
This is a \texttt{tcolorbox}.\\
This is some additional text.
\end{tcolorbox}
\end{verbbox}
Note that the upper-right corner piece is partially hidden as the interior of the box is drawn over it. Adding \texttt{interior hidden} to the \texttt{tcolorbox} options or specifying \texttt{interior code=\{...\}} will fix this.
\newpage
\section{Other examples}
\begin{verbbox}[sidebyside=false]
\begin{tcolorbox}[enhanced,frame hidden,interior hidden,
frame corners all={7mm}{2pt}{-4pt}{blue!50!black}{blue!10},
frame rounded corners all={7mm}{1.5pt}{0pt}{3pt}{red!50!blue!50!black}{blue!10},
frame rounded corners all={7mm}{1pt}{3pt}{6pt}{red!50!black}{blue!10},
]
For every non-negative integer $n$, we have:
\begin{equation*}
\int_0^\infty x^ne^{-ax}\,dx=\frac{n!}{a^{n+1}} \tag{$a>0$}
\end{equation*}
Prove this by induction.
\end{tcolorbox}
\end{verbbox}
\begin{verbbox}[sidebyside=false]
\begin{tcolorbox}[enhanced,frame hidden,interior hidden,
frame corner northwest top={7mm}{2pt}{-6pt}{green!80!black}{gray!10},
frame corner northeast right={7mm}{2pt}{-6pt}{green!80!black}{gray!10},
frame corner southwest left={7mm}{2pt}{-6pt}{green!80!black}{gray!10},
frame corner southeast bottom={7mm}{2pt}{-6pt}{green!80!black}{gray!10},
frame rounded corner northwest top={12mm}{3pt}{0pt}{5pt}{violet!40!black}{gray!20},
frame rounded corner northeast right={12mm}{3pt}{0pt}{5pt}{violet!40!black}{gray!20},
frame rounded corner southwest left={12mm}{3pt}{0pt}{5pt}{violet!40!black}{gray!20},
frame rounded corner southeast bottom={12mm}{3pt}{0pt}{5pt}{violet!40!black}{gray!20},
]
Prove that:
\begin{equation*}
\sum_{n=1}^\infty \frac{n}{4n^4+1}=\frac{1}{4}
\end{equation*}
\end{tcolorbox}
\end{verbbox}
\begin{verbbox}[sidebyside=false]
\begin{tcolorbox}[enhanced,frame hidden,interior hidden,
frame corners north={5mm}{2pt}{2pt}{teal}{white},
frame rounded corners south={5mm}{2pt}{2pt}{10pt}{orange}{white}]
\begin{tcolorbox}[enhanced,frame hidden,interior hidden,
frame rounded corners uphill={3mm}{1pt}{4pt}{5pt}{violet}{white},
frame corners downhill={3mm}{1pt}{4pt}{green}{white}]
This is a \texttt{tcolorbox} within a \texttt{tcolorbox}.\\
Both boxes contain \texttt{frame corner} and \texttt{frame rounded corner} options.
\end{tcolorbox}
\end{tcolorbox}
\end{verbbox}
\end{document}