1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
| \documentclass{article}
\usepackage{xcolor}
\definecolor{orange}{RGB}{255,165,0}
\usepackage{tikz}
\usepackage{framed}
\usepackage{ifthen}
\pgfdeclarelayer{background}
\pgfsetlayers{background,main}
\tikzstyle{thmbox}=[inner sep=1em]
\def\parchmentframe#1{
\tikz{
\node[thmbox](A){#1};
\begin{pgfonlayer}{background}
\fill[thmborder](A.south east)--(A.south west)--(A.north west)--(A.north east)--cycle;
\end{pgfonlayer}
}
}
\def\parchmentframetop#1{
\tikz{
\node[thmbox](A){#1};
\begin{pgfonlayer}{background}
\fill[thmborder](A.south west)--(A.north west)--(A.north east)--(A.south east);
\end{pgfonlayer}
}
}
\def\parchmentframemiddle#1{
\tikz{
\node[thmbox](A){#1};
\begin{pgfonlayer}{background}
\fill[thmborder](A.north west)--(A.south west);
\fill[thmborder](A.south east)--(A.north east);
\end{pgfonlayer}
}
}
\def\parchmentframebottom#1{
\tikz{
\node[thmbox](A){#1};
\begin{pgfonlayer}{background}
\fill[thmborder](A.north west)--(A.south west)--(A.south east)--(A.north east);
\end{pgfonlayer}
}
}
\newboolean{correction}
\setboolean{correction}{false}
\newcommand{\corrige}{
\setboolean{correction}{true}
}
\newcommand{\corrigepas}{
\setboolean{correction}{false}
}
\DeclareDocumentEnvironment{correction}{s o}{%
\tikzstyle{thmborder}=[draw=orange,fill=orange!10,line width=1pt,rounded corners=5pt]
\def\FrameCommand{\parchmentframe}
\def\FirstFrameCommand{\parchmentframetop}
\def\MidFrameCommand{\parchmentframemiddle}
\def\LastFrameCommand{\parchmentframebottom}
\vskip\baselineskip
\MakeFramed{\FrameRestore}
\noindent
\tikz\node[inner sep=1.2ex,draw=orange,fill=orange,anchor=west,overlay,line width=1pt,rounded corners=4pt]at(0em,1em){
\color{white}\bfseries{\IfBooleanTF{#1}{Correction}{Correction\space\negthinspace}
\IfNoValueF{#2}{:\space#2}}%
};
\par\nobreak
}{\endMakeFramed}
\ExplSyntaxOn
\cs_new:cpn{correction*}{\correction*}
\cs_new_eq:cN{endcorrection*}\endcorrection
\ExplSyntaxOff
\begin{document}
\corrigepas
\begin{correction}
La réponse correcte est la réponse A.
\end{correction}
\end{document} |
Partager