An major update of my document class for curses.

This commit is contained in:
Jeff Lance 2018-12-19 13:41:12 +01:00
parent 98a3df483f
commit 871a4febe0
5 changed files with 1204 additions and 0 deletions

316
jl-cours/environments.tex Normal file
View File

@ -0,0 +1,316 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% ENVIRONMENTS
%
%
% definition
\NewDocumentEnvironment{definition}{ s o }{
\IfBooleanTF {#1} {
% if starred: with logo
\IfNoValueTF {#2} {
% if no subtitle
\begin{@def1}
\noindent
}{
% if subtitle
\begin{@def1}[#2]
\noindent
}
}{
% if not starred: without logo
\IfNoValueTF {#2} {
% if no subtitle
\begin{@def2}
\noindent
}{
% if subtitle
\begin{@def2}[#2]
\noindent
}
}
}{
\IfBooleanTF {#1} {
\end{@def1}
}{
\end{@def2}
}
}
% theoreme
\NewDocumentEnvironment{theoreme}{ s o }{
\IfBooleanTF {#1} {
% if starred: with logo
\IfNoValueTF {#2} {
% if no subtitle
\begin{@thm1}
\noindent
}{
% if subtitle
\begin{@thm1}[#2]
\noindent
}
}{
% if not starred: without logo
\IfNoValueTF {#2} {
% if no subtitle
\begin{@thm2}
\noindent
}{
% if subtitle
\begin{@thm2}[#2]
\noindent
}
}
}{
\IfBooleanTF {#1} {
\end{@thm1}
}{
\end{@thm2}
}
}
% propriete
\NewDocumentEnvironment{propriete}{ s o }{
\IfBooleanTF {#1} {
% if starred: with logo
\IfNoValueTF {#2} {
% if no subtitle
\begin{@ppt1}
\noindent
}{
% if subtitle
\begin{@ppt1}[#2]
\noindent
}
}{
% if not starred: without logo
\IfNoValueTF {#2} {
% if no subtitle
\begin{@ppt2}
\noindent
}{
% if subtitle
\begin{@ppt2}[#2]
\noindent
}
}
}{
\IfBooleanTF {#1} {
\end{@ppt1}
}{
\end{@ppt2}
}
}
% demonstration
\NewDocumentEnvironment{demonstration}{ s o }{
\IfBooleanTF {#1} {
% if starred: with logo
\IfNoValueTF {#2} {
% if no subtitle
\begin{@dem1}
\noindent
}{
% if subtitle
\begin{@dem1}[#2]
\noindent
}
}{
% if not starred: without logo
\IfNoValueTF {#2} {
% if no subtitle
\begin{@dem2}
\noindent
}{
% if subtitle
\begin{@dem2}[#2]
\noindent
}
}
}{
\IfBooleanTF {#1} {
\end{@dem1}
}{
\end{@dem2}
}
}
% vocabulaire
\NewDocumentEnvironment{vocabulaire}{ s o }{
\IfBooleanTF {#1} {
% if starred: with logo
\IfNoValueTF {#2} {
% if no subtitle
\begin{@voc1}
\noindent
}{
% if subtitle
\begin{@voc1}[#2]
\noindent
}
}{
% if not starred: without logo
\IfNoValueTF {#2} {
% if no subtitle
\begin{@voc2}
\noindent
}{
% if subtitle
\begin{@voc2}[#2]
\noindent
}
}
}{
\IfBooleanTF {#1} {
\end{@voc1}
}{
\end{@voc2}
}
}
% citation
\NewDocumentEnvironment{commentaire}{ o }{
\IfNoValueTF {#1} {
% if no subtitle
\begin{@com}
\noindent
}{
% if subtitle
\begin{@com}[#1]
\noindent
}
}{
\end{@com}
}
% remarque
\NewDocumentEnvironment{remarque}{ s o }{
\IfBooleanTF {#1} {
% if starred: without title
\IfNoValueTF {#2} {
% if no subtitle
\begin{@rmq2}
% \vspace{-.3cm}
\noindent
}{
% if subtitle
\begin{@rmq2}[#2]
% \vspace{-.3cm}
\noindent
}
}{
% if not starred: with title
\IfNoValueTF {#2} {
% if no subtitle
\begin{@rmq1}
\vspace{-.5cm}
\noindent
}{
% if subtitle
\begin{@rmq1}[#2]
\vspace{-.5cm}
\noindent
}
}
}{
\IfBooleanTF {#1} {
\end{@rmq2}
}{
\end{@rmq1}
}
}
% exemple
\NewDocumentEnvironment{exemple}{ s o }{
\IfBooleanTF {#1} {
% if starred: without title
\IfNoValueTF {#2} {
% if no subtitle
\begin{@exe2}
\noindent
}{
% if subtitle
\begin{@exe2}[#2]
\noindent
}
}{
% if not starred: with title
\IfNoValueTF {#2} {
% if no subtitle
\begin{@exe1}
\noindent
}{
% if subtitle
\begin{@exe1}[#2]
\noindent
}
}
}{
\IfBooleanTF {#1} {
\end{@exe2}
}{
\end{@exe1}
}
}
% application
\NewDocumentEnvironment{application}{ o }{
\IfNoValueTF {#1} {
% if no subtitle
\begin{@app}
\noindent
}{
% if subtitle
\begin{@app}[#1]
\noindent
}
}{
\end{@app}
}
% methode
\NewDocumentEnvironment{methode}{ s o }{
\IfBooleanTF {#1} {
% if starred: with logo
\IfNoValueTF {#2} {
% if no subtitle
\begin{@met1}
\noindent
}{
% if subtitle
\begin{@met1}[#2]
\noindent
}
}{
% if not starred: without logo
\IfNoValueTF {#2} {
% if no subtitle
\begin{@met2}
\noindent
}{
% if subtitle
\begin{@met2}[#2]
\noindent
}
}
}{
\IfBooleanTF {#1} {
\end{@met1}
}{
\end{@met2}
}
}
% rappel
\NewDocumentEnvironment{rappel}{ o }{
\IfNoValueTF {#1} {
\begin{bclogo}[logo=\bclivre, noborder=true]{Rappel}
}{
\begin{bclogo}[logo=\bclivre, noborder=true]{#1}
}
}{
\end{bclogo}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

118
jl-cours/fixes.tex Normal file
View File

@ -0,0 +1,118 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% FIXES
%
%
%% Fix error from KOMA-Script scrartcl class.
%%
\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}
%% Fix for mdframed package see :
%% http://tex.stackexchange.com/questions/179790/mdframed-how-to-change-the-separator-between-the-label-and-the-title-of-a-non-n#179794
%%
\DeclareDocumentCommand{\mdtheorem}{ O{} m o m o }%
{\ifcsdef{#2}%
{\mdf@PackageWarning{Environment #2 already exits\MessageBreak}}%
{%
\IfNoValueTF {#3}%
{%#3 not given -- number relationship
\IfNoValueTF {#5}%
{%#3+#5 not given
\@definecounter{#2}%
\expandafter\xdef\csname the#2\endcsname{\@thmcounter{#2}}%
\newenvironment{#2}[1][]{%
\refstepcounter{#2}%
\ifstrempty{##1}%
{\let\@temptitle\relax}%
{%
\def\@temptitle{\mdf@theoremseparator%
\mdf@theoremspace%
\mdf@theoremtitlefont%
##1}%
\mdf@thm@caption{#2}{{#4}{\csname the#2\endcsname}{##1}}%
}%
\begin{mdframed}[#1,frametitle={\strut#4\ \csname the#2\endcsname%
\@temptitle}]}%
{\end{mdframed}}%
\newenvironment{#2*}[1][]{%
\ifstrempty{##1}{\let\@temptitle\relax}{\def\@temptitle{\mdf@theoremseparator\ ##1}}% <- the problem was here
\begin{mdframed}[#1,frametitle={\strut#4\@temptitle}]}%
{\end{mdframed}}%
}%
{%#5 given -- reset counter
\@definecounter{#2}\@newctr{#2}[#5]%
\expandafter\xdef\csname the#2\endcsname{\@thmcounter{#2}}%
\expandafter\xdef\csname the#2\endcsname{%
\expandafter\noexpand\csname the#5\endcsname \@thmcountersep%
\@thmcounter{#2}}%
\newenvironment{#2}[1][]{%
\refstepcounter{#2}%
\ifstrempty{##1}%
{\let\@temptitle\relax}%
{%
\def\@temptitle{\mdf@theoremseparator%
\mdf@theoremspace%
\mdf@theoremtitlefont%
##1}%
\mdf@thm@caption{#2}{{#4}{\csname the#2\endcsname}{##1}}%
}
\begin{mdframed}[#1,frametitle={\strut#4\ \csname the#2\endcsname%
\@temptitle}]}%
{\end{mdframed}}%
\newenvironment{#2*}[1][]{%
\ifstrempty{##1}%
{\let\@temptitle\relax}%
{%
\def\@temptitle{\mdf@theoremseparator%
\mdf@theoremspace%
\mdf@theoremtitlefont%
##1}%
\mdf@thm@caption{#2}{{#4}{\csname the#2\endcsname}{##1}}%
}%
\begin{mdframed}[#1,frametitle={\strut#4\@temptitle}]}%
{\end{mdframed}}%
}%
}%
{%#3 given -- number relationship
\global\@namedef{the#2}{\@nameuse{the#3}}%
\newenvironment{#2}[1][]{%
\refstepcounter{#3}%
\ifstrempty{##1}%
{\let\@temptitle\relax}%
{%
\def\@temptitle{\mdf@theoremseparator%
\mdf@theoremspace%
\mdf@theoremtitlefont%
##1}%
\mdf@thm@caption{#2}{{#4}{\csname the#2\endcsname}{##1}}%
}
\begin{mdframed}[#1,frametitle={\strut#4\ \csname the#2\endcsname%
\@temptitle}]}%
{\end{mdframed}}%
\newenvironment{#2*}[1][]{%
\ifstrempty{##1}{\let\@temptitle\relax}{\def\@temptitle{:\ ##1}}%
\begin{mdframed}[#1,frametitle={\strut#4\@temptitle}]}%
{\end{mdframed}}%
}%
}%
}
%% From chingatome.fr
%% to allow some code to be compiled and avoid me to recode some macros
%%
\newbox\dboite%
\newbox\gboite%
\newcommand{\centredeuxlignes}[3][t]{\if t#1\normalbaselineskip=0pt\normallineskip=2pt\normallineskiplimit=10pt\else\normalbaselineskip=0pt\normallineskip=#1pt\normallineskiplimit=10pt\fi%
\setbox\gboite\hbox{#2}%
\setbox\dboite\hbox{#3}%
\ifdim\wd\gboite<\wd\dboite%
$\vcenter{\normalbaselines\hbox to\wd\dboite{\null\hfill#2\hfill\null}\hbox{\null\hfill#3\hfill\null}}$%
\else%
\hbox{$\vcenter{\normalbaselines\hbox{\null\hfill#2\hfill\null}\hbox to \wd\gboite{\null\hfill#3\hfill\null}}$}%
\fi}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

267
jl-cours/jl-cours.cls Normal file
View File

@ -0,0 +1,267 @@
%%%
%%%
%%% Classe : jl-cours.cls
%%% Version : 1.0
%%% Date : 09/11/16
%%% Auteur : Jeff LANCE
%%%
%%% Notes de versions
%%% 25/11/18: version 2.0
%%% renommage de la classe et constitution en package.
%%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{jl-cours}[2016/11/09 Document de cours en A4, V2.0]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% INIT
%
%
\LoadClassWithOptions{scrartcl}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% PACKAGES
%
%
%% Others
%%
\RequirePackage{xkeyval}
%% Own packages. Those contains some global settings and definitions.
%%
\RequirePackage{commun}
\RequirePackage{couleurs}
\RequirePackage{shortcuts}
%% Output
%%
\RequirePackage{comment}
%% Layout
%%
\RequirePackage{geometry}
\RequirePackage[footsepline, plainfootsepline]{scrlayer-scrpage}
\RequirePackage{titling}
\RequirePackage{titlesec}
\RequirePackage{pageslts}
\RequirePackage{enumitem}
\RequirePackage[]{hyperref}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% OPTIONS
%
%
\DeclareOptionX{type}[cours]{%
\def\type{#1}%
}
\ExecuteOptions{a4paper, DIV=24}
\ExecuteOptionsX{type}
\ProcessOptionsX
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% FIXES
%
%
\input{fixes.tex}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% SETTINGS
%
%
%% metapost
%%
\ifpdf
\DeclareGraphicsRule{*}{mps}{*}{}
\fi
%% tkz
%%
\usetkzobj{all} % on charge tous les objets
%% sizing of the page
%%
\geometry{a4paper, includeheadfoot, hmargin=.7cm, vmargin=.5cm, head=14.5pt}
%% title, header and footer
%% KOMA-Script version (preferred)
%%
\ohead{}
\ifthenelse{ \equal{\type}{activity} }{
\IfNoValueTF{ \subtitle }{
\cohead[\@title]{\@title}
\rohead[Activité]{Activité}
}{
\cohead[\@title]{\@title}
\rohead[Activité]{Activité - \@subtitle}
}
}{
\ifthenelse{ \equal{\type}{exercise} }{
\cohead[\@title]{\@title}
\rohead[Exercices]{Exercices}
}{
\rohead[Cours]{Cours - \@title}
}
}
\cofoot*{\thepage\ /\ \pageref{LastPage}}
\pagestyle{scrheadings}
\setkomafont{pagehead}{\normalfont\bfseries}
\setkomafont{pagefoot}{\normalfont}
%% sections
%%
\titleformat{\section}[block]
{\sffamily\bfseries\Large}
{\thesection.}{.5em}{}[]
\titleformat{\subsection}[block]
{\sffamily\bfseries\large\hspace{2em}}
{\thesubsection)}{.5em}{}[]
\titleformat{\subsubsection}[block]
{\sffamily\bfseries\large\hspace{2em}}
{\circled{\thesubsubsection}}{.5em}{}[]
\renewcommand \thesection{\Roman{section}}
\renewcommand \thesubsection{\arabic{subsection}}
\renewcommand \thesubsubsection{\alph{subsubsection}}
%% paths
%%
\graphicspath{{images/}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% MDFRAMED
%
%
\input{mdframed.tex}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% MDTHEOREM
%
%
\input{mdtheorem.tex}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% ENVIRONMENTS
%
%
\input{environments.tex}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% COMMANDS
%
%
%% titre
%%
\NewDocumentCommand \titre { G{Titre} G{Sous-titre} }{%
\setlength{\droptitle}{-2cm}
\title{#1}
\subtitle{#2}
\date{}
\maketitle
}
%% \partie | \sspartie
%% Define a (sub)section title.
%%
\newcounter{partiecounter}
\newcounter{sspartiecounter}
\newcounter{ssspartiecounter}
%
\NewDocumentCommand \partie { G{Partie} } {%
\def\cType{\Roman}
\stepcounter{partiecounter}
\setcounter{sspartiecounter}{0}
\section{#1}
}
%
\NewDocumentCommand \sspartie { G{Sous-Partie} } {%
\def\cType{\arabic}
\stepcounter{sspartiecounter}
\subsection{#1}
}
%
\NewDocumentCommand \ssspartie { G{Sous-sous-Partie} } {%
\def\cType{\alph}
\stepcounter{ssspartiecounter}
\subsubsection{#1}
}
%% new lists definitions
%%
\newlist{questions}{enumerate}{2}
\setlist[questions]{labelindent=0em, leftmargin=*, labelsep=0.5em}
\setlist[questions, 1]{label=\textbf{\arabic*.}}
\setlist[questions, 2]{label=\textbf{\alph*)}}
%
\newlist{questionsl}{enumerate*}{1}
\setlist*[questionsl]{label=\textbf{\alph*)}}
%
\setlist[enumerate, 1]{label=\textbf{\arabic*.}, leftmargin=*, labelsep=.5em}
\setlist[enumerate, 2]{label=\textbf{\alph*)}}
%
\setlist[description]{font=\sffamily\bfseries}
% \NewTasks[counter-format={tsk[1].},label-format={\bfseries}]{questions}[*]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatother

240
jl-cours/mdframed.tex Normal file
View File

@ -0,0 +1,240 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% MDFRAMED
%
%
%% global options
%%
\mdfsetup{
frametitlealignment=\raggedright,%
innerbottommargin=2em,%
}
%% styles
%%
\tikzset{
symbol/.style={
rectangle, draw=white,
fill=white, scale=1,
overlay
}
}
% nologo: a standard square frame with thick border and without a logo
\mdfdefinestyle{nologo}{%
linecolor=black,linewidth=1pt,%
leftmargin=0,rightmargin=0,%
innertopmargin=1em,innerbottommargin=1em,%
innerleftmargin=.5em,innerrightmargin=.5em,%
skipabove=0,skipbelow=0,%
frametitlerule=false,%
frametitlebackgroundcolor=white!0,%
nobreak=true,%
xcolor,%
}
% noborder: a no border frame
\mdfdefinestyle{noborder}{%
linecolor=white,linewidth=0pt,%
leftmargin=0,rightmargin=0,%
innertopmargin=.5em,innerbottommargin=.5em,%
innerleftmargin=.5em,innerrightmargin=.5em,%
skipabove=0,skipbelow=0,%
frametitlerule=false,%
frametitlebackgroundcolor=white!0,%
xcolor,%
}
% pencil: a square frame with a pencil icon in upper left corner
\mdfdefinestyle{pencil}{%
linecolor=black,linewidth=1pt,%
leftmargin=0,rightmargin=0,%
innertopmargin=1em,innerbottommargin=1em,%
innerleftmargin=1em,innerrightmargin=.5em,%
skipabove=0,skipbelow=0,%
frametitlerule=false,%
frametitlebackgroundcolor=white!0,%
nobreak=true,%
xcolor,%
firstextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faPencil };
},%
secondextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faPencil };
},%
middleextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faPencil };
},%
singleextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faPencil };
},%
}
% eye: square frame with an eye logo
\mdfdefinestyle{eye}{%
linecolor=white,linewidth=1pt,%
tikzsetting={draw=black,line width=.5pt},%
leftmargin=2pt,rightmargin=0,%
innertopmargin=1em,innerbottommargin=1em,%
innerleftmargin=.5em,innerrightmargin=.5em,%
skipabove=0,skipbelow=0,%
frametitlerule=false,%
frametitlebackgroundcolor=white!0,%
nobreak=false,%
xcolor,%
hidealllines=true, leftline=true,%
firstextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faEye };
},%
secondextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faEye };
},%
middleextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faEye };
},%
singleextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faEye };
},%
}
% comment: frame with no borders but with a beginning quote at upper left and
% an ending quote at lower right
\mdfdefinestyle{comment}{%
linecolor=white,linewidth=1pt,%
leftmargin=0,rightmargin=0,%
innertopmargin=1em,innerbottommargin=1em,%
innerleftmargin=1em,innerrightmargin=.5em,%
skipabove=0,skipbelow=0,%
frametitlerule=false,%
frametitlebackgroundcolor=white!0,%
nobreak=true,%
xcolor,%
firstextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faQuoteLeft };
\path let \p1=(P), \p2=(O) in ($(\x1,.4)+(0,\y2)$)
node[symbol] { \faQuoteRight };
},%
secondextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faQuoteLeft };
\path let \p1=(P), \p2=(O) in ($(\x1,.4)+(0,\y2)$)
node[symbol] { \faQuoteRight };
},%
middleextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faQuoteLeft };
\path let \p1=(P), \p2=(O) in ($(\x1,.4)+(0,\y2)$)
node[symbol] { \faQuoteRight };
},%
singleextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faQuoteLeft };
\path let \p1=(P), \p2=(O) in ($(\x1,.4)+(0,\y2)$)
node[symbol] { \faQuoteRight };
},%
}
% cogs: a shadowed square frame with a file text icon at upper left
\mdfdefinestyle{cogs}{%
linecolor=white,linewidth=1pt,%
tikzsetting={draw=black,line width=1pt},%
leftmargin=0,rightmargin=0,%
innertopmargin=1em,innerbottommargin=1em,%
innerleftmargin=1em,innerrightmargin=.5em,%
skipabove=0,skipbelow=0,%
frametitlerule=false,%
frametitlebackgroundcolor=white!0,%
nobreak=true,%
xcolor,%
shadow=true,%
firstextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faCogs };
},%
secondextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faCogs };
},%
middleextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faCogs };
},%
singleextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faCogs };
},%
}
% tips: a shadowed square frame with a light bulb icon at upper left
\mdfdefinestyle{tips}{%
linecolor=white,linewidth=1pt,%
tikzsetting={draw=black,line width=1pt},%
leftmargin=0,rightmargin=0,%
innertopmargin=1em,innerbottommargin=1em,%
innerleftmargin=1em,innerrightmargin=.5em,%
skipabove=0,skipbelow=0,%
frametitlerule=false,%
frametitlebackgroundcolor=white!0,%
nobreak=true,%
xcolor,%
hidealllines=true, leftline=true,%
firstextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faLightbulbO };
},%
secondextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faLightbulbO };
},%
middleextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faLightbulbO };
},%
singleextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faLightbulbO };
},%
}
% bookmark: a shadowed square frame with cogs icon at upper left
\mdfdefinestyle{bookmark}{%
linecolor=white,linewidth=1pt,%
tikzsetting={draw=black,line width=1pt},%
leftmargin=0,rightmargin=0,%
innertopmargin=1em,innerbottommargin=1em,%
innerleftmargin=1em,innerrightmargin=.5em,%
skipabove=0,skipbelow=0,%
frametitlerule=false,%
frametitlebackgroundcolor=white!0,%
nobreak=true,%
xcolor,%
hidealllines=true, leftline=true,%
firstextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faBookmarkO };
},%
secondextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faBookmarkO };
},%
middleextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faBookmarkO };
},%
singleextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faBookmarkO };
},%
}
% warn: frame with only left border and warning icon at upper left
\mdfdefinestyle{warning}{%
linecolor=white,linewidth=1pt,%
innerlinewidth=1pt,outerlinewidth=1pt,
tikzsetting={draw=black,
decorate,
decoration={snake, amplitude=.5mm},
line width=.5pt},%
leftmargin=2pt,rightmargin=0,%
innertopmargin=1em,innerbottommargin=1em,%
innerleftmargin=1em,innerrightmargin=.5em,%
skipabove=0,skipbelow=0,%
frametitlerule=false,%
frametitlebackgroundcolor=white!0,%
nobreak=true,%
xcolor,%
hidealllines=true, leftline=true,%
firstextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faExclamationTriangle };
},%
secondextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faExclamationTriangle };
},%
middleextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faExclamationTriangle };
},%
singleextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faExclamationTriangle };
},%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

263
jl-cours/mdtheorem.tex Normal file
View File

@ -0,0 +1,263 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% MDTHEOREM
%
%
%% New theorem declarations and redirection of all standard previously defined
%% environments to their starred version as they don't display numbering.
%%
% definition
\mdtheorem[style=pencil, theoremseparator={},
theoremspace={}, roundcorner=6pt]{@def1}{Définition}
\mdtheorem[style=nologo, theoremseparator={},
theoremspace={}, roundcorner=6pt]{@def2}{Définition}
\RenewDocumentEnvironment{@def1}{ o } {%begin
\IfNoValueTF {#1} {
\begin{@def1*}
}{
\begin{@def1*}[\hfill{\normalfont\slshape#1}]
}
}{%end
\end{@def1*}
}
\RenewDocumentEnvironment{@def2}{ o } {%begin
\IfNoValueTF {#1} {
\begin{@def2*}
}{
\begin{@def2*}[\hfill{\normalfont\slshape#1}]
}
}{%end
\end{@def2*}
}
% theoreme
\mdtheorem[style=pencil, theoremseparator={},
theoremspace={}, roundcorner=6pt,
outerlinewidth=1pt, outerlinecolor=black]{@thm1}{Théorème}
\mdtheorem[style=nologo, theoremseparator={},
theoremspace={}, roundcorner=6pt,
outerlinewidth=1pt, outerlinecolor=black]{@thm2}{Théorème}
\RenewDocumentEnvironment{@thm1}{ o } {%begin
\IfNoValueTF {#1} {
\begin{@thm1*}
}{
\begin{@thm1*}[\hfill{\normalfont\slshape#1}]
}
}{%end
\end{@thm1*}
}
\RenewDocumentEnvironment{@thm2}{ o } {%begin
\IfNoValueTF {#1} {
\begin{@thm2*}
}{
\begin{@thm2*}[\hfill{\normalfont\slshape#1}]
}
}{%end
\end{@thm2*}
}
% propriete
\mdtheorem[style=pencil, theoremseparator={}, theoremspace={},
outerlinewidth=1pt, outerlinecolor=black]{@ppt1}{Propriété}
\mdtheorem[style=nologo, theoremseparator={}, theoremspace={},
outerlinewidth=1pt, outerlinecolor=black]{@ppt2}{Propriété}
\RenewDocumentEnvironment{@ppt1}{ o } {%begin
\IfNoValueTF {#1} {
\begin{@ppt1*}
}{
\begin{@ppt1*}[\hfill{\normalfont\slshape#1}]
}
}{%end
\end{@ppt1*}
}
\RenewDocumentEnvironment{@ppt2}{ o } {%begin
\IfNoValueTF {#1} {
\begin{@ppt2*}
}{
\begin{@ppt2*}[\hfill{\normalfont\slshape#1}]
}
}{%end
\end{@ppt2*}
}
% demonstration
\mdtheorem[style=pencil, theoremseparator={},
theoremspace={}]{@dem1}{Démonstration}
\mdtheorem[style=nologo, theoremseparator={},
theoremspace={}]{@dem2}{Démonstration}
\RenewDocumentEnvironment{@dem1}{ o } {%begin
\IfNoValueTF {#1} {
\begin{@dem1*}
}{
\begin{@dem1*}[\hfill{\normalfont\slshape#1}]
}
}{%end
\end{@dem1*}
}
\RenewDocumentEnvironment{@dem2}{ o } {%begin
\IfNoValueTF {#1} {
\begin{@dem2*}
}{
\begin{@dem2*}[\hfill{\normalfont\slshape#1}]
}
}{%end
\end{@dem2*}
}
% vocabulaire
\mdtheorem[style=pencil, theoremseparator={},
theoremspace={}]{@voc1}{Vocabulaire}
\mdtheorem[style=nologo, theoremseparator={},
theoremspace={}]{@voc2}{Vocabulaire}
\RenewDocumentEnvironment{@voc1}{ o } {%begin
\IfNoValueTF {#1} {
\begin{@voc1*}
}{
\begin{@voc1*}[\hfill{\normalfont\slshape#1}]
}
}{%end
\end{@voc1*}
}
\RenewDocumentEnvironment{@voc2}{ o } {%begin
\IfNoValueTF {#1} {
\begin{@voc2*}
}{
\begin{@voc2*}[\hfill{\normalfont\slshape#1}]
}
}{%end
\end{@voc2*}
}
% commentaire
\mdtheorem[style=quote, frametitle=none,
frametitleaboveskip=0em, frametitlebelowskip=0em]{@com}{}
\RenewDocumentEnvironment{@com}{ o } {%begin
\IfNoValueTF {#1} {
\begin{@com*}
}{
\begin{@com*}[#1]
}
}{%end
\end{@com*}
}
% remarque
\mdtheorem[style=warning, theoremseparator={ -},
theoremspace={}]{@rmq1}{Remarque(s)}
\mdtheorem[style=warning, theoremseparator={},
theoremspace={}]{@rmq2}{}
\RenewDocumentEnvironment{@rmq1}{ o } {%begin
\IfNoValueTF {#1} {
\begin{@rmq1*}
}{
\begin{@rmq1*}[#1]
}
}{%end
\end{@rmq1*}
}
\RenewDocumentEnvironment{@rmq2}{ o } {%begin
\IfNoValueTF {#1} {
\begin{@rmq2*}
}{
\begin{@rmq2*}[#1]
}
}{%end
\end{@rmq2*}
}
% exemple
\mdtheorem[style=eye, theoremseparator={ -}, theoremspace={}]{@exe1}{ Exemple(s)}
\mdtheorem[style=eye, theoremseparator={}, theoremspace={}]{@exe2}{}
\RenewDocumentEnvironment{@exe1}{ o } {%begin
\IfNoValueTF {#1} {
\begin{@exe1*}
}{
\begin{@exe1*}[#1]
}
}{%end
\end{@exe1*}
}
\RenewDocumentEnvironment{@exe2}{ o } {%begin
\IfNoValueTF {#1} {
\begin{@exe2*}
}{
\begin{@exe2*}[#1]
}
}{%end
\end{@exe2*}
}
% application
\mdtheorem[style=cogs, theoremseparator={ -},
theoremspace={}]{@app}{Application}
\RenewDocumentEnvironment{@app}{ o } {%begin
\IfNoValueTF {#1} {
\begin{@app*}
}{
\begin{@app*}[#1]
}
}{%end
\end{@app*}
}
% methode
\mdtheorem[style=bookmark, theoremseparator={ -},
theoremspace={}]{@met1}{Méthode}
\mdtheorem[style=noborder, theoremseparator={},
theoremspace={}]{@met2}{}
\RenewDocumentEnvironment{@met1}{ o } {%begin
\IfNoValueTF {#1} {
\begin{@met1*}
}{
\begin{@met1*}[#1]
}
}{%end
\end{@met1*}
}
\RenewDocumentEnvironment{@met2}{ o } {%begin
\IfNoValueTF {#1} {
\begin{@met2*}
}{
\begin{@met2*}[#1]
}
}{%end
\end{@met2*}
}
% exercice
\newtheoremstyle{@exe}
{\topsep}% espace avant
{\topsep}% espace apres
{}% Police utilisee par le style de thm
{}% Indentation (vide = aucune, \parindent = indentation paragraphe)
{\bfseries}% Police du titre de thm
{}% Signe de ponctuation apres le titre du thm
{\newline}% Espace apres le titre du thm (\newline = linebreak)
{\thmname{#1}\thmnumber{ #2}\thmnote{ - \normalfont{\textit{#3}}}}
% composants du titre du thm : \thmname = nom, \thmnumber = numéro, \thmnote = sous-titre
\theoremstyle{@exe}
\newtheorem{exercice}{Exercice}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%