Cours template
📅 March 29, 2024 | 👁️ Views: 895

\documentclass{article}
\usepackage[margin=1.5cm]{geometry}
\usepackage{tikz}
\usepackage{xcolor} % Required for color definitions
\usepackage{eso-pic} % Required for \AddToShipoutPictureBG
\usepackage{lipsum} % For dummy text
\usetikzlibrary{calc}
\usepackage{titletoc} % Required for customization of TOC
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%% tcolor boxes
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\tcbuselibrary{breakable}
\newtcolorbox{myremark}[1]{%
attach boxed title to top left={yshift=-2mm},
coltitle=black,colbacktitle=red!45!white,enhanced,
fonttitle=\bfseries,
title=\large #1,
colframe=red!75!black,
colback=yellow!80,
}
\newtcolorbox{definition}[1]%
{ enhanced,arc=1mm,outer arc=1mm,
attach boxed title to top left={yshift=-2mm},
colframe=blue!50!black,colback=green!15!white,
coltitle=blue!50!black,colbacktitle=yellow!50!white,
fonttitle=\bfseries,
title=\large #1,
}
\newtcolorbox{proposition}[1]%
{ enhanced,arc=1mm,outer arc=1mm,
attach boxed title to top left={yshift=-2mm},
colframe=red!80!blue,colback=blue!15!white,
coltitle=green!80!blue,colbacktitle=red!30!white,
title=\large\bfseries #1,
}
\newtcolorbox{myexample}[1]{%
empty,
attach boxed title to top left={yshift*=-\tcboxedtitleheight},
title={\large\bfseries #1},
boxed title style={
overlay={
\draw[green!70!blue,line width=2pt,] (frame.south west)--(frame.south east);
},
size=minimal, top=0pt, left=0pt
},
coltitle=red!10!blue,
}
\newcommand*\bdot{\tikz[baseline=(char.base)]{
\node[shape=circle,fill=black,inner sep=1.5pt] (char) {};
}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{setspace}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=black
}
\newcommand{\mylink}{\href{https://mosaid.xyz/cc}{www.mosaid.xyz}}
\newcommand{\mlink}{www.mosaid.xyz}
% Define the color
\definecolor{blueA}{RGB}{0, 128, 255} % Adjust the RGB values as needed
\author{MOSAID}
\newcommand{\myauthor}{MOSAID}
\title{Produit Scalaire dans l'espace}
\newcommand{\mytitle}{Produit Scalaire dans l'espace}
\newcommand{\myclass}{2ème Bac Science Ex}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%% the background rectangles
\pgfdeclareverticalshading{myvshading}{100bp}{
color(0bp)=(blueA);
color(100bp)=(red!20)
}
\pgfdeclarehorizontalshading{myhshading}{2cm}{
color(0cm)=(red!70);
color(2cm)=(blueA)
}
\AddToShipoutPictureBG{%
\begin{tikzpicture}[remember picture,overlay]
% top ribbon in first page
\ifnum\value{page}=1
\shade[shading=myhshading] ([yshift=-1.5cm]current page.north west) rectangle (current page.north east);
\fill[blue] ([xshift=1cm]current page.north west) arc (-180:-90:1.5cm) -- ++(2.5cm,0)
arc (-90:-180:2.5cm) -- cycle;
\node[white, align=center] at ([xshift=2.3cm,yshift=-.75cm]current page.north west) {\Huge\bfseries{09}};
\node[white, align=center] at ([xshift=.5cm,yshift=-.75cm]current page.north)
{\Huge\bfseries{\mytitle}};
\fi
% Left ribbon
\shade[shading=myvshading] ([xshift=1cm, yshift=-3.50cm]current page.north west) rectangle ++(-10,-13);
\node[align=center, white, rotate=90] at ([xshift=0.5cm, yshift=-10cm]current page.north west) {\huge\bfseries\mytitle};
% Bottom ribbon
\shade[shading=myhshading] ([yshift=1cm]current page.south west) rectangle (current page.south east);
%\fill[blueA] ([yshift=1cm]current page.south west) rectangle (current page.south east);
% Page number
\node[circle,draw=white,line width=2pt,minimum size=0.3cm,fill=blueA,font=\bfseries\color{white}]
at ([yshift=0.9cm]current page.south) {\thepage};
\node[anchor=west] at ([yshift=0.75cm,xshift=1cm]current page.south west) {\textbf{\color{white}\myauthor}};
\node[anchor=east] at ([xshift=-1.5cm,yshift=0.75cm]current page.south east) {\textbf{\textcolor{white}{\mylink}}};
\node[anchor=east] at ([xshift=-1.5cm,yshift=0.75cm]current page.south east) {\textbf{\textcolor{white}{\mlink}}};
\end{tikzpicture}
}
% Redefine \maketitle
\makeatletter
\renewcommand{\maketitle}{
\vspace*{1cm}
\begin{center}
{\Huge\bfseries\color{blueA}\@title} \\[1cm]
{\huge\bfseries\color{blueA!50!red}\myclass} \\[1cm]
{\Large\color{red!75}\myauthor~ ~\mylink }\\[0.5cm]
{\large\color{red!45}\today}
\end{center}
}
\makeatother
% Define colors for section types
\definecolor{sectioncolor}{RGB}{255, 0, 0} % Red
\definecolor{subsectioncolor}{RGB}{0, 128, 0} % Green
\definecolor{subsubsectioncolor}{RGB}{0, 0, 255} % Blue
\renewcommand{\contentsname}{Contenu}
\pagestyle{empty}
\begin{document}
% Title page
\maketitle
% Table of Contents
\tableofcontents
\clearpage
\section{\textcolor{sectioncolor}{\lipsum[1][1-1]}}
\subsection{\textcolor{subsectioncolor}{\lipsum[2][1-1]}}
\subsubsection{\textcolor{subsubsectioncolor}{\lipsum[3][1-1]}}
\begin{proposition}{proposition}
\lipsum[1]
\end{proposition}
\begin{myexample}{exemple}
\lipsum[1]
\end{myexample}
\subsubsection{\textcolor{subsubsectioncolor}{\lipsum[4][1-1]}}
\subsection{\textcolor{subsectioncolor}{\lipsum[5][1-1]}}
\begin{definition}{definition}
\lipsum[1]
\end{definition}
\begin{myremark}{remarque}
\lipsum[1]
\end{myremark}
\subsubsection{\textcolor{subsubsectioncolor}{\lipsum[6][1-1]}}
\subsubsection{\textcolor{subsubsectioncolor}{\lipsum[7][1-1]}}
\section{\textcolor{sectioncolor}{\lipsum[8][1-1]}}
\subsection{\textcolor{subsectioncolor}{\lipsum[9][1-1]}}
\subsubsection{\textcolor{subsubsectioncolor}{\lipsum[10][1-1]}}
\subsubsection{\textcolor{subsubsectioncolor}{\lipsum[11][1-1]}}
\subsection{\textcolor{subsectioncolor}{\lipsum[12][1-1]}}
\subsubsection{\textcolor{subsubsectioncolor}{\lipsum[13][1-1]}}
\subsubsection{\textcolor{subsubsectioncolor}{\lipsum[14][1-1]}}
\end{document}