以下是我所做的:
\ovalbox{\colorbox{cyan!26}{
% \begin{minipage}{15cm}
% \large
% \centering
% \vspace{0.1cm}
% \textbf{INTRODUCTION GENERALE }
% \end{minipage}
%}}
%\end{center}
它仅适用于文本,但不适用于章节等。
答案1
就像这样,基本上是以下的组合:https://tex.stackexchange.com/a/568900/118712和这个:https://tex.stackexchange.com/a/389833/118712
我还对目录和目录章节标题的重新命名进行了一些修改。
\documentclass[12pt,a4paper,listof=totocnumbered]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage[width=17.00cm, height=23.00cm]{geometry}
\usepackage{setspace} \renewcommand{\baselinestretch}{1.5}
\usepackage{times}
\usepackage{tikz}
\addto\captionsfrench{\renewcommand{\bibname}{Références bibliographiques}}
\addto\captionsfrench{\renewcommand{\contentsname}{Sommaire}}
\usepackage[most]{tcolorbox}
\makeatletter
\renewcommand*{\chapterlinesformat}[3]{%
\tcbox[on line, boxsep=4pt,left=4pt,right=0pt,top=0pt,bottom=0pt,colframe=blue,colback=cyan!26,arc=5mm]{
\parbox{\dimexpr\linewidth-2\fboxsep}{\raggedchapter
\@hangfrom{\strut#2}{#3}%
}%
}%
}
\renewcommand*{\sectionlinesformat}[4]{%
\tcbox[on line, boxsep=4pt,left=4pt,right=0pt,top=0pt,bottom=0pt,colframe=green,colback=red,arc=5mm]{%
\parbox{\dimexpr\linewidth-2\fboxsep-2\fboxrule}{\raggedsection
\@hangfrom{\strut\hskip #2#3}{#4}%
}%
}%
}
\makeatother
\begin{document}
\tableofcontents
\addchap[Introduction generale]{\scshape Introduction}
\addsec{I -- contexte et justification }
\addsec{objectifs}
\chapter{début}
\section{title}
\end{document}