I'm new here and almost newbie to latex. Sorry for my English.
Environment: Miktex 4.1, TexnicCenter 2.02(64bit), mode: LaTeX=>PDF
I searched a lot. At first I searched for method to put chapters into a frame... ... and found this:
It wasn't exactly what I've been looking for but decided to work with that.
Additional information: I have 4 chapters.
First attempt:
...
\titleformat{\chapter}[display]
{\sffamily\bfseries}%
{}%
{}%
{\begin{adjustwidth}{-0.9in}{-0.8in}%
\tcbset{standard jigsaw,
colback=ChapterBackColor,
colframe=ChapterFrameColor,
opacityback=0.1,
arc=10pt,
sharp corners=east,
width=\linewidth-0.5in}%
\begin{tcolorbox}[rightrule=0mm,leftrule=3mm,toprule=1mm,bottomrule=0.5mm,flush right,halign=flush right,enlarge top by=-2.5cm,enlarge bottom by=1cm]%
\Large{}CHAPTER\huge{} \Roman{chapter}\strut\\[0.3ex] #1\end{tcolorbox}\end{adjustwidth}}
...
E D I T
Ok. Since my project contained tones of garbage, I needed to prepare ready-to-compile small samples for you.
And this way I located error having vertical mode in message. There is even nothing to talk about.
But there are still errors and believe I'm doing something wrong using titleformat. I have four chapters and four errors:
! Missing number, treated as zero
and four errors:
! Illegal unit of measure (pt inserted)
Code to compile: ...
\documentclass[a4paper,11pt,oneside]{book}
\usepackage[top=1in,bottom=1in,left=1.2in,right=0.8in,headsep=10pt,a4paper]{geometry}
\usepackage{changepage}
\usepackage{polski}
\usepackage[utf8]{inputenc}
\usepackage{avant}
\usepackage{mathptmx}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\definecolor{ChapterFrameColor}{RGB}{222, 66, 44}
\definecolor{ChapterBackColor}{RGB}{255, 222, 111}
\definecolor{ChapterForeColor}{RGB}{ 55, 16, 11}
\definecolor{ListingFrameColor}{RGB}{200, 80, 50}
\definecolor{ListingBackColor}{RGB}{231, 227, 201}
\definecolor{ListingNumColor}{RGB}{251, 249, 241}
\usepackage{tcolorbox}
\usepackage{array}
\usepackage[colorlinks=true,linkcolor=blue,urlcolor=black,bookmarksopen=true]{hyperref}
\usepackage[
open,
openlevel=2,
atend
]{bookmark}[2011/12/02]
\usepackage{tikz}
%
%
%
\usepackage[explicit]{titlesec}
%
\titleformat{\chapter}[display]
{\sffamily\bfseries}%
{}%
{}%
{%
%
\begin{adjustwidth}{-0.9in}{-0.8in}%
\tcbset{standard jigsaw,
colback=ChapterBackColor,
colframe=ChapterFrameColor,
opacityback=0.1,
arc=10pt,
sharp corners=east,
width=\linewidth-0.5in}%
%
\begin{tcolorbox}[rightrule=0mm,leftrule=3mm,toprule=1mm,bottomrule=0.5mm,flush right,halign=flush right,enlarge top by=-2.5cm,enlarge bottom by=1cm]%
\Large{}CHAPTER\huge{} \Roman{chapter}\strut\\[0.3ex]#1\end{tcolorbox}\end{adjustwidth}%
%
}
%
%
%
\usepackage{lipsum}
\tcbuselibrary{minted,skins}
\newtcblisting{mynumcpp}[1][]{listing engine=minted,
minted style=vs,
minted language=cpp,
minted options={fontsize=\small,breaklines,linenos,autogobble,numbersep=3mm,#1},
colback=ListingBackColor,colframe=ListingFrameColor,listing only,
left=7mm,enhanced,
overlay={\begin{tcbclipinterior}\fill[ListingNumColor] (frame.south west)
rectangle ([xshift=7mm]frame.north west);\end{tcbclipinterior}}}
%
\newtcblisting{mycpp}{listing engine=minted,
minted style=vs,
minted language=cpp,
minted options={fontsize=\small,breaklines,autogobble},
colback=ListingBackColor,colframe=ListingFrameColor,listing only,
enhanced}
%
\frenchspacing
\pagestyle{headings}
\begin{document}
\part{Part One}
\chapter{Some chapter}
\section{Section name A}
\lipsum[1-2]
\begin{mycpp}
int main() {
printf("hello, world");
return 0;
}
\end{mycpp}
\lipsum[3-4]
\chapter{Some other chapter}
\section{Section name B}
\lipsum[5-6]
\chapter{Chapter name}
\section{Section name C}
\lipsum[7-8]
\part{Part Two}
\chapter{4th chapter}
\section{Section name D}
\lipsum[5-6]
\end{document}
...
I can remove fragments with minted - if that would be a problem.
I don't know whether I should change a title of this topic or leave it as it is now.
E D I T - 2
Solution : Argument <sep> must be given.

titlesecwith theexplicitoption? – egreg Mar 12 '21 at 07:48\documentclassto\end{document}, loading the relevant packages? Also, please explain a bit which result you expect. – Bernard Mar 12 '21 at 10:35tcolorbox. – Tom Bombadil Mar 12 '21 at 20:34\titleformatmust contain a length and cannot be left empty. – egreg Mar 13 '21 at 18:42