How to add double frame in tcolorbox?
There's no need for nested tcolorboxes
, you could use an enhanced
box with an additional borderline
:
\documentclass{book}
\usepackage[explicit]{titlesec}
\usepackage[many]{tcolorbox}
\definecolor{myCyan}{HTML}{13C39D}
\titleformat{\chapter}[display]
{\sffamily\bfseries\Huge\filcenter}
{}
{0pt}
{%
\begin{tcolorbox}[
enhanced,
colback=myCyan,
colframe=myCyan,
boxsep=5pt,
sharp corners,
borderline={1.5pt}{3pt}{white},
colupper=white,
fontupper=\sffamily\bfseries\Huge,
halign upper=center
]
\thechapter. #1
\end{tcolorbox}%
}
\titlespacing*{\chapter}{0pt}{0cm}{0cm}
\usepackage{lipsum}
\begin{document}
\chapter{Lorem lipsum}
\lipsum[1]
\end{document}
This may be a start. The idea is to nest tcolorbox
es.
\documentclass{article}
\usepackage{tcolorbox}
\begin{document}
\begin{tcolorbox}[
colback=green!50!blue,
colframe=green!50!blue,
left=1.5pt,right=1.5pt,top=1.5pt,bottom=-1.5pt,
sharp corners,
boxsep=0pt
]
\begin{tcolorbox}[
colback=green!50!blue,
colframe=white,
leftrule=1.5pt,rightrule=1.5pt,toprule=1.5pt,bottomrule=1.5pt,
sharp corners,
fontupper=\color{white}\sffamily\bfseries\Large\centering
]
Android tutorial
\end{tcolorbox}%
\end{tcolorbox}
\end{document}
Now let's customize our chapter with it.
\documentclass{book}
\usepackage[explicit]{titlesec}
\usepackage[many]{tcolorbox}
\definecolor{myCyan}{HTML}{13C39D}
\titleformat{\chapter}[display]
{\sffamily\bfseries\Huge\filcenter}
{}
{0pt}
{%
\begin{tcolorbox}[
colback=myCyan,
colframe=myCyan,
left=1.5pt,right=1.5pt,top=1.5pt,bottom=-1.5pt,
sharp corners,
boxsep=0pt
]
\begin{tcolorbox}[
colback=myCyan,
colframe=white,
leftrule=1.5pt,rightrule=1.5pt,toprule=1.5pt,bottomrule=1.5pt,
sharp corners,
fontupper=\color{white}\sffamily\bfseries\Huge\centering
]
\thechapter. #1
\end{tcolorbox}%
\end{tcolorbox}%
}
\titlespacing*{\chapter}{0pt}{0cm}{0cm}
\usepackage{lipsum}
\begin{document}
\chapter{Lorem lipsum}
\lipsum[1]
\end{document}