Add task environment

This commit is contained in:
Théophile Bastian 2022-11-25 22:12:06 +01:00
parent bc4f3dfb0c
commit 16b3923b05

View file

@ -2,7 +2,7 @@
\ProvidesClass{RainbowCR}[Compte rendu de CR des Rainbow Swingers]
\LoadClass[a4paper]{article}
\RequirePackage[margin=2cm,right=4.5cm]{geometry}
\RequirePackage[margin=2cm,right=4.5cm, marginparwidth=3cm, marginparsep=0.7cm]{geometry}
\RequirePackage{fontawesome}
\RequirePackage{amsmath}
\RequirePackage{amsfonts}
@ -10,6 +10,8 @@
\RequirePackage[french]{babel}
\RequirePackage[shortlabels]{enumitem}
\RequirePackage{array}
\RequirePackage[framemethod=tikz]{mdframed}
\RequirePackage{marginnote}
% Listes
\setlist[itemize]{label=\textbullet}
@ -62,3 +64,38 @@
\vspace{2em}
}
% Tasks
\definecolor{taskbarcolor}{RGB}{172,70,255}
\definecolor{tasktextcolor}{RGB}{90,36,132}
\newmdenv[
linewidth=0.3mm,
linecolor=taskbarcolor,
bottomline=false,topline=false,leftline=false,
rightmargin=-4.3mm,
innerrightmargin=4mm,
leftmargin=0pt, innerleftmargin=0pt,
skipabove=0.5em, innertopmargin=0.3em,
skipbelow=0.5em, innerbottommargin=0.3em,
]{taskbar}
\newenvironment{task}[1][À définir]{
\ifchoristes\else%
\marginnote{~\\\vspace{-10pt}\raggedright{}\color{tasktextcolor}#1}
\begin{taskbar}%
\fi
}
{
\ifchoristes\else\end{taskbar}\fi
}
% Patch the task environment with indentation
% Thanks https://tex.stackexchange.com/a/207364
\makeatletter
\newcommand{\indentforlinedintro}{%
\patchcmd\mdf@lrbox{\parindent\z@}{\parindent\normalparindent\relax}{}{}%
\patchcmd\mdf@trivlist{\itemindent\z@}{\itemindent\normalparindent}{}{}%
}
\patchcmd{\task}{\begin}{\indentforlinedintro\begin}{}{}
\makeatother