rewrite the class

This commit is contained in:
Jeff Lance 2016-09-29 22:48:18 +02:00
parent 349bb1e7c9
commit 85e0b6288e

View File

@ -13,7 +13,7 @@
%-- classe de base %-- classe de base
\LoadClass[a4paper, 10pt]{article} \LoadClass[a4paper, 12pt]{scrartcl}
%--% %--%
@ -22,47 +22,22 @@
% PERSONNELLES % PERSONNELLES
% commun: contient des définitions et extensions de base pour tout. % commun: contient des définitions et extensions de base pour tout.
\RequirePackage{commun} \RequirePackage{commun}
\RequirePackage{shortcuts}
% sortie % sortie
% \RequirePackage[pdftex]{graphicx} \RequirePackage[pdftex]{graphicx}
\RequirePackage{comment} \RequirePackage{comment}
% mise en page % mise en page
\RequirePackage{fancyhdr} \RequirePackage{geometry}
\RequirePackage{scrlayer-scrpage}
\RequirePackage{mdframed}
\RequirePackage{titlesec}
%--% %--%
%-- structure de la page %-- paramétrages
% marges de la page : haute et basse
\setlength{\hoffset}{-1in+0.5cm}
\setlength{\voffset}{-1in+0.5cm}
% marge du texte
\setlength{\oddsidemargin}{0cm}
\setlength{\topmargin}{0cm}
% marge notes
\setlength{\marginparwidth}{0cm}
\setlength{\marginparsep}{0cm}
% largeur et hauteur du texte
\setlength{\textwidth}{20cm}
\setlength{\textheight}{28.7cm}
% distance du cadre texte avec en-tete
\setlength{\headsep}{0.5cm}
% en-tete
\setlength{\headheight}{1cm}
\renewcommand{\headrulewidth}{0.4pt}% defaut \headrulewidth vaut 0.4pt
% pied de page
\setlength{\footskip}{0.5cm}
\renewcommand{\footrulewidth}{0pt}% defaut \footrulewidth vaut 0pt
% style de page
\pagestyle{empty}
% paragraphes : pas d'alinea
\setlength{\parindent}{0pt}
%--%
%-- paramétrage de certains packages
% metapost % metapost
\ifpdf \ifpdf
\DeclareGraphicsRule{*}{mps}{*}{} \DeclareGraphicsRule{*}{mps}{*}{}
@ -70,6 +45,37 @@
% tkz % tkz
\usetkzobj{all} % on charge tous les objets \usetkzobj{all} % on charge tous les objets
% format de la page
\geometry{a4paper, hmargin=.7cm, vmargin=.7cm}
% titre
\pagestyle{scrheadings}
\setkomafont{title}{\Comic}
% (sub)sections
\titleformat{\section}[block]{\sffamily\bfseries\Large}{\thesection.}{.5em}{}[]
\titleformat{\subsection}[block]{\sffamily\bfseries\large\hspace{2em}}{\thesubsection)}{.5em}{}[]
\renewcommand \thesection{\Roman{section}}
\renewcommand \thesubsection{\arabic{subsection}}
% paths
\graphicspath{{images/}}
% mdframed
\mdfsetup{
frametitlealignment=\raggedright,%
innerbottommargin=2em,%
}
\mdfdefinestyle{framed}{%
linecolor=black,linewidth=1pt,%
leftmargin=0,rightmargin=0,%
innerleftmargin=5pt,innerrightmargin=5pt,%
frametitlerule=true,%
frametitlebackgroundcolor=white!0,innertopmargin=\topskip,%
xcolor,%
}
%--% %--%
@ -78,6 +84,14 @@
\makeatletter \makeatletter
%-- Macros personnelles %-- Macros personnelles
% debut
\NewDocumentCommand \debut { G{Titre} G{Sous-titre} } {%
\title{#1}
\subtitle{#2}
\date{}
\maketitle
}
% Vtextvisiblespace[largeur] % Vtextvisiblespace[largeur]
\newcommand\Vtextvisiblespace[1][.3em]{% \newcommand\Vtextvisiblespace[1][.3em]{%
\mbox{\kern.06em\vrule height.3ex}% \mbox{\kern.06em\vrule height.3ex}%
@ -85,276 +99,322 @@
\hbox{\vrule height.3ex}% \hbox{\vrule height.3ex}%
} }
% entete{dst|dm|int}{numero}{classe}{date} % \partie | \sspartie
\newcommand{\entete}[4] { % definie un titre pour une (sous)section
% le contenu varie en fonction des arguments \newcounter{partiecounter}
\ifthenelse{ \equal{#1}{dst} } \newcounter{sspartiecounter}
{
\fancypagestyle{dst}{ % \NewDocumentCommand \partie { G{Partie} } {%
\lhead{#3\\NOM :\\Pr\'enom :} \def\cType{\Roman}
\chead{\textbf{MATHEMATIQUES}\\Devoir Sur Table n\textsuperscript{o}#2\\} \stepcounter{partiecounter}
\rhead{le : #4\\~~\\}} \setcounter{sspartiecounter}{0}
\thispagestyle{dst} \section{#1}
} }
{ %
\ifthenelse{ \equal{#1}{dm} } \NewDocumentCommand \sspartie { G{Sous-Partie} } {%
{ \def\cType{\arabic}
\fancypagestyle{dm}{ % \stepcounter{sspartiecounter}
\lhead{#3\\NOM :\\Pr\'enom :} \subsection{#1}
\chead{\textbf{MATHEMATIQUES}\\Devoir Maison n\textsuperscript{o}#2\\}
\rhead{\`A rendre le : #4\\~~\\}}
\thispagestyle{dm}
}
{
\ifthenelse{ \equal{#1}{int} }
{
\fancypagestyle{int}{ %
\lhead{#3\\NOM :\\Pr\'enom :}
\chead{\textbf{MATHEMATIQUES}\\Interrogation n\textsuperscript{o}#2\\}
\rhead{le : #4\\~~\\}}
\thispagestyle{int}
}
{
\ifthenelse{ \equal{#1}{crs} }
{
\fancypagestyle{crs}{ %
\lhead{#4}
\chead{\textbf{#2}}
\rhead{Cours}}
\thispagestyle{crs}
}
{
\ifthenelse{ \equal{#1}{act} }
{
\fancypagestyle{act}{ %
\lhead{#4}
\chead{\textbf{#2}}
\@ifmtarg{#3}{ \rhead{Activit\'e} }{ \rhead{Activit\'e - #3} }}
\thispagestyle{act}
}
{
\ifthenelse{ \equal{#1}{exo} }
{
\fancypagestyle{exo}{ %
\lhead{#4}
\chead{\textbf{#2}}
\@ifmtarg{#3}{\rhead{Exercices}}{\rhead{Exercices - #3}}}
\thispagestyle{exo}
}
}
}
}
}
}
} }
% Fix error from KOMA-Script scrartcl class.
\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}
% exercice<[type]> % environnements
% % definition de divers environnements personnels : definition, theoreme, exemple,
% type = 1 -> \arabic % exercice (avec numerotation), remarque, methode.
% type = a -> \alph \NewDocumentEnvironment{déf}{ s g }{%begin
% type = A -> \Alph \IfBooleanTF #1
% type = i -> \roman
% type = I -> \Roman
% \arabic par défaut
\newcounter{exercicecounter}
\newcommand{\exercice}[1][1] {
\ifthenelse{ \equal{#1}{i} }
{ {
\def\cType{\roman} \IfNoValueTF {#2} {
} \begin{block} {}
{ }{
\ifthenelse{ \equal{#1}{I} } \begin{block} {#2}
{
\def\cType{\Roman}
} }
{ }{
\ifthenelse{ \equal{#1}{a} } \IfNoValueTF {#2} {
{ \begin{block} {Définition}
\def\cType{\alph} }{
} \begin{block} {Définition - #2}
{
\ifthenelse{ \equal{#1}{A} }
{
\def\cType{\Alph}
}
{
\def\cType{\arabic}
}
}
} }
} }
\stepcounter{exercicecounter} }{%end
\textbf{Exercice \cType{exercicecounter}\ } \end{block}
} }
% questions<[type]>
% % entete{dst|dm|int}{numero}{classe}{date}
% \newcommand{\entete}[4] {
% % le contenu varie en fonction des arguments
% \ifthenelse{ \equal{#1}{dst} }
% {
% \fancypagestyle{dst}{ %
% \lhead{#3\\NOM :\\Prénom :}
% \chead{\textbf{MATHÉMATIQUES}\\Devoir Sur Table n\textsuperscript{o}#2\\}
% \rhead{le : #4\\~~\\}}
% \thispagestyle{dst}
% }
% {
% \ifthenelse{ \equal{#1}{dm} }
% {
% \fancypagestyle{dm}{ %
% \lhead{#3\\NOM :\\Prénom :}
% \chead{\textbf{MATHÉMATIQUES}\\Devoir Maison n\textsuperscript{o}#2\\}
% \rhead{À rendre le : #4\\~~\\}}
% \thispagestyle{dm}
% }
% {
% \ifthenelse{ \equal{#1}{int} }
% {
% \fancypagestyle{int}{ %
% \lhead{#3\\NOM :\\Prénom :}
% \chead{\textbf{MATHÉMATIQUES}\\Interrogation n\textsuperscript{o}#2\\}
% \rhead{le : #4\\~~\\}}
% \thispagestyle{int}
% }
% {
% \ifthenelse{ \equal{#1}{crs} }
% {
% \fancypagestyle{crs}{ %
% \lhead{#4}
% \chead{\textbf{#2}}
% \rhead{Cours}}
% \thispagestyle{crs}
% }
% {
% \ifthenelse{ \equal{#1}{act} }
% {
% \fancypagestyle{act}{ %
% \lhead{#4}
% \chead{\textbf{#2}}
% \@ifmtarg{#3}{ \rhead{Activité} }{ \rhead{Activité - #3} }}
% \thispagestyle{act}
% }
% {
% \ifthenelse{ \equal{#1}{exo} }
% {
% \fancypagestyle{exo}{ %
% \lhead{#4}
% \chead{\textbf{#2}}
% \@ifmtarg{#3}{\rhead{Exercices}}{\rhead{Exercices - #3}}}
% \thispagestyle{exo}
% }
% }
% }
% }
% }
% }
% }
% %
% type = 1 -> \arabic %
% type = a -> \alph % % exercice<[type]>
% type = A -> \Alph % %
% type = i -> \roman % % type = 1 -> \arabic
% type = I -> \Roman % % type = a -> \alph
% \arabic par défaut % % type = A -> \Alph
\newcounter{cours_questionscounter} % % type = i -> \roman
\newcommand{\questionsseparator}{.} % % type = I -> \Roman
\newenvironment{questions}[1][1] { % % \arabic par défaut
\ifthenelse{ \equal{#1}{i} } % \newcounter{exercicecounter}
{ % \newcommand{\exercice}[1][1] {
\def\cType{\roman} % \ifthenelse{ \equal{#1}{i} }
\renewcommand{\questionsseparator}{)} % {
} % \def\cType{\roman}
{ % }
\ifthenelse{ \equal{#1}{I} } % {
{ % \ifthenelse{ \equal{#1}{I} }
\def\cType{\Roman} % {
\renewcommand{\questionsseparator}{.} % \def\cType{\Roman}
} % }
{ % {
\ifthenelse{ \equal{#1}{a} } % \ifthenelse{ \equal{#1}{a} }
{ % {
\def\cType{\alph} % \def\cType{\alph}
\renewcommand{\questionsseparator}{)} % }
} % {
{ % \ifthenelse{ \equal{#1}{A} }
\ifthenelse{ \equal{#1}{A} } % {
{ % \def\cType{\Alph}
\def\cType{\Alph} % }
\renewcommand{\questionsseparator}{.} % {
} % \def\cType{\arabic}
{ % }
\def\cType{\arabic} % }
\renewcommand{\questionsseparator}{.} % }
} % }
} % \stepcounter{exercicecounter}
} % \textbf{Exercice \cType{exercicecounter}\ }
} % }
\begin{list}{\textbf{\cType{cours_questionscounter}\questionsseparator}}{ %
\usecounter{cours_questionscounter} %
\itemindent=0em % % questions<[type]>
\itemsep=8pt \leftmargin=0,54cm} % %
} { % % type = 1 -> \arabic
\end{list} % % type = a -> \alph
} % % type = A -> \Alph
\newcommand{\bq}{\begin{questions}} % % type = i -> \roman
\newcommand{\eq}{\end{questions}} % % type = I -> \Roman
% % \arabic par défaut
% \newcounter{cours_questionscounter}
% setAngle{nom}{valeur} % \newcommand{\questionsseparator}{.}
\newcommand{\setAngle}[2] { % \newenvironment{questions}[1][1] {
$\widehat{#1} = #2 \textsuperscript{o}$ % \ifthenelse{ \equal{#1}{i} }
} % {
% \def\cType{\roman}
% \renewcommand{\questionsseparator}{)}
% triUn{nom}{long1}{long2}{long3} % }
\newcommand{\triUn}[4] { % {
\StrLen{#1}[\lNom] % \ifthenelse{ \equal{#1}{I} }
\ifthenelse{ \equal{\lNom}{3} } % {
{ % \def\cType{\Roman}
\StrChar{#1}{1}[\sA] % \renewcommand{\questionsseparator}{.}
\StrChar{#1}{2}[\sB] % }
\StrChar{#1}{3}[\sC] % {
% \ifthenelse{ \equal{#1}{a} }
\begin{tikzpicture} % {
\tkzDefPoint(0,0){\sA} % \def\cType{\alph}
\tkzDefPoint(#2,0){\sB} % \renewcommand{\questionsseparator}{)}
\tkzDrawCircle[R,color=white](\sA,#3 cm) % }
\tkzDrawCircle[R,color=white](\sB,#4 cm) % {
\tkzInterCC[R](\sA,#3 cm)(\sB,#4 cm) % \ifthenelse{ \equal{#1}{A} }
\tkzGetPoints{\sC}{Z} % {
\tkzDrawPolygon(\sA,\sB,\sC) % \def\cType{\Alph}
% \renewcommand{\questionsseparator}{.}
\tkzLabelSegment(\sA,\sB){$#2$ cm} % }
\tkzLabelSegment(\sA,\sC){$#3$ cm} % {
\tkzLabelSegment(\sB,\sC){$#4$ cm} % \def\cType{\arabic}
% \renewcommand{\questionsseparator}{.}
\tkzLabelPoint[left](\sA){$\sA$} % }
\tkzLabelPoint[right](\sB){$\sB$} % }
\tkzLabelPoint[above](\sC){$\sC$} % }
\end{tikzpicture} % }
} % \begin{list}{\textbf{\cType{cours_questionscounter}\questionsseparator}}{
} % \usecounter{cours_questionscounter}
% \itemindent=0em
% \itemsep=8pt \leftmargin=0,54cm}
% triDeux{nom}{long1}{long2}{angle} % } {
\newcommand{\triDeux}[4] { % \end{list}
\StrLen{#1}[\lNom] % }
\ifthenelse{ \equal{\lNom}{3} } % \newcommand{\bq}{\begin{questions}}
{ % \newcommand{\eq}{\end{questions}}
\StrChar{#1}{1}[\sA] %
\StrChar{#1}{2}[\sB] %
\StrChar{#1}{3}[\sC] % % setAngle{nom}{valeur}
% \newcommand{\setAngle}[2] {
\def\nAngle{#4} % $\widehat{#1} = #2 \textsuperscript{o}$
% }
\begin{tikzpicture} %
\tkzDefPoint(0,0){\sA} %
\tkzDefPoint(#2,0){\sB} % % triUn{nom}{long1}{long2}{long3}
\tkzDrawSegment(\sA,\sB) % \newcommand{\triUn}[4] {
% \StrLen{#1}[\lNom]
\tkzDefPointBy[rotation=center {\sA} angle {#4}](\sB) % \ifthenelse{ \equal{\lNom}{3} }
\tkzGetPoint{Z} % {
\tkzDefPointBy[homothety=center {\sA} ratio {#3/#2}](Z) % \StrChar{#1}{1}[\sA]
\tkzGetPoint{\sC} % \StrChar{#1}{2}[\sB]
% \StrChar{#1}{3}[\sC]
\tkzDrawSegment(\sA,\sC) %
\tkzDrawSegment(\sB,\sC) % \begin{tikzpicture}
% \tkzDefPoint(0,0){\sA}
\tkzLabelPoint[left](\sA){$\sA$} % \tkzDefPoint(#2,0){\sB}
\tkzLabelPoint[right](\sB){$\sB$} % \tkzDrawCircle[R,color=white](\sA,#3 cm)
\tkzLabelPoint[above](\sC){$\sC$} % \tkzDrawCircle[R,color=white](\sB,#4 cm)
\end{tikzpicture} % \tkzInterCC[R](\sA,#3 cm)(\sB,#4 cm)
} % \tkzGetPoints{\sC}{Z}
} % \tkzDrawPolygon(\sA,\sB,\sC)
%
% \tkzLabelSegment(\sA,\sB){$#2$ cm}
% triTrois{nom}{long}{angle1}{angle2} % \tkzLabelSegment(\sA,\sC){$#3$ cm}
\newcommand{\triTrois}[4] { % \tkzLabelSegment(\sB,\sC){$#4$ cm}
\StrLen{#1}[\lNom] %
\ifthenelse{ \equal{\lNom}{3} } % \tkzLabelPoint[left](\sA){$\sA$}
{ % \tkzLabelPoint[right](\sB){$\sB$}
\StrChar{#1}{1}[\sA] % \tkzLabelPoint[above](\sC){$\sC$}
\StrChar{#1}{2}[\sB] % \end{tikzpicture}
\StrChar{#1}{3}[\sC] % }
% }
\def\nAngle{#4} %
%
\begin{tikzpicture} % % triDeux{nom}{long1}{long2}{angle}
\tkzDefPoint(0,0){\sA} % \newcommand{\triDeux}[4] {
\tkzDefPoint(#2,0){\sB} % \StrLen{#1}[\lNom]
\tkzDrawSegment(\sA,\sB) % \ifthenelse{ \equal{\lNom}{3} }
% {
\tkzDefPointBy[rotation=center {\sA} angle {#3}](\sB) % \StrChar{#1}{1}[\sA]
\tkzGetPoint{Y} % \StrChar{#1}{2}[\sB]
\tkzDefPointBy[rotation=center {\sB} angle {-#4}](\sA) % \StrChar{#1}{3}[\sC]
\tkzGetPoint{Z} %
% \def\nAngle{#4}
\tkzInterLL(\sA,Y)(\sB,Z) %
\tkzGetPoint{\sC} % \begin{tikzpicture}
% \tkzDefPoint(0,0){\sA}
\tkzDrawSegment(\sA,\sC) % \tkzDefPoint(#2,0){\sB}
\tkzDrawSegment(\sB,\sC) % \tkzDrawSegment(\sA,\sB)
%
\tkzLabelPoint[left](\sA){$\sA$} % \tkzDefPointBy[rotation=center {\sA} angle {#4}](\sB)
\tkzLabelPoint[right](\sB){$\sB$} % \tkzGetPoint{Z}
\tkzLabelPoint[above](\sC){$\sC$} % \tkzDefPointBy[homothety=center {\sA} ratio {#3/#2}](Z)
\end{tikzpicture} % \tkzGetPoint{\sC}
} %
} % \tkzDrawSegment(\sA,\sC)
%--% % \tkzDrawSegment(\sB,\sC)
%
% \tkzLabelPoint[left](\sA){$\sA$}
% \tkzLabelPoint[right](\sB){$\sB$}
% \tkzLabelPoint[above](\sC){$\sC$}
% \end{tikzpicture}
% }
% }
%
%
% % triTrois{nom}{long}{angle1}{angle2}
% \newcommand{\triTrois}[4] {
% \StrLen{#1}[\lNom]
% \ifthenelse{ \equal{\lNom}{3} }
% {
% \StrChar{#1}{1}[\sA]
% \StrChar{#1}{2}[\sB]
% \StrChar{#1}{3}[\sC]
%
% \def\nAngle{#4}
%
% \begin{tikzpicture}
% \tkzDefPoint(0,0){\sA}
% \tkzDefPoint(#2,0){\sB}
% \tkzDrawSegment(\sA,\sB)
%
% \tkzDefPointBy[rotation=center {\sA} angle {#3}](\sB)
% \tkzGetPoint{Y}
% \tkzDefPointBy[rotation=center {\sB} angle {-#4}](\sA)
% \tkzGetPoint{Z}
%
% \tkzInterLL(\sA,Y)(\sB,Z)
% \tkzGetPoint{\sC}
%
% \tkzDrawSegment(\sA,\sC)
% \tkzDrawSegment(\sB,\sC)
%
% \tkzLabelPoint[left](\sA){$\sA$}
% \tkzLabelPoint[right](\sB){$\sB$}
% \tkzLabelPoint[above](\sC){$\sC$}
% \end{tikzpicture}
% }
% }
% %--%
%-- Macros modifiées % %-- Macros modifiées
% on n'affiche pas le numéro de page % % on n'affiche pas le numéro de page
\renewcommand{\thepage}{} % \renewcommand{\thepage}{}
%
% numérotation des sections % % numérotation des sections
\renewcommand{\thesection}{\Roman{section}.} % \renewcommand{\thesection}{\Roman{section}.}
%
\renewcommand{\thesubsection}{\arabic{section})} % \renewcommand{\thesubsection}{\arabic{section})}
%--% % %--%
\makeatother \makeatother
%% MACROS : FIN %% MACROS : FIN